Ejemplo n.º 1
0
TagCollection::~TagCollection()
{
    if (m_namespaceURI == starAtom)
        ownerNode().nodeLists()->removeCachedCollection(this, m_localName);
    else
        ownerNode().nodeLists()->removeCachedCollectionWithQualifiedName(*this, m_namespaceURI, m_localName);
}
Ejemplo n.º 2
0
TagCollection::~TagCollection()
{
    if (m_namespaceURI == starAtom)
        ownerNode().nodeLists()->removeCache(this, type(), m_localName);
    else
        ownerNode().nodeLists()->removeCache(this, m_namespaceURI, m_localName);
}
Ejemplo n.º 3
0
TagNodeList::~TagNodeList()
{
    if (m_namespaceURI == starAtom)
        ownerNode().nodeLists()->removeCacheWithAtomicName(this, m_localName);
    else
        ownerNode().nodeLists()->removeCacheWithQualifiedName(this, m_namespaceURI, m_localName);
}
Ejemplo n.º 4
0
ContainerNode& LiveNodeList::rootNode() const
{
    if (isRootedAtDocument() && ownerNode().inDocument())
        return ownerNode().document();

    return ownerNode();
}
Ejemplo n.º 5
0
void CSSStyleSheet::checkLoaded()
{
    if (isLoading())
        return;
    if (parent())
        parent()->checkLoaded();
    m_loadCompleted = ownerNode() ? ownerNode()->sheetLoaded() : true;
}
TagCollection::~TagCollection()
{
#if !ENABLE(OILPAN)
    if (m_namespaceURI == starAtom)
        ownerNode().nodeLists()->removeCache(this, type(), m_localName);
    else
        ownerNode().nodeLists()->removeCache(this, m_namespaceURI, m_localName);
#endif
}
Ejemplo n.º 7
0
void XSLStyleSheet::checkLoaded()
{
    if (isLoading())
        return;
    if (parent())
        parent()->checkLoaded();
    if (ownerNode())
        ownerNode()->sheetLoaded();
}
void XSLStyleSheet::checkLoaded()
{
    if (isLoading())
        return;
    if (XSLStyleSheet* styleSheet = parentStyleSheet())
        styleSheet->checkLoaded();
    if (ownerNode())
        ownerNode()->sheetLoaded();
}
void CSSStyleSheet::checkLoaded()
{
    if (isLoading())
        return;
    if (parent())
        parent()->checkLoaded();

    // Avoid |this| being deleted by scripts that run via HTMLTokenizer::executeScriptsWaitingForStylesheets().
    // See <rdar://problem/6622300>.
    RefPtr<CSSStyleSheet> protector(this);
    m_loadCompleted = ownerNode() ? ownerNode()->sheetLoaded() : true;
}
Ejemplo n.º 10
0
bool HTMLOptionsCollection::anonymousIndexedSetter(unsigned index, PassRefPtr<HTMLOptionElement> value, ExceptionCode& ec)
{
    HTMLSelectElement* base = toHTMLSelectElement(ownerNode());
    if (!value) {
        ec = TYPE_MISMATCH_ERR;
        return true;
    }
    base->setOption(index, value.get(), ec);
    return true;
}
Ejemplo n.º 11
0
bool HTMLOptionsCollection::anonymousIndexedSetter(unsigned index, PassRefPtrWillBeRawPtr<HTMLOptionElement> value, ExceptionState& exceptionState)
{
    HTMLSelectElement& base = toHTMLSelectElement(ownerNode());
    if (!value) { // undefined or null
        base.remove(index);
        return true;
    }
    base.setOption(index, value.get(), exceptionState);
    return true;
}
Ejemplo n.º 12
0
bool HTMLOptionsCollection::anonymousIndexedSetter(unsigned index, PassRefPtr<HTMLOptionElement> value, ExceptionState& exceptionState)
{
    HTMLSelectElement* base = toHTMLSelectElement(ownerNode());
    if (!value) {
        exceptionState.throwTypeError(ExceptionMessages::failedToSet(String::number(index), "HTMLOptionsCollection", "The element provided was not an HTMLOptionElement."));
        return true;
    }
    base->setOption(index, value.get(), exceptionState);
    return true;
}
Ejemplo n.º 13
0
Node* LiveNodeListBase::rootNode() const
{
    if (isRootedAtDocument() && m_ownerNode->inDocument())
        return m_ownerNode->document();

#if ENABLE(MICRODATA)
    if (m_rootType == NodeListIsRootedAtDocumentIfOwnerHasItemrefAttr && toElement(ownerNode())->fastHasAttribute(HTMLNames::itemrefAttr)) {
        if (m_ownerNode->inDocument())
            return m_ownerNode->document();

        Node* root = m_ownerNode.get();
        while (Node* parent = root->parentNode())
            root = parent;
        return root;
    }
#endif

    return m_ownerNode.get();
}
Ejemplo n.º 14
0
void CSSStyleSheet::checkLoaded()
{
    if (isLoading())
        return;

    // Avoid |this| being deleted by scripts that run via
    // ScriptableDocumentParser::executeScriptsWaitingForStylesheets().
    // See <rdar://problem/6622300>.
    RefPtr<CSSStyleSheet> protector(this);
    if (CSSStyleSheet* styleSheet = parentStyleSheet())
        styleSheet->checkLoaded();

    RefPtr<Node> owner = ownerNode();
    if (!owner)
        m_loadCompleted = true;
    else {
        m_loadCompleted = owner->sheetLoaded();
        if (m_loadCompleted)
            owner->notifyLoadedSheetAndAllCriticalSubresources(m_didLoadErrorOccur);
    }
}
Ejemplo n.º 15
0
void HTMLOptionsCollection::add(PassRefPtr<HTMLOptionElement> element, int index, ExceptionState& exceptionState)
{
    HTMLOptionElement* newOption = element.get();

    if (!newOption) {
        exceptionState.throwTypeError("The element provided was not an HTMLOptionElement.");
        return;
    }

    if (index < -1) {
        exceptionState.throwDOMException(IndexSizeError, "The index provided (" + String::number(index) + ") is less than -1.");
        return;
    }

    HTMLSelectElement* select = toHTMLSelectElement(ownerNode());

    if (index == -1 || unsigned(index) >= length())
        select->add(newOption, 0, exceptionState);
    else
        select->add(newOption, toHTMLOptionElement(item(index)), exceptionState);

    ASSERT(!exceptionState.hadException());
}
void HTMLOptionsCollection::add(PassRefPtr<HTMLOptionElement> element, int index, ExceptionCode& ec)
{
    HTMLOptionElement* newOption = element.get();

    if (!newOption) {
        ec = TYPE_MISMATCH_ERR;
        return;
    }

    if (index < -1) {
        ec = INDEX_SIZE_ERR;
        return;
    }

    ec = 0;
    HTMLSelectElement* select = toHTMLSelectElement(ownerNode());

    if (index == -1 || unsigned(index) >= length())
        select->add(newOption, 0, ec);
    else
        select->add(newOption, static_cast<HTMLOptionElement*>(item(index)), ec);

    ASSERT(!ec);
}
Ejemplo n.º 17
0
void CSSStyleSheet::willMutateRules()
{
    // If we are the only client it is safe to mutate.
    if (m_contents->clientSize() <= 1 && !m_contents->isReferencedFromResource()) {
        m_contents->clearRuleSet();
        if (Document* document = ownerDocument())
            m_contents->removeSheetFromCache(document);
        m_contents->setMutable();
        return;
    }
    // Only cacheable stylesheets should have multiple clients.
    ASSERT((isStyleElement(ownerNode()) && m_contents->isCacheableForStyleElement())
        || m_contents->isCacheableForResource());

    // Copy-on-write.
    m_contents->unregisterClient(this);
    m_contents = m_contents->copy();
    m_contents->registerClient(this);

    m_contents->setMutable();

    // Any existing CSSOM wrappers need to be connected to the copied child rules.
    reattachChildRuleCSSOMWrappers();
}
Ejemplo n.º 18
0
int HTMLOptionsCollection::selectedIndex() const
{
    return toHTMLSelectElement(ownerNode())->selectedIndex();
}
Ejemplo n.º 19
0
void HTMLOptionsCollection::remove(int index)
{
    toHTMLSelectElement(ownerNode())->remove(index);
}
Ejemplo n.º 20
0
bool HTMLOptionsCollection::anonymousIndexedSetterRemove(unsigned index, ExceptionState& exceptionState)
{
    HTMLSelectElement* base = toHTMLSelectElement(ownerNode());
    base->remove(index);
    return true;
}
Ejemplo n.º 21
0
void XSLStyleSheet::checkLoaded()
{
    if (ownerNode())
        ownerNode()->sheetLoaded();
}
Ejemplo n.º 22
0
Document* XSLStyleSheet::ownerDocument()
{
    Node* node = ownerNode();
    return node ? node->document() : 0;
}
Node* ChildNodeList::virtualOwnerNode() const
{
    return &ownerNode();
}
Ejemplo n.º 24
0
ClassNodeList::~ClassNodeList()
{
    ownerNode()->nodeLists()->removeCacheWithName(this, ClassNodeListType, m_originalClassNames);
} 
ChildNodeList::~ChildNodeList()
{
    ownerNode()->nodeLists()->removeChildNodeList(this);
}
Ejemplo n.º 26
0
void HTMLOptionsCollection::setSelectedIndex(int index)
{
    toHTMLSelectElement(ownerNode())->setSelectedIndex(index);
}
Ejemplo n.º 27
0
void HTMLOptionsCollection::setLength(unsigned length, ExceptionState& exceptionState)
{
    toHTMLSelectElement(ownerNode())->setLength(length, exceptionState);
}
Ejemplo n.º 28
0
void CSSStyleSheet::startLoadingDynamicSheet()
{
    if (Node* owner = ownerNode())
        owner->startLoadingDynamicSheet();
}
Ejemplo n.º 29
0
HTMLTagCollection::~HTMLTagCollection()
{
    ownerNode().nodeLists()->removeCachedCollection(this, m_localName);
}
Ejemplo n.º 30
0
Node* LiveNodeList::virtualOwnerNode() const
{
    return &ownerNode();
}