| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 * Library General Public License for more details. | 12 * Library General Public License for more details. |
| 13 * | 13 * |
| 14 * You should have received a copy of the GNU Library General Public License | 14 * You should have received a copy of the GNU Library General Public License |
| 15 * along with this library; see the file COPYING.LIB. If not, write to | 15 * along with this library; see the file COPYING.LIB. If not, write to |
| 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 17 * Boston, MA 02110-1301, USA. | 17 * Boston, MA 02110-1301, USA. |
| 18 */ | 18 */ |
| 19 | 19 |
| 20 #ifndef LayoutSVGResourceContainer_h | 20 #ifndef LayoutSVGResourceContainer_h |
| 21 #define LayoutSVGResourceContainer_h | 21 #define LayoutSVGResourceContainer_h |
| 22 | 22 |
| 23 #include "core/layout/svg/LayoutSVGHiddenContainer.h" | 23 #include "core/layout/svg/LayoutSVGHiddenContainer.h" |
| 24 #include "core/svg/SVGDocumentExtensions.h" | 24 #include "core/svg/SVGDocumentExtensions.h" |
| 25 #include "core/svg/SVGResourceClient.h" |
| 26 #include "platform/heap/Handle.h" |
| 25 | 27 |
| 26 namespace blink { | 28 namespace blink { |
| 27 | 29 |
| 28 class SVGElementProxySet; | |
| 29 | |
| 30 enum LayoutSVGResourceType { | 30 enum LayoutSVGResourceType { |
| 31 MaskerResourceType, | 31 MaskerResourceType, |
| 32 MarkerResourceType, | 32 MarkerResourceType, |
| 33 PatternResourceType, | 33 PatternResourceType, |
| 34 LinearGradientResourceType, | 34 LinearGradientResourceType, |
| 35 RadialGradientResourceType, | 35 RadialGradientResourceType, |
| 36 FilterResourceType, | 36 FilterResourceType, |
| 37 ClipperResourceType | 37 ClipperResourceType |
| 38 }; | 38 }; |
| 39 | 39 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 56 virtual LayoutSVGResourceType resourceType() const = 0; | 56 virtual LayoutSVGResourceType resourceType() const = 0; |
| 57 | 57 |
| 58 bool isSVGPaintServer() const { | 58 bool isSVGPaintServer() const { |
| 59 LayoutSVGResourceType resourceType = this->resourceType(); | 59 LayoutSVGResourceType resourceType = this->resourceType(); |
| 60 return resourceType == PatternResourceType || | 60 return resourceType == PatternResourceType || |
| 61 resourceType == LinearGradientResourceType || | 61 resourceType == LinearGradientResourceType || |
| 62 resourceType == RadialGradientResourceType; | 62 resourceType == RadialGradientResourceType; |
| 63 } | 63 } |
| 64 | 64 |
| 65 void idChanged(); | 65 void idChanged(); |
| 66 void addResourceClient(SVGResourceClient*); |
| 67 void removeResourceClient(SVGResourceClient*); |
| 66 | 68 |
| 67 void invalidateCacheAndMarkForLayout(SubtreeLayoutScope* = nullptr); | 69 void invalidateCacheAndMarkForLayout(SubtreeLayoutScope* = nullptr); |
| 68 | 70 |
| 69 static void markForLayoutAndParentResourceInvalidation( | 71 static void markForLayoutAndParentResourceInvalidation( |
| 70 LayoutObject*, | 72 LayoutObject*, |
| 71 bool needsLayout = true); | 73 bool needsLayout = true); |
| 72 | 74 |
| 73 void clearInvalidationMask() { m_invalidationMask = 0; } | 75 void clearInvalidationMask() { m_invalidationMask = 0; } |
| 74 | 76 |
| 75 protected: | 77 protected: |
| 76 // When adding modes, make sure we don't overflow m_invalidationMask below. | 78 // When adding modes, make sure we don't overflow m_invalidationMask below. |
| 77 enum InvalidationMode { | 79 enum InvalidationMode { |
| 78 LayoutAndBoundariesInvalidation = 1 << 0, | 80 LayoutAndBoundariesInvalidation = 1 << 0, |
| 79 BoundariesInvalidation = 1 << 1, | 81 BoundariesInvalidation = 1 << 1, |
| 80 PaintInvalidation = 1 << 2, | 82 PaintInvalidation = 1 << 2, |
| 81 ParentOnlyInvalidation = 1 << 3 | 83 ParentOnlyInvalidation = 1 << 3 |
| 82 }; | 84 }; |
| 83 | 85 |
| 84 // Used from the invalidateClient/invalidateClients methods from classes, | 86 // Used from the invalidateClient/invalidateClients methods from classes, |
| 85 // inheriting from us. | 87 // inheriting from us. |
| 86 void markAllClientsForInvalidation(InvalidationMode); | 88 void markAllClientsForInvalidation(InvalidationMode); |
| 89 void markAllResourceClientsForInvalidation(); |
| 87 void markClientForInvalidation(LayoutObject*, InvalidationMode); | 90 void markClientForInvalidation(LayoutObject*, InvalidationMode); |
| 88 | 91 |
| 89 void notifyContentChanged(); | |
| 90 virtual SVGElementProxySet* elementProxySet() { return nullptr; } | |
| 91 | |
| 92 void willBeDestroyed() override; | 92 void willBeDestroyed() override; |
| 93 | 93 |
| 94 bool m_isInLayout; | 94 bool m_isInLayout; |
| 95 | 95 |
| 96 private: | 96 private: |
| 97 friend class SVGResourcesCache; | 97 friend class SVGResourcesCache; |
| 98 void addClient(LayoutObject*); | 98 void addClient(LayoutObject*); |
| 99 void removeClient(LayoutObject*); | 99 void removeClient(LayoutObject*); |
| 100 void detachAllClients(); | 100 void detachAllClients(); |
| 101 | 101 |
| 102 void registerResource(); | 102 void registerResource(); |
| 103 | 103 |
| 104 AtomicString m_id; | 104 AtomicString m_id; |
| 105 // Track global (markAllClientsForInvalidation) invals to avoid redundant | 105 // Track global (markAllClientsForInvalidation) invals to avoid redundant |
| 106 // crawls. | 106 // crawls. |
| 107 unsigned m_invalidationMask : 8; | 107 unsigned m_invalidationMask : 8; |
| 108 | 108 |
| 109 unsigned m_registered : 1; | 109 unsigned m_registered : 1; |
| 110 unsigned m_isInvalidating : 1; | 110 unsigned m_isInvalidating : 1; |
| 111 // 22 padding bits available | 111 // 22 padding bits available |
| 112 | 112 |
| 113 HashSet<LayoutObject*> m_clients; | 113 HashSet<LayoutObject*> m_clients; |
| 114 PersistentHeapHashSet<WeakMember<SVGResourceClient>> m_resourceClients; |
| 114 }; | 115 }; |
| 115 | 116 |
| 116 inline LayoutSVGResourceContainer* getLayoutSVGResourceContainerById( | 117 inline LayoutSVGResourceContainer* getLayoutSVGResourceContainerById( |
| 117 TreeScope& treeScope, | 118 TreeScope& treeScope, |
| 118 const AtomicString& id) { | 119 const AtomicString& id) { |
| 119 if (id.isEmpty()) | 120 if (id.isEmpty()) |
| 120 return nullptr; | 121 return nullptr; |
| 121 | 122 |
| 122 if (LayoutSVGResourceContainer* layoutResource = | 123 if (LayoutSVGResourceContainer* layoutResource = |
| 123 treeScope.document().accessSVGExtensions().resourceById(id)) | 124 treeScope.document().accessSVGExtensions().resourceById(id)) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 140 isSVGResourceContainer()); | 141 isSVGResourceContainer()); |
| 141 | 142 |
| 142 #define DEFINE_LAYOUT_SVG_RESOURCE_TYPE_CASTS(thisType, typeName) \ | 143 #define DEFINE_LAYOUT_SVG_RESOURCE_TYPE_CASTS(thisType, typeName) \ |
| 143 DEFINE_TYPE_CASTS(thisType, LayoutSVGResourceContainer, resource, \ | 144 DEFINE_TYPE_CASTS(thisType, LayoutSVGResourceContainer, resource, \ |
| 144 resource->resourceType() == typeName, \ | 145 resource->resourceType() == typeName, \ |
| 145 resource.resourceType() == typeName) | 146 resource.resourceType() == typeName) |
| 146 | 147 |
| 147 } // namespace blink | 148 } // namespace blink |
| 148 | 149 |
| 149 #endif | 150 #endif |
| OLD | NEW |