Esempio n. 1
0
static bool isAcceptableCSSStyleSheetParent(const Node& parentNode) {
  // Only these nodes can be parents of StyleSheets, and they need to call
  // clearOwnerNode() when moved out of document. Note that destructor of
  // the nodes don't call clearOwnerNode() with Oilpan.
  return parentNode.isDocumentNode() || isHTMLLinkElement(parentNode) ||
         isHTMLStyleElement(parentNode) || isSVGStyleElement(parentNode) ||
         parentNode.getNodeType() == Node::kProcessingInstructionNode;
}
Esempio n. 2
0
static bool isAcceptableCSSStyleSheetParent(Node* parentNode)
{
    // Only these nodes can be parents of StyleSheets, and they need to call
    // clearOwnerNode() when moved out of document. Note that destructor of
    // the nodes don't call clearOwnerNode() with Oilpan.
    return !parentNode
        || parentNode->isDocumentNode()
        || isHTMLLinkElement(*parentNode)
        || isHTMLStyleElement(*parentNode)
        || isSVGStyleElement(*parentNode)
        || parentNode->getNodeType() == Node::PROCESSING_INSTRUCTION_NODE;
}
static bool isAcceptableCSSStyleSheetParent(Node* parentNode)
{
    // Only these nodes can be parents of StyleSheets, and they need to call
    // clearOwnerNode() when moved out of document.
    // Destruction of the style sheet counts as being "moved out of the
    // document", but only in the non-oilpan version of blink. I.e. don't call
    // clearOwnerNode() in the owner's destructor in oilpan.
    return !parentNode
        || parentNode->isDocumentNode()
        || isHTMLLinkElement(*parentNode)
        || isHTMLStyleElement(*parentNode)
        || isSVGStyleElement(*parentNode)
        || parentNode->nodeType() == Node::PROCESSING_INSTRUCTION_NODE;
}
TreeScope* ScopedStyleResolver::treeScopeFor(Document& document, const CSSStyleSheet* sheet)
{
    ASSERT(sheet);

    if (!sheet->ownerDocument())
        return 0;

    Node* ownerNode = sheet->ownerNode();
    if (!isHTMLStyleElement(ownerNode) && !isSVGStyleElement(ownerNode))
        return &document;

    Element& styleElement = toElement(*ownerNode);
    if (styleElement.isInShadowTree())
        return styleElement.containingShadowRoot();
    return &document;
}
Esempio n. 5
0
static bool isStyleElement(const Node* node)
{
    return node && (isHTMLStyleElement(node) || isSVGStyleElement(node));
}