1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550
|
/*
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#ifndef StyleResolver_h
#define StyleResolver_h
#include "CSSRule.h"
#include "CSSToStyleMap.h"
#include "CSSValueList.h"
#include "LinkHash.h"
#include "MediaQueryExp.h"
#include "RenderStyle.h"
#include "RuleFeature.h"
#include "RuntimeEnabledFeatures.h"
#include "SelectorChecker.h"
#include "StyleInheritedData.h"
#include "StyleScopeResolver.h"
#include "ViewportStyleResolver.h"
#include <wtf/HashMap.h>
#include <wtf/HashSet.h>
#include <wtf/RefPtr.h>
#include <wtf/Vector.h>
#include <wtf/text/AtomicStringHash.h>
#include <wtf/text/StringHash.h>
namespace WebCore {
enum ESmartMinimumForFontSize { DoNotUseSmartMinimumForFontSize, UseSmartMinimumForFontFize };
class CSSFontSelector;
class CSSPageRule;
class CSSPrimitiveValue;
class CSSProperty;
class CSSRuleList;
class CSSFontFace;
class CSSFontFaceRule;
class CSSImageGeneratorValue;
class CSSImageSetValue;
class CSSImageValue;
class CSSSelector;
class CSSStyleRule;
class CSSStyleSheet;
class CSSValue;
class ContainerNode;
class CustomFilterOperation;
class CustomFilterParameter;
class CustomFilterParameterList;
class Document;
class Element;
class Frame;
class FrameView;
class KURL;
class KeyframeList;
class KeyframeValue;
class MediaQueryEvaluator;
class Node;
class RenderRegion;
class RuleData;
class RuleSet;
class Settings;
class StaticCSSRuleList;
class StyleBuilder;
class StyleScopeResolver;
class StyleImage;
class StyleKeyframe;
class StylePendingImage;
class StylePropertySet;
class StyleRule;
class StyleRuleHost;
class StyleRuleKeyframes;
class StyleRulePage;
class StyleRuleRegion;
class StyleShader;
class StyleSheet;
class StyleSheetContents;
class StyleSheetList;
class StyledElement;
class ViewportStyleResolver;
class WebKitCSSFilterValue;
class WebKitCSSShaderValue;
class WebKitCSSSVGDocumentValue;
class MediaQueryResult {
WTF_MAKE_NONCOPYABLE(MediaQueryResult); WTF_MAKE_FAST_ALLOCATED;
public:
MediaQueryResult(const MediaQueryExp& expr, bool result)
: m_expression(expr)
, m_result(result)
{
}
void reportMemoryUsage(MemoryObjectInfo*) const;
MediaQueryExp m_expression;
bool m_result;
};
enum StyleSharingBehavior {
AllowStyleSharing,
DisallowStyleSharing,
};
// MatchOnlyUserAgentRules is used in media queries, where relative units
// are interpreted according to the document root element style, and styled only
// from the User Agent Stylesheet rules.
enum RuleMatchingBehavior {
MatchAllRules,
MatchAllRulesExcludingSMIL,
MatchOnlyUserAgentRules,
};
// This class selects a RenderStyle for a given element based on a collection of stylesheets.
class StyleResolver {
WTF_MAKE_NONCOPYABLE(StyleResolver); WTF_MAKE_FAST_ALLOCATED;
public:
StyleResolver(Document*, bool matchAuthorAndUserStyles);
~StyleResolver();
// Using these during tree walk will allow style selector to optimize child and descendant selector lookups.
void pushParentElement(Element*);
void popParentElement(Element*);
void pushParentShadowRoot(const ShadowRoot*);
void popParentShadowRoot(const ShadowRoot*);
#if ENABLE(SHADOW_DOM)
void addHostRule(StyleRuleHost* rule, bool hasDocumentSecurityOrigin, const ContainerNode* scope) { ensureScopeResolver()->addHostRule(rule, hasDocumentSecurityOrigin, scope); }
#endif
PassRefPtr<RenderStyle> styleForElement(Element*, RenderStyle* parentStyle = 0, StyleSharingBehavior = AllowStyleSharing,
RuleMatchingBehavior = MatchAllRules, RenderRegion* regionForStyling = 0);
void keyframeStylesForAnimation(Element*, const RenderStyle*, KeyframeList&);
PassRefPtr<RenderStyle> pseudoStyleForElement(PseudoId, Element*, RenderStyle* parentStyle);
PassRefPtr<RenderStyle> styleForPage(int pageIndex);
static PassRefPtr<RenderStyle> styleForDocument(Document*, CSSFontSelector* = 0);
RenderStyle* style() const { return m_style.get(); }
RenderStyle* parentStyle() const { return m_parentStyle; }
RenderStyle* rootElementStyle() const { return m_rootElementStyle; }
Element* element() const { return m_element; }
Document* document() const { return m_checker.document(); }
const FontDescription& fontDescription() { return style()->fontDescription(); }
const FontDescription& parentFontDescription() { return parentStyle()->fontDescription(); }
void setFontDescription(const FontDescription& fontDescription) { m_fontDirty |= style()->setFontDescription(fontDescription); }
void setZoom(float f) { m_fontDirty |= style()->setZoom(f); }
void setEffectiveZoom(float f) { m_fontDirty |= style()->setEffectiveZoom(f); }
void setTextSizeAdjust(bool b) { m_fontDirty |= style()->setTextSizeAdjust(b); }
bool hasParentNode() const { return m_parentNode; }
void resetAuthorStyle();
void appendAuthorStyleSheets(unsigned firstNew, const Vector<RefPtr<CSSStyleSheet> >&);
private:
#if ENABLE(STYLE_SCOPED) || ENABLE(SHADOW_DOM)
StyleScopeResolver* ensureScopeResolver()
{
#if ENABLE(STYLE_SCOPED)
#if ENABLE(SHADOW_DOM)
ASSERT(RuntimeEnabledFeatures::shadowDOMEnabled() || RuntimeEnabledFeatures::styleScopedEnabled());
#else
ASSERT(RuntimeEnabledFeatures::styleScopedEnabled());
#endif
#else
ASSERT(RuntimeEnabledFeatures::shadowDOMEnabled());
#endif
if (!m_scopeResolver)
m_scopeResolver = adoptPtr(new StyleScopeResolver());
return m_scopeResolver.get();
}
#endif
void initForStyleResolve(Element*, RenderStyle* parentStyle = 0, PseudoId = NOPSEUDO);
void initElement(Element*);
void collectFeatures();
RenderStyle* locateSharedStyle();
bool styleSharingCandidateMatchesRuleSet(RuleSet*);
bool styleSharingCandidateMatchesHostRules();
Node* locateCousinList(Element* parent, unsigned& visitedNodeCount) const;
StyledElement* findSiblingForStyleSharing(Node*, unsigned& count) const;
bool canShareStyleWithElement(StyledElement*) const;
PassRefPtr<RenderStyle> styleForKeyframe(const RenderStyle*, const StyleKeyframe*, KeyframeValue&);
public:
// These methods will give back the set of rules that matched for a given element (or a pseudo-element).
enum CSSRuleFilter {
UAAndUserCSSRules = 1 << 1,
AuthorCSSRules = 1 << 2,
EmptyCSSRules = 1 << 3,
CrossOriginCSSRules = 1 << 4,
AllButEmptyCSSRules = UAAndUserCSSRules | AuthorCSSRules | CrossOriginCSSRules,
AllCSSRules = AllButEmptyCSSRules | EmptyCSSRules,
};
PassRefPtr<CSSRuleList> styleRulesForElement(Element*, unsigned rulesToInclude = AllButEmptyCSSRules);
PassRefPtr<CSSRuleList> pseudoStyleRulesForElement(Element*, PseudoId, unsigned rulesToInclude = AllButEmptyCSSRules);
// Given a CSS keyword in the range (xx-small to -webkit-xxx-large), this function will return
// the correct font size scaled relative to the user's default (medium).
static float fontSizeForKeyword(Document*, int keyword, bool shouldUseFixedDefaultSize);
// Given a font size in pixel, this function will return legacy font size between 1 and 7.
static int legacyFontSize(Document*, int pixelFontSize, bool shouldUseFixedDefaultSize);
public:
void applyPropertyToStyle(CSSPropertyID, CSSValue*, RenderStyle*);
void applyPropertyToCurrentStyle(CSSPropertyID, CSSValue*);
void updateFont();
void initializeFontStyle(Settings*);
static float getComputedSizeFromSpecifiedSize(Document*, float zoomFactor, bool isAbsoluteSize, float specifiedSize, ESmartMinimumForFontSize = UseSmartMinimumForFontFize);
void setFontSize(FontDescription&, float size);
private:
static float getComputedSizeFromSpecifiedSize(Document*, RenderStyle*, bool isAbsoluteSize, float specifiedSize, bool useSVGZoomRules);
public:
bool useSVGZoomRules();
static bool colorFromPrimitiveValueIsDerivedFromElement(CSSPrimitiveValue*);
Color colorFromPrimitiveValue(CSSPrimitiveValue*, bool forVisitedLink = false) const;
bool hasSelectorForId(const AtomicString&) const;
bool hasSelectorForClass(const AtomicString&) const;
bool hasSelectorForAttribute(const AtomicString&) const;
CSSFontSelector* fontSelector() const { return m_fontSelector.get(); }
#if ENABLE(CSS_DEVICE_ADAPTATION)
ViewportStyleResolver* viewportStyleResolver() { return m_viewportStyleResolver.get(); }
#endif
void addViewportDependentMediaQueryResult(const MediaQueryExp*, bool result);
bool hasViewportDependentMediaQueries() const { return !m_viewportDependentMediaQueryResults.isEmpty(); }
bool affectedByViewportChange() const;
void allVisitedStateChanged() { m_checker.allVisitedStateChanged(); }
void visitedStateChanged(LinkHash visitedHash) { m_checker.visitedStateChanged(visitedHash); }
void addKeyframeStyle(PassRefPtr<StyleRuleKeyframes>);
bool checkRegionStyle(Element* regionElement);
bool usesSiblingRules() const { return !m_features.siblingRules.isEmpty(); }
bool usesFirstLineRules() const { return m_features.usesFirstLineRules; }
bool usesBeforeAfterRules() const { return m_features.usesBeforeAfterRules; }
static bool createTransformOperations(CSSValue* inValue, RenderStyle* inStyle, RenderStyle* rootStyle, TransformOperations& outOperations);
void invalidateMatchedPropertiesCache();
// WARNING. This will construct CSSOM wrappers for all style rules and cache then in a map for significant memory cost.
// It is here to support inspector. Don't use for any regular engine functions.
CSSStyleRule* ensureFullCSSOMWrapperForInspector(StyleRule*);
#if ENABLE(CSS_FILTERS)
bool createFilterOperations(CSSValue* inValue, RenderStyle* inStyle, RenderStyle* rootStyle, FilterOperations& outOperations);
#if ENABLE(CSS_SHADERS)
StyleShader* styleShader(CSSValue*);
StyleShader* cachedOrPendingStyleShaderFromValue(WebKitCSSShaderValue*);
bool parseCustomFilterParameterList(CSSValue*, CustomFilterParameterList&);
PassRefPtr<CustomFilterParameter> parseCustomFilterParameter(const String& name, CSSValue*);
PassRefPtr<CustomFilterParameter> parseCustomFilterArrayParameter(const String& name, CSSValueList*);
PassRefPtr<CustomFilterParameter> parseCustomFilterNumberParameter(const String& name, CSSValueList*);
PassRefPtr<CustomFilterParameter> parseCustomFilterTransformParameter(const String& name, CSSValueList*);
PassRefPtr<CustomFilterOperation> createCustomFilterOperation(WebKitCSSFilterValue*);
void loadPendingShaders();
#endif
#if ENABLE(SVG)
void loadPendingSVGDocuments();
#endif
#endif // ENABLE(CSS_FILTERS)
void loadPendingResources();
private:
// This function fixes up the default font size if it detects that the current generic font family has changed. -dwh
void checkForGenericFamilyChange(RenderStyle*, RenderStyle* parentStyle);
void checkForZoomChange(RenderStyle*, RenderStyle* parentStyle);
void checkForTextSizeAdjust();
void adjustRenderStyle(RenderStyle* styleToAdjust, RenderStyle* parentStyle, Element*);
void addMatchedRule(const RuleData* rule) { m_matchedRules.append(rule); }
struct MatchRanges {
MatchRanges() : firstUARule(-1), lastUARule(-1), firstAuthorRule(-1), lastAuthorRule(-1), firstUserRule(-1), lastUserRule(-1) { }
int firstUARule;
int lastUARule;
int firstAuthorRule;
int lastAuthorRule;
int firstUserRule;
int lastUserRule;
};
struct MatchedProperties {
MatchedProperties() : possiblyPaddedMember(0) { }
void reportMemoryUsage(MemoryObjectInfo*) const;
RefPtr<StylePropertySet> properties;
union {
struct {
unsigned linkMatchType : 2;
unsigned isInRegionRule : 1;
};
// Used to make sure all memory is zero-initialized since we compute the hash over the bytes of this object.
void* possiblyPaddedMember;
};
};
struct MatchResult {
MatchResult() : isCacheable(true) { }
Vector<MatchedProperties, 64> matchedProperties;
Vector<StyleRule*, 64> matchedRules;
MatchRanges ranges;
bool isCacheable;
};
struct MatchOptions {
MatchOptions(bool includeEmptyRules, const ContainerNode* scope = 0) : scope(scope), includeEmptyRules(includeEmptyRules) { }
const ContainerNode* scope;
bool includeEmptyRules;
};
static void addMatchedProperties(MatchResult&, const StylePropertySet* properties, StyleRule* = 0, unsigned linkMatchType = SelectorChecker::MatchAll, bool inRegionRule = false);
void addElementStyleProperties(MatchResult&, const StylePropertySet*, bool isCacheable = true);
void matchAllRules(MatchResult&, bool includeSMILProperties);
void matchUARules(MatchResult&);
void matchUARules(MatchResult&, RuleSet*);
void matchAuthorRules(MatchResult&, bool includeEmptyRules);
void matchUserRules(MatchResult&, bool includeEmptyRules);
void matchScopedAuthorRules(MatchResult&, bool includeEmptyRules);
void matchHostRules(MatchResult&, bool includeEmptyRules);
void collectMatchingRules(RuleSet*, int& firstRuleIndex, int& lastRuleIndex, const MatchOptions&);
void collectMatchingRulesForRegion(RuleSet*, int& firstRuleIndex, int& lastRuleIndex, const MatchOptions&);
void collectMatchingRulesForList(const Vector<RuleData>*, int& firstRuleIndex, int& lastRuleIndex, const MatchOptions&);
bool fastRejectSelector(const RuleData&) const;
void sortMatchedRules();
void sortAndTransferMatchedRules(MatchResult&);
bool checkSelector(const RuleData&, const ContainerNode* scope);
bool checkRegionSelector(CSSSelector* regionSelector, Element* regionElement);
void applyMatchedProperties(const MatchResult&, const Element*);
enum StyleApplicationPass {
#if ENABLE(CSS_VARIABLES)
VariableDefinitions,
#endif
HighPriorityProperties,
LowPriorityProperties
};
template <StyleApplicationPass pass>
void applyMatchedProperties(const MatchResult&, bool important, int startIndex, int endIndex, bool inheritedOnly);
template <StyleApplicationPass pass>
void applyProperties(const StylePropertySet* properties, StyleRule*, bool isImportant, bool inheritedOnly, bool filterRegionProperties);
#if ENABLE(CSS_VARIABLES)
void resolveVariables(CSSPropertyID, CSSValue*, Vector<std::pair<CSSPropertyID, String> >& knownExpressions);
#endif
static bool isValidRegionStyleProperty(CSSPropertyID);
void matchPageRules(MatchResult&, RuleSet*, bool isLeftPage, bool isFirstPage, const String& pageName);
void matchPageRulesForList(Vector<StyleRulePage*>& matchedRules, const Vector<StyleRulePage*>&, bool isLeftPage, bool isFirstPage, const String& pageName);
Settings* documentSettings() { return m_checker.document()->settings(); }
bool isLeftPage(int pageIndex) const;
bool isRightPage(int pageIndex) const { return !isLeftPage(pageIndex); }
bool isFirstPage(int pageIndex) const;
String pageName(int pageIndex) const;
OwnPtr<RuleSet> m_authorStyle;
OwnPtr<RuleSet> m_userStyle;
RuleFeatureSet m_features;
OwnPtr<RuleSet> m_siblingRuleSet;
OwnPtr<RuleSet> m_uncommonAttributeRuleSet;
bool m_hasUAAppearance;
BorderData m_borderData;
FillLayer m_backgroundData;
Color m_backgroundColor;
typedef HashMap<AtomicStringImpl*, RefPtr<StyleRuleKeyframes> > KeyframesRuleMap;
KeyframesRuleMap m_keyframesRuleMap;
public:
static RenderStyle* styleNotYetAvailable() { return s_styleNotYetAvailable; }
PassRefPtr<StyleImage> styleImage(CSSPropertyID, CSSValue*);
PassRefPtr<StyleImage> cachedOrPendingFromValue(CSSPropertyID, CSSImageValue*);
PassRefPtr<StyleImage> generatedOrPendingFromValue(CSSPropertyID, CSSImageGeneratorValue*);
#if ENABLE(CSS_IMAGE_SET)
PassRefPtr<StyleImage> setOrPendingFromValue(CSSPropertyID, CSSImageSetValue*);
#endif
bool applyPropertyToRegularStyle() const { return m_applyPropertyToRegularStyle; }
bool applyPropertyToVisitedLinkStyle() const { return m_applyPropertyToVisitedLinkStyle; }
static Length convertToIntLength(CSSPrimitiveValue*, RenderStyle*, RenderStyle* rootStyle, double multiplier = 1);
static Length convertToFloatLength(CSSPrimitiveValue*, RenderStyle*, RenderStyle* rootStyle, double multiplier = 1);
CSSToStyleMap* styleMap() { return &m_styleMap; }
void reportMemoryUsage(MemoryObjectInfo*) const;
private:
static RenderStyle* s_styleNotYetAvailable;
void collectRulesFromUserStyleSheets(const Vector<RefPtr<CSSStyleSheet> >&);
void cacheBorderAndBackground();
private:
bool canShareStyleWithControl(StyledElement*) const;
void applyProperty(CSSPropertyID, CSSValue*);
#if ENABLE(SVG)
void applySVGProperty(CSSPropertyID, CSSValue*);
#endif
PassRefPtr<StyleImage> loadPendingImage(StylePendingImage*);
void loadPendingImages();
static unsigned computeMatchedPropertiesHash(const MatchedProperties*, unsigned size);
struct MatchedPropertiesCacheItem {
void reportMemoryUsage(MemoryObjectInfo*) const;
Vector<MatchedProperties> matchedProperties;
MatchRanges ranges;
RefPtr<RenderStyle> renderStyle;
RefPtr<RenderStyle> parentRenderStyle;
};
const MatchedPropertiesCacheItem* findFromMatchedPropertiesCache(unsigned hash, const MatchResult&);
void addToMatchedPropertiesCache(const RenderStyle*, const RenderStyle* parentStyle, unsigned hash, const MatchResult&);
// Every N additions to the matched declaration cache trigger a sweep where entries holding
// the last reference to a style declaration are garbage collected.
void sweepMatchedPropertiesCache(Timer<StyleResolver>*);
unsigned m_matchedPropertiesCacheAdditionsSinceLastSweep;
typedef HashMap<unsigned, MatchedPropertiesCacheItem> MatchedPropertiesCache;
MatchedPropertiesCache m_matchedPropertiesCache;
Timer<StyleResolver> m_matchedPropertiesCacheSweepTimer;
// A buffer used to hold the set of matched rules for an element, and a temporary buffer used for
// merge sorting.
Vector<const RuleData*, 32> m_matchedRules;
RefPtr<StaticCSSRuleList> m_ruleList;
typedef HashMap<CSSPropertyID, RefPtr<CSSValue> > PendingImagePropertyMap;
PendingImagePropertyMap m_pendingImageProperties;
OwnPtr<MediaQueryEvaluator> m_medium;
RefPtr<RenderStyle> m_rootDefaultStyle;
PseudoId m_dynamicPseudo;
PseudoId m_pseudoStyle;
SelectorChecker m_checker;
RefPtr<RenderStyle> m_style;
RenderStyle* m_parentStyle;
RenderStyle* m_rootElementStyle;
Element* m_element;
StyledElement* m_styledElement;
RenderRegion* m_regionForStyling;
EInsideLink m_elementLinkState;
ContainerNode* m_parentNode;
CSSValue* m_lineHeightValue;
bool m_fontDirty;
bool m_matchAuthorAndUserStyles;
bool m_sameOriginOnly;
bool m_distributedToInsertionPoint;
RefPtr<CSSFontSelector> m_fontSelector;
Vector<OwnPtr<MediaQueryResult> > m_viewportDependentMediaQueryResults;
#if ENABLE(CSS_DEVICE_ADAPTATION)
RefPtr<ViewportStyleResolver> m_viewportStyleResolver;
#endif
bool m_applyPropertyToRegularStyle;
bool m_applyPropertyToVisitedLinkStyle;
const StyleBuilder& m_styleBuilder;
HashMap<StyleRule*, RefPtr<CSSStyleRule> > m_styleRuleToCSSOMWrapperMap;
HashSet<RefPtr<CSSStyleSheet> > m_styleSheetCSSOMWrapperSet;
#if ENABLE(CSS_SHADERS)
bool m_hasPendingShaders;
#endif
#if ENABLE(CSS_FILTERS) && ENABLE(SVG)
HashMap<FilterOperation*, RefPtr<WebKitCSSSVGDocumentValue> > m_pendingSVGDocuments;
#endif
OwnPtr<StyleScopeResolver> m_scopeResolver;
CSSToStyleMap m_styleMap;
friend class StyleBuilder;
friend bool operator==(const MatchedProperties&, const MatchedProperties&);
friend bool operator!=(const MatchedProperties&, const MatchedProperties&);
friend bool operator==(const MatchRanges&, const MatchRanges&);
friend bool operator!=(const MatchRanges&, const MatchRanges&);
};
inline bool StyleResolver::hasSelectorForAttribute(const AtomicString &attributeName) const
{
ASSERT(!attributeName.isEmpty());
return m_features.attrsInRules.contains(attributeName.impl());
}
inline bool StyleResolver::hasSelectorForClass(const AtomicString& classValue) const
{
ASSERT(!classValue.isEmpty());
return m_features.classesInRules.contains(classValue.impl());
}
inline bool StyleResolver::hasSelectorForId(const AtomicString& idValue) const
{
ASSERT(!idValue.isEmpty());
return m_features.idsInRules.contains(idValue.impl());
}
} // namespace WebCore
#endif // StyleResolver_h
|