| Index: Source/core/html/HTMLImportStateResolver.cpp
|
| diff --git a/Source/core/svg/SVGRectTearOff.cpp b/Source/core/html/HTMLImportStateResolver.cpp
|
| similarity index 53%
|
| copy from Source/core/svg/SVGRectTearOff.cpp
|
| copy to Source/core/html/HTMLImportStateResolver.cpp
|
| index 64a2538c50c2656117137d6d704a5122264ff0b2..9bc6fd351b160ef2da65dd7976531ff5b04f189d 100644
|
| --- a/Source/core/svg/SVGRectTearOff.cpp
|
| +++ b/Source/core/html/HTMLImportStateResolver.cpp
|
| @@ -29,62 +29,57 @@
|
| */
|
|
|
| #include "config.h"
|
| -
|
| -#include "core/svg/SVGRectTearOff.h"
|
| -
|
| -#include "bindings/v8/ExceptionState.h"
|
| -#include "core/dom/ExceptionCode.h"
|
| +#include "core/html/HTMLImportStateResolver.h"
|
|
|
| namespace WebCore {
|
|
|
| -SVGRectTearOff::SVGRectTearOff(PassRefPtr<SVGRect> target, SVGElement* contextElement, PropertyIsAnimValType propertyIsAnimVal, const QualifiedName& attributeName)
|
| - : NewSVGPropertyTearOff<SVGRect>(target, contextElement, propertyIsAnimVal, attributeName)
|
| +inline bool HTMLImportStateResolver::isBlockingFollowers(HTMLImport* import)
|
| {
|
| - ScriptWrappable::init(this);
|
| + if (!import->hasLoader())
|
| + return true;
|
| + if (!import->ownsLoader())
|
| + return false;
|
| + return !import->isStateReady();
|
| }
|
|
|
| -void SVGRectTearOff::setX(float f, ExceptionState& exceptionState)
|
| +inline bool HTMLImportStateResolver::isBlockedFromCreatingDocument() const
|
| {
|
| - if (isImmutable()) {
|
| - exceptionState.throwDOMException(NoModificationAllowedError, "The attribute is read-only.");
|
| - return;
|
| + // If any of its preceeding imports isn't ready, this import
|
| + // cannot start loading because such preceeding onces can include
|
| + // duplicating import that should wins over this.
|
| + for (const HTMLImport* ancestor = m_import; ancestor; ancestor = ancestor->parent()) {
|
| + if (ancestor->previous() && isBlockingFollowers(ancestor->previous()))
|
| + return true;
|
| }
|
|
|
| - target()->setX(f);
|
| - commitChange();
|
| + return false;
|
| }
|
|
|
| -void SVGRectTearOff::setY(float f, ExceptionState& exceptionState)
|
| +inline bool HTMLImportStateResolver::isBlockedFromRunningScript() const
|
| {
|
| - if (isImmutable()) {
|
| - exceptionState.throwDOMException(NoModificationAllowedError, "The attribute is read-only.");
|
| - return;
|
| + for (HTMLImport* child = m_import->firstChild(); child; child = child->next()) {
|
| + if (child->isCreatedByParser() && isBlockingFollowers(child))
|
| + return true;
|
| }
|
|
|
| - target()->setY(f);
|
| - commitChange();
|
| + return false;
|
| }
|
|
|
| -void SVGRectTearOff::setWidth(float f, ExceptionState& exceptionState)
|
| +inline bool HTMLImportStateResolver::isActive() const
|
| {
|
| - if (isImmutable()) {
|
| - exceptionState.throwDOMException(NoModificationAllowedError, "The attribute is read-only.");
|
| - return;
|
| - }
|
| -
|
| - target()->setWidth(f);
|
| - commitChange();
|
| + return !m_import->isDone();
|
| }
|
|
|
| -void SVGRectTearOff::setHeight(float f, ExceptionState& exceptionState)
|
| +HTMLImport::State HTMLImportStateResolver::resolve() const
|
| {
|
| - if (isImmutable()) {
|
| - exceptionState.throwDOMException(NoModificationAllowedError, "The attribute is read-only.");
|
| - return;
|
| - }
|
| -
|
| - target()->setHeight(f);
|
| - commitChange();
|
| + if (isBlockedFromCreatingDocument())
|
| + return HTMLImport::BlockedFromCreatingDocument;
|
| + if (isBlockedFromRunningScript())
|
| + return HTMLImport::BlockedFromRunningScript;
|
| + if (isActive())
|
| + return HTMLImport::Active;
|
| + return HTMLImport::Ready;
|
| }
|
|
|
| }
|
| +
|
|
|