static GroupId calculateGroupId(StyleBase* styleBase) { ASSERT(styleBase); StyleBase* current = styleBase; StyleSheet* styleSheet = 0; while (true) { // Special case: CSSStyleDeclarations might be either inline and in this case // we need to group them with their node or regular ones. if (current->isMutableStyleDeclaration()) { CSSMutableStyleDeclaration* cssMutableStyleDeclaration = static_cast<CSSMutableStyleDeclaration*>(current); if (cssMutableStyleDeclaration->isInlineStyleDeclaration()) { ASSERT(cssMutableStyleDeclaration->parent()->isStyleSheet()); return calculateGroupId(cssMutableStyleDeclaration->node()); } // Either we have no parent, or this parent is a CSSRule. ASSERT(cssMutableStyleDeclaration->parent() == cssMutableStyleDeclaration->parentRule()); } if (current->isStyleSheet()) styleSheet = static_cast<StyleSheet*>(current); StyleBase* parent = current->parent(); if (!parent) break; current = parent; } if (styleSheet) { if (Node* ownerNode = styleSheet->ownerNode()) return calculateGroupId(ownerNode); return GroupId(styleSheet); } return GroupId(current); }
CSSMutableStyleDeclaration* CSSVariablesDeclaration::getParsedVariableDeclarationBlock(const String& variableName) { StyleBase* result = m_variablesMap.get(variableName).get(); if (result->isMutableStyleDeclaration()) return static_cast<CSSMutableStyleDeclaration*>(result); return 0; }
CSSMutableStyleDeclaration* CSSVariablesDeclaration::getParsedVariableDeclarationBlock(const String&) { // FIXME: Disabling declarations as variable values for now since they no longer have a common base class with CSSValues. #if 0 StyleBase* result = m_variablesMap.get(variableName).get(); if (result->isMutableStyleDeclaration()) return static_cast<CSSMutableStyleDeclaration*>(result); #endif return 0; }