Diff
Modified: trunk/Source/WebCore/ChangeLog (162118 => 162119)
--- trunk/Source/WebCore/ChangeLog 2014-01-16 07:37:46 UTC (rev 162118)
+++ trunk/Source/WebCore/ChangeLog 2014-01-16 09:09:08 UTC (rev 162119)
@@ -1,3 +1,38 @@
+2014-01-16 Dirk Schulze <[email protected]>
+
+ Rename functions in SVGDocumentExtension
+ https://bugs.webkit.org/show_bug.cgi?id=127046
+
+ Reviewed by Sam Weinig.
+
+ Change some function names in SVGDocumentExtension
+ to make them more descriptive.
+
+ Simple refactoring. No new tests.
+
+ * rendering/svg/RenderSVGResourceContainer.cpp:
+ (WebCore::RenderSVGResourceContainer::registerResource):
+ * svg/SVGDocumentExtensions.cpp:
+ (WebCore::SVGDocumentExtensions::addPendingResource):
+ (WebCore::SVGDocumentExtensions::isIdOfPendingResource):
+ (WebCore::SVGDocumentExtensions::isElementWithPendingResources):
+ (WebCore::SVGDocumentExtensions::isPendingResource):
+ (WebCore::SVGDocumentExtensions::clearHasPendingResourcesIfPossible):
+ (WebCore::SVGDocumentExtensions::removeElementFromPendingResources):
+ (WebCore::SVGDocumentExtensions::removePendingResource):
+ (WebCore::SVGDocumentExtensions::removePendingResourceForRemoval):
+ (WebCore::SVGDocumentExtensions::markPendingResourcesForRemoval):
+ (WebCore::SVGDocumentExtensions::removeElementFromPendingResourcesForRemovalMap): The name is not great but a bit more descriptive.
+ * svg/SVGDocumentExtensions.h:
+ * svg/SVGElement.cpp:
+ (WebCore::SVGElement::buildPendingResourcesIfNeeded):
+ * svg/SVGMPathElement.cpp:
+ (WebCore::SVGMPathElement::buildPendingResource):
+ * svg/SVGTextPathElement.cpp:
+ (WebCore::SVGTextPathElement::buildPendingResource):
+ * svg/animation/SVGSMILElement.cpp:
+ (WebCore::SVGSMILElement::buildPendingResource):
+
2014-01-15 Carlos Garcia Campos <[email protected]>
[GTK][EFL][NIX] Do not use PrintContext, Frame and DocumentLoader in Errors
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceContainer.cpp (162118 => 162119)
--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceContainer.cpp 2014-01-16 07:37:46 UTC (rev 162118)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceContainer.cpp 2014-01-16 09:09:08 UTC (rev 162119)
@@ -169,19 +169,19 @@
void RenderSVGResourceContainer::registerResource()
{
SVGDocumentExtensions& extensions = svgExtensionsFromElement(element());
- if (!extensions.hasPendingResource(m_id)) {
+ if (!extensions.isIdOfPendingResource(m_id)) {
extensions.addResource(m_id, this);
return;
}
- std::unique_ptr<SVGDocumentExtensions::SVGPendingElements> clients = extensions.removePendingResource(m_id);
+ std::unique_ptr<SVGDocumentExtensions::PendingElements> clients = extensions.removePendingResource(m_id);
// Cache us with the new id.
extensions.addResource(m_id, this);
// Update cached resources of pending clients.
- const SVGDocumentExtensions::SVGPendingElements::const_iterator end = clients->end();
- for (SVGDocumentExtensions::SVGPendingElements::const_iterator it = clients->begin(); it != end; ++it) {
+ auto end = clients->end();
+ for (auto it = clients->begin(); it != end; ++it) {
ASSERT((*it)->hasPendingResources());
extensions.clearHasPendingResourcesIfPossible(*it);
auto renderer = (*it)->renderer();
Modified: trunk/Source/WebCore/svg/SVGDocumentExtensions.cpp (162118 => 162119)
--- trunk/Source/WebCore/svg/SVGDocumentExtensions.cpp 2014-01-16 07:37:46 UTC (rev 162118)
+++ trunk/Source/WebCore/svg/SVGDocumentExtensions.cpp 2014-01-16 09:09:08 UTC (rev 162119)
@@ -155,13 +155,13 @@
auto result = m_pendingResources.add(id, nullptr);
if (result.isNewEntry)
- result.iterator->value = std::make_unique<SVGPendingElements>();
+ result.iterator->value = std::make_unique<PendingElements>();
result.iterator->value->add(element);
element->setHasPendingResources();
}
-bool SVGDocumentExtensions::hasPendingResource(const AtomicString& id) const
+bool SVGDocumentExtensions::isIdOfPendingResource(const AtomicString& id) const
{
if (id.isEmpty())
return false;
@@ -169,16 +169,14 @@
return m_pendingResources.contains(id);
}
-bool SVGDocumentExtensions::isElementPendingResources(Element* element) const
+bool SVGDocumentExtensions::isElementWithPendingResources(Element* element) const
{
// This algorithm takes time proportional to the number of pending resources and need not.
// If performance becomes an issue we can keep a counted set of elements and answer the question efficiently.
-
ASSERT(element);
-
auto end = m_pendingResources.end();
for (auto it = m_pendingResources.begin(); it != end; ++it) {
- SVGPendingElements* elements = it->value.get();
+ PendingElements* elements = it->value.get();
ASSERT(elements);
if (elements->contains(element))
@@ -187,11 +185,11 @@
return false;
}
-bool SVGDocumentExtensions::isElementPendingResource(Element* element, const AtomicString& id) const
+bool SVGDocumentExtensions::isPendingResource(Element* element, const AtomicString& id) const
{
ASSERT(element);
- if (!hasPendingResource(id))
+ if (!isIdOfPendingResource(id))
return false;
return m_pendingResources.get(id)->contains(element);
@@ -199,7 +197,7 @@
void SVGDocumentExtensions::clearHasPendingResourcesIfPossible(Element* element)
{
- if (!isElementPendingResources(element))
+ if (!isElementWithPendingResources(element))
element->clearHasPendingResources();
}
@@ -212,7 +210,7 @@
Vector<AtomicString> toBeRemoved;
auto end = m_pendingResources.end();
for (auto it = m_pendingResources.begin(); it != end; ++it) {
- SVGPendingElements* elements = it->value.get();
+ PendingElements* elements = it->value.get();
ASSERT(elements);
ASSERT(!elements->isEmpty());
@@ -234,7 +232,7 @@
Vector<AtomicString> toBeRemoved;
auto end = m_pendingResourcesForRemoval.end();
for (auto it = m_pendingResourcesForRemoval.begin(); it != end; ++it) {
- SVGPendingElements* elements = it->value.get();
+ PendingElements* elements = it->value.get();
ASSERT(elements);
ASSERT(!elements->isEmpty());
@@ -250,13 +248,13 @@
}
}
-std::unique_ptr<SVGDocumentExtensions::SVGPendingElements> SVGDocumentExtensions::removePendingResource(const AtomicString& id)
+std::unique_ptr<SVGDocumentExtensions::PendingElements> SVGDocumentExtensions::removePendingResource(const AtomicString& id)
{
ASSERT(m_pendingResources.contains(id));
return m_pendingResources.take(id);
}
-std::unique_ptr<SVGDocumentExtensions::SVGPendingElements> SVGDocumentExtensions::removePendingResourceForRemoval(const AtomicString& id)
+std::unique_ptr<SVGDocumentExtensions::PendingElements> SVGDocumentExtensions::removePendingResourceForRemoval(const AtomicString& id)
{
ASSERT(m_pendingResourcesForRemoval.contains(id));
return m_pendingResourcesForRemoval.take(id);
@@ -269,17 +267,17 @@
ASSERT(!m_pendingResourcesForRemoval.contains(id));
- std::unique_ptr<SVGPendingElements> existing = m_pendingResources.take(id);
+ std::unique_ptr<PendingElements> existing = m_pendingResources.take(id);
if (existing && !existing->isEmpty())
m_pendingResourcesForRemoval.add(id, std::move(existing));
}
-Element* SVGDocumentExtensions::removeElementFromPendingResourcesForRemoval(const AtomicString& id)
+Element* SVGDocumentExtensions::removeElementFromPendingResourcesForRemovalMap(const AtomicString& id)
{
if (id.isEmpty())
return 0;
- SVGPendingElements* resourceSet = m_pendingResourcesForRemoval.get(id);
+ PendingElements* resourceSet = m_pendingResourcesForRemoval.get(id);
if (!resourceSet || resourceSet->isEmpty())
return 0;
Modified: trunk/Source/WebCore/svg/SVGDocumentExtensions.h (162118 => 162119)
--- trunk/Source/WebCore/svg/SVGDocumentExtensions.h 2014-01-16 07:37:46 UTC (rev 162118)
+++ trunk/Source/WebCore/svg/SVGDocumentExtensions.h 2014-01-16 09:09:08 UTC (rev 162119)
@@ -43,7 +43,7 @@
class SVGDocumentExtensions {
WTF_MAKE_NONCOPYABLE(SVGDocumentExtensions); WTF_MAKE_FAST_ALLOCATED;
public:
- typedef HashSet<Element*> SVGPendingElements;
+ typedef HashSet<Element*> PendingElements;
SVGDocumentExtensions(Document*);
~SVGDocumentExtensions();
@@ -83,8 +83,8 @@
HashSet<SVGFontFaceElement*> m_svgFontFaceElements;
#endif
HashMap<AtomicString, RenderSVGResourceContainer*> m_resources;
- HashMap<AtomicString, std::unique_ptr<SVGPendingElements>> m_pendingResources; // Resources that are pending.
- HashMap<AtomicString, std::unique_ptr<SVGPendingElements>> m_pendingResourcesForRemoval; // Resources that are pending and scheduled for removal.
+ HashMap<AtomicString, std::unique_ptr<PendingElements>> m_pendingResources; // Resources that are pending.
+ HashMap<AtomicString, std::unique_ptr<PendingElements>> m_pendingResourcesForRemoval; // Resources that are pending and scheduled for removal.
HashMap<SVGElement*, std::unique_ptr<HashSet<SVGElement*>>> m_elementDependencies;
std::unique_ptr<SVGResourcesCache> m_resourcesCache;
@@ -93,19 +93,19 @@
// which are referenced by any object in the SVG document, but do NOT exist yet.
// For instance, dynamically build gradients / patterns / clippers...
void addPendingResource(const AtomicString& id, Element*);
- bool hasPendingResource(const AtomicString& id) const;
- bool isElementPendingResources(Element*) const;
- bool isElementPendingResource(Element*, const AtomicString& id) const;
+ bool isIdOfPendingResource(const AtomicString& id) const;
+ bool isPendingResource(Element*, const AtomicString& id) const;
void clearHasPendingResourcesIfPossible(Element*);
void removeElementFromPendingResources(Element*);
- std::unique_ptr<SVGPendingElements> removePendingResource(const AtomicString& id);
+ std::unique_ptr<PendingElements> removePendingResource(const AtomicString& id);
// The following two functions are used for scheduling a pending resource to be removed.
void markPendingResourcesForRemoval(const AtomicString&);
- Element* removeElementFromPendingResourcesForRemoval(const AtomicString&);
+ Element* removeElementFromPendingResourcesForRemovalMap(const AtomicString&);
private:
- std::unique_ptr<SVGPendingElements> removePendingResourceForRemoval(const AtomicString&);
+ bool isElementWithPendingResources(Element*) const;
+ std::unique_ptr<PendingElements> removePendingResourceForRemoval(const AtomicString&);
};
}
Modified: trunk/Source/WebCore/svg/SVGElement.cpp (162118 => 162119)
--- trunk/Source/WebCore/svg/SVGElement.cpp 2014-01-16 07:37:46 UTC (rev 162118)
+++ trunk/Source/WebCore/svg/SVGElement.cpp 2014-01-16 09:09:08 UTC (rev 162119)
@@ -1036,14 +1036,14 @@
SVGDocumentExtensions* extensions = document().accessSVGExtensions();
String resourceId = getIdAttribute();
- if (!extensions->hasPendingResource(resourceId))
+ if (!extensions->isIdOfPendingResource(resourceId))
return;
// Mark pending resources as pending for removal.
extensions->markPendingResourcesForRemoval(resourceId);
// Rebuild pending resources for each client of a pending resource that is being removed.
- while (Element* clientElement = extensions->removeElementFromPendingResourcesForRemoval(resourceId)) {
+ while (Element* clientElement = extensions->removeElementFromPendingResourcesForRemovalMap(resourceId)) {
ASSERT(clientElement->hasPendingResources());
if (clientElement->hasPendingResources()) {
clientElement->buildPendingResource();
Modified: trunk/Source/WebCore/svg/SVGMPathElement.cpp (162118 => 162119)
--- trunk/Source/WebCore/svg/SVGMPathElement.cpp 2014-01-16 07:37:46 UTC (rev 162118)
+++ trunk/Source/WebCore/svg/SVGMPathElement.cpp 2014-01-16 09:09:08 UTC (rev 162119)
@@ -67,7 +67,7 @@
Element* target = SVGURIReference::targetElementFromIRIString(href(), document(), &id);
if (!target) {
// Do not register as pending if we are already pending this resource.
- if (document().accessSVGExtensions()->isElementPendingResource(this, id))
+ if (document().accessSVGExtensions()->isPendingResource(this, id))
return;
if (!id.isEmpty()) {
Modified: trunk/Source/WebCore/svg/SVGTextPathElement.cpp (162118 => 162119)
--- trunk/Source/WebCore/svg/SVGTextPathElement.cpp 2014-01-16 07:37:46 UTC (rev 162118)
+++ trunk/Source/WebCore/svg/SVGTextPathElement.cpp 2014-01-16 09:09:08 UTC (rev 162119)
@@ -163,7 +163,7 @@
Element* target = SVGURIReference::targetElementFromIRIString(href(), document(), &id);
if (!target) {
// Do not register as pending if we are already pending this resource.
- if (document().accessSVGExtensions()->isElementPendingResource(this, id))
+ if (document().accessSVGExtensions()->isPendingResource(this, id))
return;
if (!id.isEmpty()) {
Modified: trunk/Source/WebCore/svg/animation/SVGSMILElement.cpp (162118 => 162119)
--- trunk/Source/WebCore/svg/animation/SVGSMILElement.cpp 2014-01-16 07:37:46 UTC (rev 162118)
+++ trunk/Source/WebCore/svg/animation/SVGSMILElement.cpp 2014-01-16 09:09:08 UTC (rev 162119)
@@ -175,7 +175,7 @@
if (!svgTarget) {
// Do not register as pending if we are already pending this resource.
- if (document().accessSVGExtensions()->isElementPendingResource(this, id))
+ if (document().accessSVGExtensions()->isPendingResource(this, id))
return;
if (!id.isEmpty()) {