本文整理汇总了C++中StyleResolver类的典型用法代码示例。如果您正苦于以下问题:C++ StyleResolver类的具体用法?C++ StyleResolver怎么用?C++ StyleResolver使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了StyleResolver类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: document
void ShadowRoot::attach()
{
StyleResolver* styleResolver = document()->styleResolver();
styleResolver->pushParentShadowRoot(this);
DocumentFragment::attach();
styleResolver->popParentShadowRoot(this);
}
示例2: resetCSSFeatureFlags
void DocumentStyleSheetCollection::resetCSSFeatureFlags()
{
StyleResolver* styleResolver = m_document->styleResolver();
m_usesSiblingRules = styleResolver->usesSiblingRules();
m_usesFirstLineRules = styleResolver->usesFirstLineRules();
m_usesBeforeAfterRules = styleResolver->usesBeforeAfterRules();
}
示例3: ASSERT
void RenderSVGInlineText::computeNewScaledFontForStyle(RenderObject* renderer, const RenderStyle* style, float& scalingFactor, Font& scaledFont)
{
ASSERT(style);
ASSERT(renderer);
Document* document = renderer->document();
ASSERT(document);
StyleResolver* styleResolver = document->styleResolver();
ASSERT(styleResolver);
// Alter font-size to the right on-screen value to avoid scaling the glyphs themselves, except when GeometricPrecision is specified
scalingFactor = SVGRenderingContext::calculateScreenFontSizeScalingFactor(renderer);
if (scalingFactor == 1 || !scalingFactor || style->fontDescription().textRenderingMode() == GeometricPrecision) {
scalingFactor = 1;
scaledFont = style->font();
return;
}
FontDescription fontDescription(style->fontDescription());
// FIXME: We need to better handle the case when we compute very small fonts below (below 1pt).
fontDescription.setComputedSize(StyleResolver::getComputedSizeFromSpecifiedSize(document, scalingFactor, fontDescription.isAbsoluteSize(), fontDescription.computedSize(), DoNotUseSmartMinimumForFontSize));
scaledFont = Font(fontDescription, 0, 0);
scaledFont.update(styleResolver->fontSelector());
}
示例4: resolveTree
void resolveTree(Document& document, Change change)
{
bool resolveRootStyle = change == Force || (document.shouldDisplaySeamlesslyWithParent() && change >= Inherit);
if (resolveRootStyle) {
RefPtr<RenderStyle> documentStyle = resolveForDocument(document);
#if PLATFORM(IOS)
// Inserting the pictograph font at the end of the font fallback list is done by the
// font selector, so set a font selector if needed.
if (Settings* settings = document.settings()) {
StyleResolver* styleResolver = document.styleResolverIfExists();
if (settings->fontFallbackPrefersPictographs() && styleResolver)
documentStyle->font().update(styleResolver->fontSelector());
}
#endif
Style::Change documentChange = determineChange(documentStyle.get(), document.renderer()->style(), document.settings());
if (documentChange != NoChange)
document.renderer()->setStyle(documentStyle.release());
}
Element* documentElement = document.documentElement();
if (!documentElement)
return;
if (change < Inherit && !documentElement->childNeedsStyleRecalc() && !documentElement->needsStyleRecalc())
return;
resolveTree(*documentElement, change);
}
示例5: youngestShadowRoot
void ShadowTree::recalcShadowTreeStyle(Node::StyleChange change)
{
ShadowRoot* youngest = youngestShadowRoot();
if (!youngest)
return;
if (needsReattachHostChildrenAndShadow())
reattachHostChildrenAndShadow();
else {
StyleResolver* styleResolver = youngest->document()->styleResolver();
styleResolver->pushParentShadowRoot(youngest);
for (Node* n = youngest->firstChild(); n; n = n->nextSibling()) {
if (n->isElementNode())
static_cast<Element*>(n)->recalcStyle(change);
else if (n->isTextNode())
toText(n)->recalcTextStyle(change);
}
styleResolver->popParentShadowRoot(youngest);
}
clearNeedsReattachHostChildrenAndShadow();
for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadowRoot()) {
root->clearNeedsStyleRecalc();
root->clearChildNeedsStyleRecalc();
}
}
示例6: combineCSSFeatureFlags
void DocumentStyleSheetCollection::combineCSSFeatureFlags()
{
// Delay resetting the flags until after next style recalc since unapplying the style may not work without these set (this is true at least with before/after).
StyleResolver* styleResolver = m_document->styleResolver();
m_usesSiblingRules = m_usesSiblingRules || styleResolver->usesSiblingRules();
m_usesFirstLineRules = m_usesFirstLineRules || styleResolver->usesFirstLineRules();
m_usesBeforeAfterRules = m_usesBeforeAfterRules || styleResolver->usesBeforeAfterRules();
}
示例7: document
void ShadowRoot::attach()
{
StyleResolver* styleResolver = document()->styleResolver();
styleResolver->pushParentShadowRoot(this);
attachChildrenIfNeeded();
attachAsNode();
styleResolver->popParentShadowRoot(this);
}
示例8: collectActiveStyleSheets
bool DocumentStyleSheetCollection::updateActiveStyleSheets(UpdateFlag updateFlag)
{
if (m_document->inStyleRecalc()) {
// SVG <use> element may manage to invalidate style selector in the middle of a style recalc.
// https://bugs.webkit.org/show_bug.cgi?id=54344
// FIXME: This should be fixed in SVG and the call site replaced by ASSERT(!m_inStyleRecalc).
m_needsUpdateActiveStylesheetsOnStyleRecalc = true;
m_document->scheduleForcedStyleRecalc();
return false;
}
if (!m_document->renderer() || !m_document->attached())
return false;
Vector<RefPtr<StyleSheet> > activeStyleSheets;
collectActiveStyleSheets(activeStyleSheets);
Vector<RefPtr<CSSStyleSheet> > activeCSSStyleSheets;
activeCSSStyleSheets.append(injectedAuthorStyleSheets());
activeCSSStyleSheets.append(documentAuthorStyleSheets());
collectActiveCSSStyleSheetsFromSeamlessParents(activeCSSStyleSheets, m_document);
filterEnabledCSSStyleSheets(activeCSSStyleSheets, activeStyleSheets);
StyleResolverUpdateType styleResolverUpdateType;
bool requiresFullStyleRecalc;
analyzeStyleSheetChange(updateFlag, activeCSSStyleSheets, styleResolverUpdateType, requiresFullStyleRecalc);
if (styleResolverUpdateType == Reconstruct)
m_document->clearStyleResolver();
else {
StyleResolver* styleResolver = m_document->styleResolver();
if (styleResolverUpdateType == Reset) {
styleResolver->ruleSets().resetAuthorStyle();
styleResolver->appendAuthorStyleSheets(0, activeCSSStyleSheets);
} else {
ASSERT(styleResolverUpdateType == Additive);
styleResolver->appendAuthorStyleSheets(m_activeAuthorStyleSheets.size(), activeCSSStyleSheets);
}
resetCSSFeatureFlags();
}
m_activeAuthorStyleSheets.swap(activeCSSStyleSheets);
m_styleSheetsForStyleSheetList.swap(activeStyleSheets);
m_usesRemUnits = styleSheetsUseRemUnits(m_activeAuthorStyleSheets);
m_needsUpdateActiveStylesheetsOnStyleRecalc = false;
m_document->notifySeamlessChildDocumentsOfStylesheetUpdate();
return requiresFullStyleRecalc;
}
示例9: adoptPtr
PassOwnPtr<MediaQueryEvaluator> MediaQueryMatcher::prepareEvaluator() const
{
if (!m_document || !m_document->frame())
return nullptr;
Element* documentElement = m_document->documentElement();
if (!documentElement)
return nullptr;
StyleResolver* styleResolver = m_document->ensureStyleResolver();
RefPtr<RenderStyle> rootStyle = styleResolver->styleForElement(documentElement, 0 /*defaultParent*/, DisallowStyleSharing, MatchOnlyUserAgentRules);
return adoptPtr(new MediaQueryEvaluator(mediaType(), m_document->frame(), rootStyle.get()));
}
示例10: ASSERT
void ShadowRoot::recalcStyle(StyleChange change)
{
// ShadowRoot doesn't support custom callbacks.
ASSERT(!hasCustomCallbacks());
StyleResolver* styleResolver = document()->styleResolver();
styleResolver->pushParentShadowRoot(this);
for (Node* child = firstChild(); child; child = child->nextSibling()) {
if (child->isElementNode())
static_cast<Element*>(child)->recalcStyle(change);
else if (child->isTextNode())
toText(child)->recalcTextStyle(change);
}
styleResolver->popParentShadowRoot(this);
clearNeedsStyleRecalc();
clearChildNeedsStyleRecalc();
}
示例11: setFontFromControlSize
void RenderThemeSafari::setFontFromControlSize(StyleResolver& styleResolver, RenderStyle& style, NSControlSize controlSize) const
{
FontDescription fontDescription;
fontDescription.setIsAbsoluteSize(true);
float fontSize = systemFontSizeForControlSize(controlSize);
fontDescription.setOneFamily("Lucida Grande");
fontDescription.setComputedSize(fontSize);
fontDescription.setSpecifiedSize(fontSize);
// Reset line height
style.setLineHeight(RenderStyle::initialLineHeight());
if (style.setFontDescription(fontDescription))
style.fontCascade().update(&styleResolver.document().fontSelector());
}
示例12: applyPropertyToCurrentStyle
static void applyPropertyToCurrentStyle(StyleResolver& styleResolver, CSSPropertyID id, const RefPtr<StyleProperties>& parsedStyle)
{
styleResolver.applyPropertyToCurrentStyle(id, parsedStyle->getPropertyCSSValue(id).get());
}