本文整理汇总了C++中StyleBase::parent方法的典型用法代码示例。如果您正苦于以下问题:C++ StyleBase::parent方法的具体用法?C++ StyleBase::parent怎么用?C++ StyleBase::parent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StyleBase
的用法示例。
在下文中一共展示了StyleBase::parent方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: notifyChanged
void MediaList::notifyChanged()
{
for (StyleBase* p = parent(); p; p = p->parent()) {
if (p->isCSSStyleSheet())
return static_cast<CSSStyleSheet*>(p)->styleSheetChanged();
}
}
示例2: stylesheet
StyleSheet* StyleBase::stylesheet()
{
StyleBase *b = this;
while (b && !b->isStyleSheet())
b = b->parent();
return static_cast<StyleSheet*>(b);
}
示例3: calculateGroupId
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);
}
示例4: setNeedsStyleRecalc
void CSSMutableStyleDeclaration::setNeedsStyleRecalc()
{
if (m_node) {
// FIXME: Ideally, this should be factored better and there
// should be a subclass of CSSMutableStyleDeclaration just
// for inline style declarations that handles this
bool isInlineStyleDeclaration = m_node->isStyledElement() && this == static_cast<StyledElement*>(m_node)->inlineStyleDecl();
if (isInlineStyleDeclaration) {
m_node->setNeedsStyleRecalc(InlineStyleChange);
static_cast<StyledElement*>(m_node)->invalidateStyleAttribute();
if (m_node->document())
InspectorInstrumentation::didInvalidateStyleAttr(m_node->document(), m_node);
} else
m_node->setNeedsStyleRecalc(FullStyleChange);
return;
}
StyleBase* root = this;
while (StyleBase* parent = root->parent())
root = parent;
if (root->isCSSStyleSheet()) {
if (Document* document = static_cast<CSSStyleSheet*>(root)->document())
document->styleSelectorChanged(DeferRecalcStyle);
}
}
示例5: setChanged
void CSSVariablesDeclaration::setChanged()
{
// FIXME: Make this much better (it has the same problem CSSMutableStyleDeclaration does).
StyleBase* root = this;
while (StyleBase* parent = root->parent())
root = parent;
if (root->isCSSStyleSheet())
static_cast<CSSStyleSheet*>(root)->doc()->updateStyleSelector();
}
示例6: styleSheetChanged
void CSSStyleSheet::styleSheetChanged()
{
StyleBase* root = this;
while (StyleBase* parent = root->parent())
root = parent;
Document* documentToUpdate = root->isCSSStyleSheet() ? static_cast<CSSStyleSheet*>(root)->document() : 0;
/* FIXME: We don't need to do everything updateStyleSelector does,
* basically we just need to recreate the document's selector with the
* already existing style sheets.
*/
if (documentToUpdate)
documentToUpdate->styleSelectorChanged(DeferRecalcStyle);
}
示例7: document
Document* CSSStyleSheet::document()
{
StyleBase* styleObject = this;
while (styleObject) {
if (styleObject->isCSSStyleSheet()) {
Node* ownerNode = static_cast<CSSStyleSheet*>(styleObject)->ownerNode();
if (ownerNode)
return ownerNode->document();
}
if (styleObject->isRule())
styleObject = static_cast<CSSRule*>(styleObject)->parentStyleSheet();
else
styleObject = styleObject->parent();
}
return 0;
}
示例8: insertedIntoParent
void CSSImportRule::insertedIntoParent()
{
CSSStyleSheet* parentSheet = parentStyleSheet();
if (!parentSheet || !parentSheet->document())
return;
CachedResourceLoader* cachedResourceLoader = parentSheet->document()->cachedResourceLoader();
if (!cachedResourceLoader)
return;
String absHref = m_strHref;
if (!parentSheet->finalURL().isNull())
// use parent styleheet's URL as the base URL
absHref = KURL(parentSheet->finalURL(), m_strHref).string();
// Check for a cycle in our import chain. If we encounter a stylesheet
// in our parent chain with the same URL, then just bail.
StyleBase* root = this;
for (StyleBase* curr = parent(); curr; curr = curr->parent()) {
// FIXME: This is wrong if the finalURL was updated via document::updateBaseURL.
if (curr->isCSSStyleSheet() && absHref == static_cast<CSSStyleSheet*>(curr)->finalURL().string())
return;
root = curr;
}
ResourceRequest request(parentSheet->document()->completeURL(absHref));
if (parentSheet->isUserStyleSheet())
m_cachedSheet = cachedResourceLoader->requestUserCSSStyleSheet(request, parentSheet->charset());
else
m_cachedSheet = cachedResourceLoader->requestCSSStyleSheet(request, parentSheet->charset());
if (m_cachedSheet) {
// if the import rule is issued dynamically, the sheet may be
// removed from the pending sheet count, so let the doc know
// the sheet being imported is pending.
if (parentSheet && parentSheet->loadCompleted() && root == parentSheet)
parentSheet->startLoadingDynamicSheet();
m_loading = true;
m_cachedSheet->addClient(this);
}
}
示例9: setChanged
void CSSMutableStyleDeclaration::setChanged()
{
if (m_node) {
// FIXME: Ideally, this should be factored better and there
// should be a subclass of CSSMutableStyleDeclaration just
// for inline style declarations that handles this
bool isInlineStyleDeclaration = m_node->isStyledElement() && this == static_cast<StyledElement*>(m_node)->inlineStyleDecl();
if (isInlineStyleDeclaration) {
m_node->setChanged(InlineStyleChange);
static_cast<StyledElement*>(m_node)->invalidateStyleAttribute();
} else
m_node->setChanged(FullStyleChange);
return;
}
// FIXME: quick&dirty hack for KDE 3.0... make this MUCH better! (Dirk)
StyleBase* root = this;
while (StyleBase* parent = root->parent())
root = parent;
if (root->isCSSStyleSheet())
static_cast<CSSStyleSheet*>(root)->doc()->updateStyleSelector();
}