Changeset 142757 in webkit
- Timestamp:
- Feb 13, 2013 9:26:41 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r142754 r142757 1 2013-02-13 Takashi Sakamoto <tasak@google.com> 2 3 [Refactoring] StyleResolver::State should have methods to access its me 4 https://bugs.webkit.org/show_bug.cgi?id=108563 5 6 Reviewed by Antti Koivisto. 7 8 * inspector/styles/region-style-crash-expected.txt: 9 Rebaseline. Since inspector hasn't supported CSS region styles yet, 10 region-style-crash.html has no CSS region styles as its result. 11 1 12 2013-02-13 Rashmi Shyamasundar <rashmi.s2@samsung.com> 2 13 -
trunk/LayoutTests/inspector/styles/region-style-crash-expected.txt
r131188 r142757 14 14 ======== Matched CSS Rules ======== 15 15 [expanded] 16 #p1 { (region-style-crash.html:8)17 18 [expanded]19 16 #p1 { (region-style-crash.html:6) 20 17 color: #ff0000; … … 29 26 30 27 31 ======== Pseudo ::first-line element ========32 [expanded]33 #p1 { (region-style-crash.html:8)34 28 35 36 ======== Pseudo ::first-letter element ========37 [expanded]38 #p1 { (region-style-crash.html:8)39 40 41 ======== Pseudo ::before element ========42 [expanded]43 #p1 { (region-style-crash.html:8)44 45 46 ======== Pseudo ::after element ========47 [expanded]48 #p1 { (region-style-crash.html:8)49 50 51 ======== Pseudo ::selection element ========52 [expanded]53 #p1 { (region-style-crash.html:8)54 55 56 ======== Pseudo element ========57 [expanded]58 #p1 { (region-style-crash.html:8)59 60 61 ======== Pseudo ::-webkit-scrollbar element ========62 [expanded]63 #p1 { (region-style-crash.html:8)64 65 66 ======== Pseudo ::-webkit-file-upload-button element ========67 [expanded]68 #p1 { (region-style-crash.html:8)69 70 71 ======== Pseudo ::-webkit-input-placeholder element ========72 [expanded]73 #p1 { (region-style-crash.html:8)74 75 76 ======== Pseudo ::-webkit-slider-thumb element ========77 [expanded]78 #p1 { (region-style-crash.html:8)79 80 81 ======== Pseudo ::-webkit-search-cancel-button element ========82 [expanded]83 #p1 { (region-style-crash.html:8)84 85 86 ======== Pseudo ::-webkit-search-decoration element ========87 [expanded]88 #p1 { (region-style-crash.html:8)89 90 91 ======== Pseudo ::-webkit-search-results-decoration element ========92 [expanded]93 #p1 { (region-style-crash.html:8)94 95 96 ======== Pseudo ::-webkit-search-results-button element ========97 [expanded]98 #p1 { (region-style-crash.html:8)99 100 101 -
trunk/Source/WebCore/ChangeLog
r142755 r142757 1 2013-02-13 Takashi Sakamoto <tasak@google.com> 2 3 [Refactoring] StyleResolver::State should have methods to access its member variables. 4 https://bugs.webkit.org/show_bug.cgi?id=108563 5 6 Reviewed by Antti Koivisto. 7 8 Made all member variables private and added methods to access the 9 variables, because most of the member variables are read-only. 10 We don't need to update those read-only variables while resolving 11 styles. 12 13 No new tests, because just refactoring. 14 15 * css/SVGCSSStyleSelector.cpp: 16 (WebCore::StyleResolver::applySVGProperty): 17 * css/StyleResolver.cpp: 18 (WebCore): 19 (WebCore::StyleResolver::collectMatchingRules): 20 (WebCore::StyleResolver::collectMatchingRulesForRegion): 21 (WebCore::StyleResolver::sortAndTransferMatchedRules): 22 (WebCore::StyleResolver::matchScopedAuthorRules): 23 (WebCore::StyleResolver::styleSharingCandidateMatchesHostRules): 24 (WebCore::StyleResolver::matchHostRules): 25 (WebCore::StyleResolver::matchAuthorRules): 26 (WebCore::StyleResolver::matchUserRules): 27 (WebCore::StyleResolver::matchUARules): 28 (WebCore::StyleResolver::collectMatchingRulesForList): 29 (WebCore::StyleResolver::sortMatchedRules): 30 (WebCore::StyleResolver::matchAllRules): 31 (WebCore::StyleResolver::State::initElement): 32 (WebCore::StyleResolver::initElement): 33 Modified to invoke m_state.initElement if a given element is 34 different from current m_state's element. 35 (WebCore::StyleResolver::State::initForStyleResolve): 36 Moved from StyleResolver. 37 (WebCore::StyleResolver::styleSharingCandidateMatchesRuleSet): 38 (WebCore::StyleResolver::canShareStyleWithControl): 39 (WebCore::StyleResolver::sharingCandidateHasIdenticalStyleAffectingAttributes): 40 (WebCore::StyleResolver::canShareStyleWithElement): 41 (WebCore::StyleResolver::locateSharedStyle): 42 (WebCore::StyleResolver::styleForElement): 43 (WebCore::StyleResolver::styleForKeyframe): 44 (WebCore::StyleResolver::keyframeStylesForAnimation): 45 (WebCore::StyleResolver::pseudoStyleForElement): 46 Changed ASSERT in the first line. ASSERT(m_state.parentStyle) would be 47 wrong, because it depends on previous resolving. However, 48 initForStyleResolve will also update m_state.parentStyle. No code in 49 pseudoStyleForElement depends on previous resolving state. 50 (WebCore::StyleResolver::styleForPage): 51 (WebCore::StyleResolver::defaultStyleForElement): 52 (WebCore::StyleResolver::adjustRenderStyle): 53 (WebCore::StyleResolver::updateFont): 54 (WebCore::StyleResolver::pseudoStyleRulesForElement): 55 (WebCore::StyleResolver::ruleMatches): 56 Added one more parameter, dynamicPseudo, because dynamicPseudo in 57 State class is just used for returning matched pseudo style from 58 this ruleMatches to collectMatchingRulesForList. No need to keep 59 dynamicPseudo while resolving styles. 60 (WebCore::StyleResolver::checkRegionSelector): 61 Removed m_pseudoStyle = NOPSEUDO, because this method uses just 62 SelectorChecker::matched. SelectorChecker doesn't see StyleResolver's 63 m_pseudoStyle directly. Need to use SelectorCheckerContext. So no 64 need to set m_pseudoStyle to be NOPSEUDO. 65 (WebCore::StyleResolver::applyProperties): 66 (WebCore::StyleResolver::applyMatchedProperties): 67 (WebCore::StyleResolver::isLeftPage): 68 (WebCore::StyleResolver::applyPropertyToStyle): 69 (WebCore::StyleResolver::useSVGZoomRules): 70 (WebCore::createGridTrackBreadth): 71 (WebCore::StyleResolver::resolveVariables): 72 (WebCore::StyleResolver::applyProperty): 73 (WebCore::StyleResolver::cachedOrPendingFromValue): 74 (WebCore::StyleResolver::generatedOrPendingFromValue): 75 (WebCore::StyleResolver::setOrPendingFromValue): 76 (WebCore::StyleResolver::cursorOrPendingFromValue): 77 (WebCore::StyleResolver::checkForTextSizeAdjust): 78 (WebCore::StyleResolver::initializeFontStyle): 79 (WebCore::StyleResolver::setFontSize): 80 (WebCore::StyleResolver::colorFromPrimitiveValue): 81 (WebCore::StyleResolver::loadPendingSVGDocuments): 82 (WebCore::StyleResolver::cachedOrPendingStyleShaderFromValue): 83 (WebCore::StyleResolver::loadPendingShaders): 84 (WebCore::StyleResolver::parseCustomFilterTransformParameter): 85 (WebCore::StyleResolver::createFilterOperations): 86 (WebCore::StyleResolver::loadPendingImage): 87 (WebCore::StyleResolver::loadPendingImages): 88 * css/StyleResolver.h: 89 (WebCore::StyleResolver::style): 90 (WebCore::StyleResolver::parentStyle): 91 (WebCore::StyleResolver::rootElementStyle): 92 (WebCore::StyleResolver::element): 93 (WebCore::StyleResolver::hasParentNode): 94 (StyleResolver): 95 (WebCore::StyleResolver::State::State): 96 (State): 97 (WebCore::StyleResolver::State::clear): 98 Modified to use clear at the end of styleForElement. 99 (WebCore::StyleResolver::State::document): 100 (WebCore::StyleResolver::State::element): 101 (WebCore::StyleResolver::State::styledElement): 102 (WebCore::StyleResolver::State::setStyle): 103 (WebCore::StyleResolver::State::style): 104 (WebCore::StyleResolver::State::takeStyle): 105 (WebCore::StyleResolver::State::ensureRuleList): 106 (WebCore::StyleResolver::State::takeRuleList): 107 (WebCore::StyleResolver::State::parentNode): 108 (WebCore::StyleResolver::State::setParentStyle): 109 (WebCore::StyleResolver::State::parentStyle): 110 (WebCore::StyleResolver::State::rootElementStyle): 111 (WebCore::StyleResolver::State::regionForStyling): 112 (WebCore::StyleResolver::State::setSameOriginOnly): 113 (WebCore::StyleResolver::State::isSameOriginOnly): 114 (WebCore::StyleResolver::State::pseudoStyle): 115 (WebCore::StyleResolver::State::elementLinkState): 116 (WebCore::StyleResolver::State::distributedToInsertionPoint): 117 (WebCore::StyleResolver::State::setElementAffectedByClassRules): 118 (WebCore::StyleResolver::State::elementAffectedByClassRules): 119 (WebCore::StyleResolver::State::setApplyPropertyToRegularStyle): 120 (WebCore::StyleResolver::State::setApplyPropertyToVisitedLinkStyle): 121 (WebCore::StyleResolver::State::applyPropertyToRegularStyle): 122 (WebCore::StyleResolver::State::applyPropertyToVisitedLinkStyle): 123 (WebCore::StyleResolver::State::pendingImageProperties): 124 (WebCore::StyleResolver::State::pendingSVGDocuments): 125 (WebCore::StyleResolver::State::setHasPendingShaders): 126 (WebCore::StyleResolver::State::hasPendingShaders): 127 (WebCore::StyleResolver::State::setLineHeightValue): 128 (WebCore::StyleResolver::State::lineHeightValue): 129 (WebCore::StyleResolver::State::setFontDirty): 130 (WebCore::StyleResolver::State::fontDirty): 131 (WebCore::StyleResolver::State::cacheBorderAndBackground): 132 (WebCore::StyleResolver::State::hasUAAppearance): 133 (WebCore::StyleResolver::State::borderData): 134 (WebCore::StyleResolver::State::backgroundData): 135 (WebCore::StyleResolver::State::backgroundColor): 136 (WebCore::StyleResolver::State::fontDescription): 137 (WebCore::StyleResolver::State::parentFontDescription): 138 (WebCore::StyleResolver::State::setFontDescription): 139 (WebCore::StyleResolver::State::setZoom): 140 (WebCore::StyleResolver::State::setEffectiveZoom): 141 (WebCore::StyleResolver::State::setTextSizeAdjust): 142 (WebCore::StyleResolver::State::setWritingMode): 143 (WebCore::StyleResolver::State::setTextOrientation): 144 fontDescription, ... and setTextOrientation were moved from 145 StyleResolver. 146 (WebCore::StyleResolver::State::matchedRules): 147 (WebCore::StyleResolver::State::addMatchedRule): 148 Moved from StyleResolver. 149 (WebCore::StyleResolver::applyPropertyToRegularStyle): 150 (WebCore::StyleResolver::applyPropertyToVisitedLinkStyle): 151 (WebCore::StyleResolver::fontDescription): 152 (WebCore::StyleResolver::parentFontDescription): 153 (WebCore::StyleResolver::setFontDescription): 154 (WebCore::StyleResolver::setZoom): 155 (WebCore::StyleResolver::setEffectiveZoom): 156 (WebCore::StyleResolver::setTextSizeAdjust): 157 (WebCore::StyleResolver::setWritingMode): 158 (WebCore::StyleResolver::setTextOrientation): 159 These fontDescription, ..., setTextOrientation are wrappers to 160 invoke State's methods. StyleBuilder still depends on StyleResolver 161 and invokes these methods. So we need these wrappers. 162 1 163 2013-02-13 Allan Sandfeld Jensen <allan.jensen@digia.com> 2 164 -
trunk/Source/WebCore/css/SVGCSSStyleSelector.cpp
r141742 r142757 50 50 if (isInherit) \ 51 51 { \ 52 svgstyle->set##Prop(state.parentStyle ->svgStyle()->prop()); \52 svgstyle->set##Prop(state.parentStyle()->svgStyle()->prop()); \ 53 53 return; \ 54 54 } … … 111 111 112 112 const State& state = m_state; 113 SVGRenderStyle* svgstyle = state.style ->accessSVGStyle();114 115 bool isInherit = state.parentNode && value->isInheritedValue();116 bool isInitial = value->isInitialValue() || (!state.parentNode && value->isInheritedValue());113 SVGRenderStyle* svgstyle = state.style()->accessSVGStyle(); 114 115 bool isInherit = state.parentNode() && value->isInheritedValue(); 116 bool isInitial = value->isInitialValue() || (!state.parentNode() && value->isInheritedValue()); 117 117 118 118 // What follows is a list that maps the CSS properties into their … … 231 231 { 232 232 if (isInherit) { 233 const SVGRenderStyle* svgParentStyle = state.parentStyle ->svgStyle();233 const SVGRenderStyle* svgParentStyle = state.parentStyle()->svgStyle(); 234 234 svgstyle->setFillPaint(svgParentStyle->fillPaintType(), svgParentStyle->fillPaintColor(), svgParentStyle->fillPaintUri(), applyPropertyToRegularStyle(), applyPropertyToVisitedLinkStyle()); 235 235 return; … … 241 241 if (value->isSVGPaint()) { 242 242 SVGPaint* svgPaint = static_cast<SVGPaint*>(value); 243 svgstyle->setFillPaint(svgPaint->paintType(), colorFromSVGColorCSSValue(svgPaint, state.style ->color()), svgPaint->uri(), applyPropertyToRegularStyle(), applyPropertyToVisitedLinkStyle());243 svgstyle->setFillPaint(svgPaint->paintType(), colorFromSVGColorCSSValue(svgPaint, state.style()->color()), svgPaint->uri(), applyPropertyToRegularStyle(), applyPropertyToVisitedLinkStyle()); 244 244 } 245 245 break; … … 248 248 { 249 249 if (isInherit) { 250 const SVGRenderStyle* svgParentStyle = state.parentStyle ->svgStyle();250 const SVGRenderStyle* svgParentStyle = state.parentStyle()->svgStyle(); 251 251 svgstyle->setStrokePaint(svgParentStyle->strokePaintType(), svgParentStyle->strokePaintColor(), svgParentStyle->strokePaintUri(), applyPropertyToRegularStyle(), applyPropertyToVisitedLinkStyle()); 252 252 return; … … 258 258 if (value->isSVGPaint()) { 259 259 SVGPaint* svgPaint = static_cast<SVGPaint*>(value); 260 svgstyle->setStrokePaint(svgPaint->paintType(), colorFromSVGColorCSSValue(svgPaint, state.style ->color()), svgPaint->uri(), applyPropertyToRegularStyle(), applyPropertyToVisitedLinkStyle());260 svgstyle->setStrokePaint(svgPaint->paintType(), colorFromSVGColorCSSValue(svgPaint, state.style()->color()), svgPaint->uri(), applyPropertyToRegularStyle(), applyPropertyToVisitedLinkStyle()); 261 261 } 262 262 break; … … 365 365 s = primitiveValue->getStringValue(); 366 366 367 svgstyle->setMarkerStartResource(SVGURIReference::fragmentIdentifierFromIRIString(s, state. element->document()));367 svgstyle->setMarkerStartResource(SVGURIReference::fragmentIdentifierFromIRIString(s, state.document())); 368 368 break; 369 369 } … … 379 379 s = primitiveValue->getStringValue(); 380 380 381 svgstyle->setMarkerMidResource(SVGURIReference::fragmentIdentifierFromIRIString(s, state. element->document()));381 svgstyle->setMarkerMidResource(SVGURIReference::fragmentIdentifierFromIRIString(s, state.document())); 382 382 break; 383 383 } … … 393 393 s = primitiveValue->getStringValue(); 394 394 395 svgstyle->setMarkerEndResource(SVGURIReference::fragmentIdentifierFromIRIString(s, state. element->document()));395 svgstyle->setMarkerEndResource(SVGURIReference::fragmentIdentifierFromIRIString(s, state.document())); 396 396 break; 397 397 } … … 430 430 s = primitiveValue->getStringValue(); 431 431 432 svgstyle->setFilterResource(SVGURIReference::fragmentIdentifierFromIRIString(s, state. element->document()));432 svgstyle->setFilterResource(SVGURIReference::fragmentIdentifierFromIRIString(s, state.document())); 433 433 break; 434 434 } … … 444 444 s = primitiveValue->getStringValue(); 445 445 446 svgstyle->setMaskerResource(SVGURIReference::fragmentIdentifierFromIRIString(s, state. element->document()));446 svgstyle->setMaskerResource(SVGURIReference::fragmentIdentifierFromIRIString(s, state.document())); 447 447 break; 448 448 } … … 458 458 s = primitiveValue->getStringValue(); 459 459 460 svgstyle->setClipperResource(SVGURIReference::fragmentIdentifierFromIRIString(s, state. element->document()));460 svgstyle->setClipperResource(SVGURIReference::fragmentIdentifierFromIRIString(s, state.document())); 461 461 break; 462 462 } … … 479 479 HANDLE_INHERIT_AND_INITIAL(stopColor, StopColor); 480 480 if (value->isSVGColor()) 481 svgstyle->setStopColor(colorFromSVGColorCSSValue(static_cast<SVGColor*>(value), state.style ->color()));481 svgstyle->setStopColor(colorFromSVGColorCSSValue(static_cast<SVGColor*>(value), state.style()->color())); 482 482 break; 483 483 } … … 486 486 HANDLE_INHERIT_AND_INITIAL(lightingColor, LightingColor); 487 487 if (value->isSVGColor()) 488 svgstyle->setLightingColor(colorFromSVGColorCSSValue(static_cast<SVGColor*>(value), state.style ->color()));488 svgstyle->setLightingColor(colorFromSVGColorCSSValue(static_cast<SVGColor*>(value), state.style()->color())); 489 489 break; 490 490 } … … 511 511 HANDLE_INHERIT_AND_INITIAL(floodColor, FloodColor); 512 512 if (value->isSVGColor()) 513 svgstyle->setFloodColor(colorFromSVGColorCSSValue(static_cast<SVGColor*>(value), state.style ->color()));513 svgstyle->setFloodColor(colorFromSVGColorCSSValue(static_cast<SVGColor*>(value), state.style()->color())); 514 514 break; 515 515 } … … 551 551 case CSSPropertyWebkitSvgShadow: { 552 552 if (isInherit) 553 return svgstyle->setShadow(adoptPtr(state.parentStyle ->svgStyle()->shadow() ? new ShadowData(*state.parentStyle->svgStyle()->shadow()) : 0));553 return svgstyle->setShadow(adoptPtr(state.parentStyle()->svgStyle()->shadow() ? new ShadowData(*state.parentStyle()->svgStyle()->shadow()) : 0)); 554 554 if (isInitial || primitiveValue) // initial | none 555 555 return svgstyle->setShadow(nullptr); … … 566 566 return; 567 567 ShadowValue* item = static_cast<ShadowValue*>(firstValue); 568 IntPoint location(item->x->computeLength<int>(state.style .get(), state.rootElementStyle),569 item->y->computeLength<int>(state.style .get(), state.rootElementStyle));570 int blur = item->blur ? item->blur->computeLength<int>(state.style .get(), state.rootElementStyle) : 0;568 IntPoint location(item->x->computeLength<int>(state.style(), state.rootElementStyle()), 569 item->y->computeLength<int>(state.style(), state.rootElementStyle())); 570 int blur = item->blur ? item->blur->computeLength<int>(state.style(), state.rootElementStyle()) : 0; 571 571 Color color; 572 572 if (item->color) -
trunk/Source/WebCore/css/StyleResolver.cpp
r142717 r142757 195 195 #define HANDLE_INHERIT(prop, Prop) \ 196 196 if (isInherit) { \ 197 m_state.style ->set##Prop(m_state.parentStyle->prop()); \197 m_state.style()->set##Prop(m_state.parentStyle()->prop()); \ 198 198 return; \ 199 199 } … … 202 202 HANDLE_INHERIT(prop, Prop) \ 203 203 if (isInitial) { \ 204 m_state.style ->set##Prop(RenderStyle::initial##Prop()); \204 m_state.style()->set##Prop(RenderStyle::initial##Prop()); \ 205 205 return; \ 206 206 } … … 224 224 } 225 225 226 227 inline StaticCSSRuleList* StyleResolver::State::ensureRuleList() 228 { 229 if (!m_ruleList) 230 m_ruleList = StaticCSSRuleList::create(); 231 return m_ruleList.get(); 232 } 233 234 inline void StyleResolver::State::cacheBorderAndBackground() 235 { 236 m_hasUAAppearance = m_style->hasAppearance(); 237 if (m_hasUAAppearance) { 238 m_borderData = m_style->border(); 239 m_backgroundData = *m_style->backgroundLayers(); 240 m_backgroundColor = m_style->backgroundColor(); 241 } 242 } 243 244 inline void StyleResolver::State::clear() 245 { 246 m_element = 0; 247 m_styledElement = 0; 248 m_parentStyle = 0; 249 m_parentNode = 0; 250 m_regionForStyling = 0; 251 m_ruleList = 0; 252 m_matchedRules.clear(); 253 m_pendingImageProperties.clear(); 254 #if ENABLE(CSS_SHADERS) 255 m_hasPendingShaders = false; 256 #endif 257 #if ENABLE(CSS_FILTERS) && ENABLE(SVG) 258 m_pendingSVGDocuments.clear(); 259 #endif 260 } 226 261 227 262 StyleResolver::StyleResolver(Document* document, bool matchAuthorAndUserStyles) … … 422 457 { 423 458 ASSERT(matchRequest.ruleSet); 424 ASSERT(m_state.element );459 ASSERT(m_state.element()); 425 460 426 461 State& state = m_state; 427 Element* element = state.element ;428 StyledElement* styledElement = state.styledElement;462 Element* element = state.element(); 463 const StyledElement* styledElement = state.styledElement(); 429 464 const AtomicString& pseudoId = element->shadowPseudoId(); 430 465 if (!pseudoId.isEmpty()) { … … 466 501 void StyleResolver::collectMatchingRulesForRegion(const MatchRequest& matchRequest, RuleRange& ruleRange) 467 502 { 468 if (!m_state.regionForStyling )503 if (!m_state.regionForStyling()) 469 504 return; 470 505 … … 472 507 for (unsigned i = 0; i < size; ++i) { 473 508 const CSSSelector* regionSelector = matchRequest.ruleSet->m_regionSelectorsAndRuleSets.at(i).selector; 474 if (checkRegionSelector(regionSelector, static_cast<Element*>(m_state.regionForStyling ->node()))) {509 if (checkRegionSelector(regionSelector, static_cast<Element*>(m_state.regionForStyling()->node()))) { 475 510 RuleSet* regionRules = matchRequest.ruleSet->m_regionSelectorsAndRuleSets.at(i).ruleSet.get(); 476 511 ASSERT(regionRules); … … 483 518 { 484 519 State& state = m_state; 485 if (state.matchedRules.isEmpty()) 520 Vector<const RuleData*, 32>& matchedRules = state.matchedRules(); 521 if (matchedRules.isEmpty()) 486 522 return; 487 523 488 524 sortMatchedRules(); 489 525 490 if (state.mode == SelectorChecker::CollectingRules) { 491 if (!state.ruleList) 492 state.ruleList = StaticCSSRuleList::create(); 493 for (unsigned i = 0; i < state.matchedRules.size(); ++i) 494 state.ruleList->rules().append(state.matchedRules[i]->rule()->createCSSOMWrapper()); 526 if (state.mode() == SelectorChecker::CollectingRules) { 527 for (unsigned i = 0; i < matchedRules.size(); ++i) 528 state.ensureRuleList()->rules().append(matchedRules[i]->rule()->createCSSOMWrapper()); 495 529 return; 496 530 } 497 531 498 532 // Now transfer the set of matched rules over to our list of declarations. 499 for (unsigned i = 0; i < state.matchedRules.size(); i++) {500 if (state.style && state.matchedRules[i]->containsUncommonAttributeSelector())501 state.style ->setUnique();502 addMatchedProperties(result, state.matchedRules[i]->rule()->properties(), state.matchedRules[i]->rule(), state.matchedRules[i]->linkMatchType(), state.matchedRules[i]->propertyWhitelistType());533 for (unsigned i = 0; i < matchedRules.size(); i++) { 534 if (state.style() && matchedRules[i]->containsUncommonAttributeSelector()) 535 state.style()->setUnique(); 536 addMatchedProperties(result, matchedRules[i]->rule()->properties(), matchedRules[i]->rule(), matchedRules[i]->linkMatchType(), matchedRules[i]->propertyWhitelistType()); 503 537 } 504 538 } … … 511 545 512 546 // Match scoped author rules by traversing the scoped element stack (rebuild it if it got inconsistent). 513 if (m_scopeResolver->hasScopedStyles() && m_scopeResolver->ensureStackConsistency(m_state.element )) {514 bool applyAuthorStyles = m_state.element ->treeScope()->applyAuthorStyles();547 if (m_scopeResolver->hasScopedStyles() && m_scopeResolver->ensureStackConsistency(m_state.element())) { 548 bool applyAuthorStyles = m_state.element()->treeScope()->applyAuthorStyles(); 515 549 bool documentScope = true; 516 550 unsigned scopeSize = m_scopeResolver->stackSize(); 517 551 for (unsigned i = 0; i < scopeSize; ++i) { 518 m_state.matchedRules .clear();552 m_state.matchedRules().clear(); 519 553 result.ranges.lastAuthorRule = result.matchedProperties.size() - 1; 520 554 … … 547 581 { 548 582 #if ENABLE(SHADOW_DOM) 549 return m_scopeResolver && m_scopeResolver->styleSharingCandidateMatchesHostRules(m_state.element );583 return m_scopeResolver && m_scopeResolver->styleSharingCandidateMatchesHostRules(m_state.element()); 550 584 #else 551 585 return false; … … 558 592 ASSERT(m_scopeResolver); 559 593 560 m_state.matchedRules .clear();594 m_state.matchedRules().clear(); 561 595 result.ranges.lastAuthorRule = result.matchedProperties.size() - 1; 562 596 563 597 Vector<RuleSet*> matchedRules; 564 m_scopeResolver->matchHostRules(m_state.element , matchedRules);598 m_scopeResolver->matchHostRules(m_state.element(), matchedRules); 565 599 if (matchedRules.isEmpty()) 566 600 return; … … 568 602 for (unsigned i = matchedRules.size(); i > 0; --i) { 569 603 RuleRange ruleRange = result.ranges.authorRuleRange(); 570 collectMatchingRules(MatchRequest(matchedRules.at(i-1), includeEmptyRules, m_state.element ), ruleRange);604 collectMatchingRules(MatchRequest(matchedRules.at(i-1), includeEmptyRules, m_state.element()), ruleRange); 571 605 } 572 606 sortAndTransferMatchedRules(result); … … 579 613 void StyleResolver::matchAuthorRules(MatchResult& result, bool includeEmptyRules) 580 614 { 581 m_state.matchedRules .clear();615 m_state.matchedRules().clear(); 582 616 result.ranges.lastAuthorRule = result.matchedProperties.size() - 1; 583 617 584 if (!m_state.element )618 if (!m_state.element()) 585 619 return; 586 620 … … 600 634 return; 601 635 602 m_state.matchedRules .clear();636 m_state.matchedRules().clear(); 603 637 604 638 result.ranges.lastUserRule = result.matchedProperties.size() - 1; … … 613 647 void StyleResolver::matchUARules(MatchResult& result, RuleSet* rules) 614 648 { 615 m_state.matchedRules .clear();649 m_state.matchedRules().clear(); 616 650 617 651 result.ranges.lastUARule = result.matchedProperties.size() - 1; … … 630 664 // In some cases we may end up looking up style for random elements in the middle of a recursive tree resolve. 631 665 // Ancestor identifier filter won't be up-to-date in that case and we can't use the fast path. 632 bool canUseFastReject = m_selectorFilter.parentStackIsConsistent(state.parentNode );666 bool canUseFastReject = m_selectorFilter.parentStackIsConsistent(state.parentNode()); 633 667 634 668 unsigned size = rules->size(); … … 640 674 StyleRule* rule = ruleData.rule(); 641 675 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willMatchRule(document(), rule, this); 642 if (ruleMatches(ruleData, matchRequest.scope)) { 676 PseudoId dynamicPseudo = NOPSEUDO; 677 if (ruleMatches(ruleData, matchRequest.scope, dynamicPseudo)) { 643 678 // If the rule has no properties to apply, then ignore it in the non-debug mode. 644 679 const StylePropertySet* properties = rule->properties(); … … 648 683 } 649 684 // FIXME: Exposing the non-standard getMatchedCSSRules API to web is the only reason this is needed. 650 if (state. sameOriginOnly&& !ruleData.hasDocumentSecurityOrigin()) {685 if (state.isSameOriginOnly() && !ruleData.hasDocumentSecurityOrigin()) { 651 686 InspectorInstrumentation::didMatchRule(cookie, false); 652 687 continue; … … 654 689 // If we're matching normal rules, set a pseudo bit if 655 690 // we really just matched a pseudo-element. 656 if ( state.dynamicPseudo != NOPSEUDO && state.pseudoStyle== NOPSEUDO) {657 if (state.mode == SelectorChecker::CollectingRules) {691 if (dynamicPseudo != NOPSEUDO && state.pseudoStyle() == NOPSEUDO) { 692 if (state.mode() == SelectorChecker::CollectingRules) { 658 693 InspectorInstrumentation::didMatchRule(cookie, false); 659 694 continue; 660 695 } 661 if ( state.dynamicPseudo < FIRST_INTERNAL_PSEUDOID)662 state.style ->setHasPseudoStyle(state.dynamicPseudo);696 if (dynamicPseudo < FIRST_INTERNAL_PSEUDOID) 697 state.style()->setHasPseudoStyle(dynamicPseudo); 663 698 } else { 664 699 // Update our first/last rule indices in the matched rules array. … … 668 703 669 704 // Add this rule to our list of matched rules. 670 addMatchedRule(&ruleData);705 m_state.addMatchedRule(&ruleData); 671 706 InspectorInstrumentation::didMatchRule(cookie, true); 672 707 continue; … … 686 721 void StyleResolver::sortMatchedRules() 687 722 { 688 std::sort(m_state.matchedRules .begin(), m_state.matchedRules.end(), compareRules);723 std::sort(m_state.matchedRules().begin(), m_state.matchedRules().end(), compareRules); 689 724 } 690 725 … … 698 733 699 734 // Now check author rules, beginning first with presentational attributes mapped from HTML. 700 if (m_state.styledElement ) {701 addElementStyleProperties(result, m_state.styledElement ->presentationAttributeStyle());735 if (m_state.styledElement()) { 736 addElementStyleProperties(result, m_state.styledElement()->presentationAttributeStyle()); 702 737 703 738 // Now we check additional mapped declarations. 704 739 // Tables and table cells share an additional mapped rule that must be applied 705 740 // after all attributes, since their mapped style depends on the values of multiple attributes. 706 addElementStyleProperties(result, m_state.styledElement ->additionalPresentationAttributeStyle());707 708 if (m_state.styledElement ->isHTMLElement()) {741 addElementStyleProperties(result, m_state.styledElement()->additionalPresentationAttributeStyle()); 742 743 if (m_state.styledElement()->isHTMLElement()) { 709 744 bool isAuto; 710 TextDirection textDirection = toHTMLElement(m_state.styledElement )->directionalityIfhasDirAutoAttribute(isAuto);745 TextDirection textDirection = toHTMLElement(m_state.styledElement())->directionalityIfhasDirAutoAttribute(isAuto); 711 746 if (isAuto) 712 747 addMatchedProperties(result, textDirection == LTR ? leftToRightDeclaration() : rightToLeftDeclaration()); … … 719 754 720 755 // Now check our inline style attribute. 721 if (m_matchAuthorAndUserStyles && m_state.styledElement && m_state.styledElement->inlineStyle()) {756 if (m_matchAuthorAndUserStyles && m_state.styledElement() && m_state.styledElement()->inlineStyle()) { 722 757 // Inline style is immutable as long as there is no CSSOM wrapper. 723 758 // FIXME: Media control shadow trees seem to have problems with caching. 724 bool isInlineStyleCacheable = !m_state.styledElement ->inlineStyle()->isMutable() && !m_state.styledElement->isInShadowTree();759 bool isInlineStyleCacheable = !m_state.styledElement()->inlineStyle()->isMutable() && !m_state.styledElement()->isInShadowTree(); 725 760 // FIXME: Constify. 726 addElementStyleProperties(result, m_state.styledElement ->inlineStyle(), isInlineStyleCacheable);761 addElementStyleProperties(result, m_state.styledElement()->inlineStyle(), isInlineStyleCacheable); 727 762 } 728 763 729 764 #if ENABLE(SVG) 730 765 // Now check SMIL animation override style. 731 if (includeSMILProperties && m_matchAuthorAndUserStyles && m_state.styledElement && m_state.styledElement->isSVGElement())732 addElementStyleProperties(result, static_cast<SVGElement*>(m_state.styledElement )->animatedSMILStyleProperties(), false /* isCacheable */);766 if (includeSMILProperties && m_matchAuthorAndUserStyles && m_state.styledElement() && m_state.styledElement()->isSVGElement()) 767 addElementStyleProperties(result, static_cast<SVGElement*>(m_state.styledElement())->animatedSMILStyleProperties(), false /* isCacheable */); 733 768 #else 734 769 UNUSED_PARAM(includeSMILProperties); … … 745 780 } 746 781 782 inline void StyleResolver::State::initElement(Element* e) 783 { 784 m_element = e; 785 m_styledElement = e && e->isStyledElement() ? static_cast<StyledElement*>(e) : 0; 786 m_elementLinkState = e ? e->document()->visitedLinkState()->determineLinkState(e) : NotInsideLink; 787 } 788 747 789 inline void StyleResolver::initElement(Element* e) 748 790 { 749 if (m_state.element != e) { 750 m_state.element = e; 751 m_state.styledElement = m_state.element && m_state.element->isStyledElement() ? static_cast<StyledElement*>(m_state.element) : 0; 752 m_state.elementLinkState = document()->visitedLinkState()->determineLinkState(e); 791 if (m_state.element() != e) { 792 m_state.initElement(e); 753 793 if (e && e == e->document()->documentElement()) { 754 794 e->document()->setDirectionSetOnDocumentElement(false); … … 758 798 } 759 799 760 inline void StyleResolver:: initForStyleResolve(Element* e, RenderStyle* parentStyle, PseudoId pseudoID)761 { 762 State& state = m_state;763 state.pseudoStyle = pseudoID;800 inline void StyleResolver::State::initForStyleResolve(Document* document, Element* e, RenderStyle* parentStyle, PseudoId pseudoId, RenderRegion* regionForStyling) 801 { 802 m_pseudoStyle = pseudoId; 803 m_regionForStyling = regionForStyling; 764 804 765 805 if (e) { 766 806 NodeRenderingContext context(e); 767 state.parentNode = context.parentNodeForRenderingAndStyle();768 state.parentStyle = context.resetStyleInheritance() ? 0 :807 m_parentNode = context.parentNodeForRenderingAndStyle(); 808 m_parentStyle = context.resetStyleInheritance() ? 0 : 769 809 parentStyle ? parentStyle : 770 state.parentNode ? state.parentNode->renderStyle() : 0;771 state.distributedToInsertionPoint = context.insertionPoint();810 m_parentNode ? m_parentNode->renderStyle() : 0; 811 m_distributedToInsertionPoint = context.insertionPoint(); 772 812 } else { 773 state.parentNode = 0;774 state.parentStyle = parentStyle;775 state.distributedToInsertionPoint = false;813 m_parentNode = 0; 814 m_parentStyle = parentStyle; 815 m_distributedToInsertionPoint = false; 776 816 } 777 817 778 818 Node* docElement = e ? e->document()->documentElement() : 0; 779 RenderStyle* docStyle = document()->renderStyle(); 780 state.rootElementStyle = docElement && e != docElement ? docElement->renderStyle() : docStyle; 781 782 state.style = 0; 783 784 state.pendingImageProperties.clear(); 785 786 state.ruleList = 0; 787 788 state.fontDirty = false; 819 RenderStyle* docStyle = document->renderStyle(); 820 m_rootElementStyle = docElement && e != docElement ? docElement->renderStyle() : docStyle; 821 822 m_style = 0; 823 m_pendingImageProperties.clear(); 824 m_ruleList = 0; 825 m_fontDirty = false; 789 826 } 790 827 … … 849 886 if (!ruleSet) 850 887 return false; 851 m_state.matchedRules .clear();852 853 m_state. mode = SelectorChecker::SharingRules;888 m_state.matchedRules().clear(); 889 890 m_state.setMode(SelectorChecker::SharingRules); 854 891 int firstRuleIndex = -1, lastRuleIndex = -1; 855 892 RuleRange ruleRange(firstRuleIndex, lastRuleIndex); 856 893 collectMatchingRules(MatchRequest(ruleSet), ruleRange); 857 m_state. mode = SelectorChecker::ResolvingStyle;858 if (m_state.matchedRules .isEmpty())859 return false; 860 m_state.matchedRules .clear();894 m_state.setMode(SelectorChecker::ResolvingStyle); 895 if (m_state.matchedRules().isEmpty()) 896 return false; 897 m_state.matchedRules().clear(); 861 898 return true; 862 899 } … … 866 903 const State& state = m_state; 867 904 HTMLInputElement* thisInputElement = element->toInputElement(); 868 HTMLInputElement* otherInputElement = state.element ->toInputElement();905 HTMLInputElement* otherInputElement = state.element()->toInputElement(); 869 906 870 907 if (!thisInputElement || !otherInputElement) … … 887 924 return false; 888 925 889 if (element->isEnabledFormControl() != state.element ->isEnabledFormControl())890 return false; 891 892 if (element->isDefaultButtonForForm() != state.element ->isDefaultButtonForForm())893 return false; 894 895 if (state. element->document()->containsValidityStyleRules()) {926 if (element->isEnabledFormControl() != state.element()->isEnabledFormControl()) 927 return false; 928 929 if (element->isDefaultButtonForForm() != state.element()->isDefaultButtonForForm()) 930 return false; 931 932 if (state.document()->containsValidityStyleRules()) { 896 933 bool willValidate = element->willValidate(); 897 934 898 if (willValidate != state.element ->willValidate())935 if (willValidate != state.element()->willValidate()) 899 936 return false; 900 937 901 if (willValidate && (element->isValidFormControlElement() != state.element ->isValidFormControlElement()))938 if (willValidate && (element->isValidFormControlElement() != state.element()->isValidFormControlElement())) 902 939 return false; 903 940 904 if (element->isInRange() != state.element ->isInRange())941 if (element->isInRange() != state.element()->isInRange()) 905 942 return false; 906 943 907 if (element->isOutOfRange() != state.element ->isOutOfRange())944 if (element->isOutOfRange() != state.element()->isOutOfRange()) 908 945 return false; 909 946 } … … 921 958 { 922 959 const State& state = m_state; 923 if (state.element ->attributeData() == sharingCandidate->attributeData())960 if (state.element()->attributeData() == sharingCandidate->attributeData()) 924 961 return true; 925 if (state.element ->fastGetAttribute(XMLNames::langAttr) != sharingCandidate->fastGetAttribute(XMLNames::langAttr))926 return false; 927 if (state.element ->fastGetAttribute(langAttr) != sharingCandidate->fastGetAttribute(langAttr))928 return false; 929 930 if (!state.elementAffectedByClassRules ) {962 if (state.element()->fastGetAttribute(XMLNames::langAttr) != sharingCandidate->fastGetAttribute(XMLNames::langAttr)) 963 return false; 964 if (state.element()->fastGetAttribute(langAttr) != sharingCandidate->fastGetAttribute(langAttr)) 965 return false; 966 967 if (!state.elementAffectedByClassRules()) { 931 968 if (sharingCandidate->hasClass() && classNamesAffectedByRules(sharingCandidate->classNames())) 932 969 return false; … … 934 971 #if ENABLE(SVG) 935 972 // SVG elements require a (slow!) getAttribute comparision because "class" is an animatable attribute for SVG. 936 if (state.element ->isSVGElement()) {937 if (state.element ->getAttribute(classAttr) != sharingCandidate->getAttribute(classAttr))973 if (state.element()->isSVGElement()) { 974 if (state.element()->getAttribute(classAttr) != sharingCandidate->getAttribute(classAttr)) 938 975 return false; 939 976 } else { 940 977 #endif 941 if (state.element ->classNames() != sharingCandidate->classNames())978 if (state.element()->classNames() != sharingCandidate->classNames()) 942 979 return false; 943 980 #if ENABLE(SVG) … … 947 984 return false; 948 985 949 if (state.styledElement ->presentationAttributeStyle() != sharingCandidate->presentationAttributeStyle())986 if (state.styledElement()->presentationAttributeStyle() != sharingCandidate->presentationAttributeStyle()) 950 987 return false; 951 988 952 989 #if ENABLE(PROGRESS_ELEMENT) 953 if (state.element ->hasTagName(progressTag)) {954 if (static_cast<HTMLProgressElement*>(state.element )->isDeterminate() != static_cast<HTMLProgressElement*>(sharingCandidate)->isDeterminate())990 if (state.element()->hasTagName(progressTag)) { 991 if (static_cast<HTMLProgressElement*>(state.element())->isDeterminate() != static_cast<HTMLProgressElement*>(sharingCandidate)->isDeterminate()) 955 992 return false; 956 993 } … … 969 1006 if (style->unique()) 970 1007 return false; 971 if (element->tagQName() != state.element ->tagQName())1008 if (element->tagQName() != state.element()->tagQName()) 972 1009 return false; 973 1010 if (element->inlineStyle()) … … 979 1016 return false; 980 1017 #endif 981 if (element->isLink() != state.element ->isLink())982 return false; 983 if (element->hovered() != state.element ->hovered())984 return false; 985 if (element->active() != state.element ->active())986 return false; 987 if (element->focused() != state.element ->focused())988 return false; 989 if (element->shadowPseudoId() != state.element ->shadowPseudoId())1018 if (element->isLink() != state.element()->isLink()) 1019 return false; 1020 if (element->hovered() != state.element()->hovered()) 1021 return false; 1022 if (element->active() != state.element()->active()) 1023 return false; 1024 if (element->focused() != state.element()->focused()) 1025 return false; 1026 if (element->shadowPseudoId() != state.element()->shadowPseudoId()) 990 1027 return false; 991 1028 if (element == element->document()->cssTarget()) … … 993 1030 if (!sharingCandidateHasIdenticalStyleAffectingAttributes(element)) 994 1031 return false; 995 if (element->additionalPresentationAttributeStyle() != state.styledElement ->additionalPresentationAttributeStyle())1032 if (element->additionalPresentationAttributeStyle() != state.styledElement()->additionalPresentationAttributeStyle()) 996 1033 return false; 997 1034 … … 1009 1046 bool isControl = element->isFormControlElement(); 1010 1047 1011 if (isControl != state.element ->isFormControlElement())1048 if (isControl != state.element()->isFormControlElement()) 1012 1049 return false; 1013 1050 … … 1033 1070 return false; 1034 1071 1035 if (element->isLink() && state.elementLinkState != style->insideLink())1072 if (element->isLink() && state.elementLinkState() != style->insideLink()) 1036 1073 return false; 1037 1074 1038 1075 #if ENABLE(VIDEO_TRACK) 1039 1076 // Deny sharing styles between WebVTT and non-WebVTT nodes. 1040 if (element->isWebVTTElement() != state.element ->isWebVTTElement())1041 return false; 1042 1043 if (element->isWebVTTElement() && state.element ->isWebVTTElement() && toWebVTTElement(element)->isPastNode() != toWebVTTElement(state.element)->isPastNode())1077 if (element->isWebVTTElement() != state.element()->isWebVTTElement()) 1078 return false; 1079 1080 if (element->isWebVTTElement() && state.element()->isWebVTTElement() && toWebVTTElement(element)->isPastNode() != toWebVTTElement(state.element())->isPastNode()) 1044 1081 return false; 1045 1082 #endif 1046 1083 1047 1084 #if ENABLE(FULLSCREEN_API) 1048 if (element == element->document()->webkitCurrentFullScreenElement() || state.element == state.element->document()->webkitCurrentFullScreenElement())1085 if (element == element->document()->webkitCurrentFullScreenElement() || state.element() == state.document()->webkitCurrentFullScreenElement()) 1049 1086 return false; 1050 1087 #endif … … 1068 1105 { 1069 1106 State& state = m_state; 1070 if (!state.styledElement || !state.parentStyle)1107 if (!state.styledElement() || !state.parentStyle()) 1071 1108 return 0; 1072 1109 1073 1110 // If the element has inline style it is probably unique. 1074 if (state.styledElement ->inlineStyle())1111 if (state.styledElement()->inlineStyle()) 1075 1112 return 0; 1076 1113 #if ENABLE(SVG) 1077 if (state.styledElement ->isSVGElement() && static_cast<SVGElement*>(state.styledElement)->animatedSMILStyleProperties())1114 if (state.styledElement()->isSVGElement() && static_cast<SVGElement*>(state.styledElement())->animatedSMILStyleProperties()) 1078 1115 return 0; 1079 1116 #endif 1080 1117 // Ids stop style sharing if they show up in the stylesheets. 1081 if (state.styledElement ->hasID() && m_ruleSets.features().idsInRules.contains(state.styledElement->idForStyleResolution().impl()))1118 if (state.styledElement()->hasID() && m_ruleSets.features().idsInRules.contains(state.styledElement()->idForStyleResolution().impl())) 1082 1119 return 0; 1083 if (parentElementPreventsSharing(state.element ->parentElement()))1120 if (parentElementPreventsSharing(state.element()->parentElement())) 1084 1121 return 0; 1085 if (state.styledElement ->hasScopedHTMLStyleChild())1122 if (state.styledElement()->hasScopedHTMLStyleChild()) 1086 1123 return 0; 1087 if (state.element == state.element->document()->cssTarget())1124 if (state.element() == state.document()->cssTarget()) 1088 1125 return 0; 1089 if (elementHasDirectionAuto(state.element ))1126 if (elementHasDirectionAuto(state.element())) 1090 1127 return 0; 1091 1128 1092 1129 // Cache whether state.element is affected by any known class selectors. 1093 1130 // FIXME: This shouldn't be a member variable. The style sharing code could be factored out of StyleResolver. 1094 state. elementAffectedByClassRules = state.element && state.element->hasClass() && classNamesAffectedByRules(state.element->classNames());1131 state.setElementAffectedByClassRules(state.element() && state.element()->hasClass() && classNamesAffectedByRules(state.element()->classNames())); 1095 1132 1096 1133 // Check previous siblings and their cousins. … … 1098 1135 unsigned visitedNodeCount = 0; 1099 1136 StyledElement* shareElement = 0; 1100 Node* cousinList = state.styledElement ->previousSibling();1137 Node* cousinList = state.styledElement()->previousSibling(); 1101 1138 while (cousinList) { 1102 1139 shareElement = findSiblingForStyleSharing(cousinList, count); … … 1120 1157 return 0; 1121 1158 // Tracking child index requires unique style for each node. This may get set by the sibling rule match above. 1122 if (parentElementPreventsSharing(state.element ->parentElement()))1159 if (parentElementPreventsSharing(state.element()->parentElement())) 1123 1160 return 0; 1124 1161 return shareElement->renderStyle(); … … 1342 1379 State& state = m_state; 1343 1380 initElement(element); 1344 initForStyleResolve(element, defaultParent); 1345 state.regionForStyling = regionForStyling; 1346 if (sharingBehavior == AllowStyleSharing && !state.distributedToInsertionPoint) { 1381 state.initForStyleResolve(document(), element, defaultParent, NOPSEUDO, regionForStyling); 1382 if (sharingBehavior == AllowStyleSharing && !state.distributedToInsertionPoint()) { 1347 1383 RenderStyle* sharedStyle = locateSharedStyle(); 1348 1384 if (sharedStyle) … … 1352 1388 RefPtr<RenderStyle> cloneForParent; 1353 1389 1354 if (state.parentStyle ) {1355 state.s tyle = RenderStyle::create();1356 state.style ->inheritFrom(state.parentStyle, isAtShadowBoundary(element) ? RenderStyle::AtShadowBoundary : RenderStyle::NotAtShadowBoundary);1390 if (state.parentStyle()) { 1391 state.setStyle(RenderStyle::create()); 1392 state.style()->inheritFrom(state.parentStyle(), isAtShadowBoundary(element) ? RenderStyle::AtShadowBoundary : RenderStyle::NotAtShadowBoundary); 1357 1393 } else { 1358 state.s tyle = defaultStyleForElement();1359 cloneForParent = RenderStyle::clone(state.style .get());1360 state. parentStyle = cloneForParent.get();1394 state.setStyle(defaultStyleForElement()); 1395 cloneForParent = RenderStyle::clone(state.style()); 1396 state.setParentStyle(cloneForParent.get()); 1361 1397 } 1362 1398 // contenteditable attribute (implemented by -webkit-user-modify) should 1363 1399 // be propagated from shadow host to distributed node. 1364 if (state.distributedToInsertionPoint ) {1400 if (state.distributedToInsertionPoint()) { 1365 1401 if (Element* parent = element->parentElement()) { 1366 1402 if (RenderStyle* styleOfShadowHost = parent->renderStyle()) 1367 state.style ->setUserModify(styleOfShadowHost->userModify());1403 state.style()->setUserModify(styleOfShadowHost->userModify()); 1368 1404 } 1369 1405 } 1370 1406 1371 1407 if (element->isLink()) { 1372 state.style ->setIsLink(true);1373 EInsideLink linkState = state.elementLinkState ;1408 state.style()->setIsLink(true); 1409 EInsideLink linkState = state.elementLinkState(); 1374 1410 if (linkState != NotInsideLink) { 1375 1411 bool forceVisited = InspectorInstrumentation::forcePseudoState(element, CSSSelector::PseudoVisited); … … 1377 1413 linkState = InsideVisitedLink; 1378 1414 } 1379 state.style ->setInsideLink(linkState);1415 state.style()->setInsideLink(linkState); 1380 1416 } 1381 1417 … … 1394 1430 1395 1431 // Clean up our style object's display and text decorations (among other fixups). 1396 adjustRenderStyle(state.style.get(), state.parentStyle, element); 1397 1398 initElement(0); // Clear out for the next resolve. 1399 1400 if (cloneForParent) 1401 state.parentStyle = 0; 1432 adjustRenderStyle(state.style(), state.parentStyle(), element); 1433 1434 state.clear(); // Clear out for the next resolve. 1402 1435 1403 1436 document()->didAccessStyleResolver(); 1404 1437 1405 1438 // Now return the style. 1406 return state. style.release();1439 return state.takeStyle(); 1407 1440 } 1408 1441 … … 1413 1446 addMatchedProperties(result, keyframe->properties()); 1414 1447 1415 ASSERT(!m_state.style );1448 ASSERT(!m_state.style()); 1416 1449 1417 1450 State& state = m_state; 1418 1451 1419 1452 // Create the style 1420 state.style = RenderStyle::clone(elementStyle); 1421 1422 state.lineHeightValue = 0; 1453 state.setStyle(RenderStyle::clone(elementStyle)); 1454 state.setLineHeightValue(0); 1423 1455 1424 1456 // We don't need to bother with !important. Since there is only ever one … … 1432 1464 1433 1465 // Line-height is set when we are sure we decided on the font-size 1434 if (state.lineHeightValue )1435 applyProperty(CSSPropertyLineHeight, state.lineHeightValue );1466 if (state.lineHeightValue()) 1467 applyProperty(CSSPropertyLineHeight, state.lineHeightValue()); 1436 1468 1437 1469 // Now do rest of the properties. … … 1460 1492 document()->didAccessStyleResolver(); 1461 1493 1462 return state. style.release();1494 return state.takeStyle(); 1463 1495 } 1464 1496 … … 1484 1516 // Apply the declaration to the style. This is a simplified version of the logic in styleForElement 1485 1517 initElement(e); 1486 initForStyleResolve(e);1518 m_state.initForStyleResolve(document(), e); 1487 1519 1488 1520 const StyleKeyframe* keyframe = keyframes[i].get(); … … 1528 1560 PassRefPtr<RenderStyle> StyleResolver::pseudoStyleForElement(PseudoId pseudo, Element* e, RenderStyle* parentStyle) 1529 1561 { 1530 ASSERT( m_state.parentStyle);1562 ASSERT(parentStyle); 1531 1563 if (!e) 1532 1564 return 0; … … 1536 1568 initElement(e); 1537 1569 1538 initForStyleResolve(e, parentStyle, pseudo);1539 state.s tyle = RenderStyle::create();1540 state.style ->inheritFrom(m_state.parentStyle);1570 state.initForStyleResolve(document(), e, parentStyle, pseudo); 1571 state.setStyle(RenderStyle::create()); 1572 state.style()->inheritFrom(m_state.parentStyle()); 1541 1573 1542 1574 // Since we don't use pseudo-elements in any of our quirk/print user agent rules, don't waste time walking … … 1555 1587 return 0; 1556 1588 1557 state.style ->setStyleType(pseudo);1589 state.style()->setStyleType(pseudo); 1558 1590 1559 1591 applyMatchedProperties(matchResult, e); 1560 1592 1561 1593 // Clean up our style object's display and text decorations (among other fixups). 1562 adjustRenderStyle(state.style .get(), m_state.parentStyle, 0);1594 adjustRenderStyle(state.style(), m_state.parentStyle(), 0); 1563 1595 1564 1596 // Start loading resources referenced by this style. … … 1568 1600 1569 1601 // Now return the style. 1570 return state. style.release();1602 return state.takeStyle(); 1571 1603 } 1572 1604 1573 1605 PassRefPtr<RenderStyle> StyleResolver::styleForPage(int pageIndex) 1574 1606 { 1575 initForStyleResolve(document()->documentElement()); // m_rootElementStyle will be set to the document style.1576 1577 m_state.s tyle = RenderStyle::create();1578 m_state.style ->inheritFrom(m_state.rootElementStyle);1607 m_state.initForStyleResolve(document(), document()->documentElement()); // m_rootElementStyle will be set to the document style. 1608 1609 m_state.setStyle(RenderStyle::create()); 1610 m_state.style()->inheritFrom(m_state.rootElementStyle()); 1579 1611 1580 1612 const bool isLeft = isLeftPage(pageIndex); … … 1587 1619 // Only consider the global author RuleSet for @page rules, as per the HTML5 spec. 1588 1620 matchPageRules(result, m_ruleSets.authorStyle(), isLeft, isFirst, page); 1589 m_state. lineHeightValue = 0;1621 m_state.setLineHeightValue(0); 1590 1622 bool inheritedOnly = false; 1591 1623 #if ENABLE(CSS_VARIABLES) … … 1598 1630 1599 1631 // Line-height is set when we are sure we decided on the font-size. 1600 if (m_state.lineHeightValue )1601 applyProperty(CSSPropertyLineHeight, m_state.lineHeightValue );1632 if (m_state.lineHeightValue()) 1633 applyProperty(CSSPropertyLineHeight, m_state.lineHeightValue()); 1602 1634 1603 1635 applyMatchedProperties<LowPriorityProperties>(result, false, 0, result.matchedProperties.size() - 1, inheritedOnly); … … 1609 1641 1610 1642 // Now return the style. 1611 return m_state. style.release();1643 return m_state.takeStyle(); 1612 1644 } 1613 1645 1614 1646 PassRefPtr<RenderStyle> StyleResolver::defaultStyleForElement() 1615 1647 { 1616 m_state.s tyle = RenderStyle::create();1648 m_state.setStyle(RenderStyle::create()); 1617 1649 // Make sure our fonts are initialized if we don't inherit them from our parent style. 1618 1650 if (Settings* settings = documentSettings()) { 1619 1651 initializeFontStyle(settings); 1620 m_state.style ->font().update(fontSelector());1652 m_state.style()->font().update(fontSelector()); 1621 1653 } else 1622 m_state.style ->font().update(0);1623 1624 return m_state. style.release();1654 m_state.style()->font().update(0); 1655 1656 return m_state.takeStyle(); 1625 1657 } 1626 1658 … … 1910 1942 // Let the theme also have a crack at adjusting the style. 1911 1943 if (style->hasAppearance()) 1912 RenderTheme::defaultTheme()->adjustStyle(this, style, e, m_state.hasUAAppearance , m_state.borderData, m_state.backgroundData, m_state.backgroundColor);1944 RenderTheme::defaultTheme()->adjustStyle(this, style, e, m_state.hasUAAppearance(), m_state.borderData(), m_state.backgroundData(), m_state.backgroundColor()); 1913 1945 1914 1946 // If we have first-letter pseudo style, do not share this style. … … 1993 2025 void StyleResolver::updateFont() 1994 2026 { 1995 if (!m_state.fontDirty )2027 if (!m_state.fontDirty()) 1996 2028 return; 1997 2029 1998 2030 checkForTextSizeAdjust(); 1999 RenderStyle* style = m_state.style .get();2000 checkForGenericFamilyChange(style, m_state.parentStyle );2001 checkForZoomChange(style, m_state.parentStyle );2031 RenderStyle* style = m_state.style(); 2032 checkForGenericFamilyChange(style, m_state.parentStyle()); 2033 checkForZoomChange(style, m_state.parentStyle()); 2002 2034 checkForOrientationChange(style); 2003 m_state.style->font().update(m_fontSelector); 2004 m_state.fontDirty = false; 2005 } 2006 2007 void StyleResolver::cacheBorderAndBackground() 2008 { 2009 m_state.hasUAAppearance = m_state.style->hasAppearance(); 2010 if (m_state.hasUAAppearance) { 2011 m_state.borderData = m_state.style->border(); 2012 m_state.backgroundData = *m_state.style->backgroundLayers(); 2013 m_state.backgroundColor = m_state.style->backgroundColor(); 2014 } 2035 style->font().update(m_fontSelector); 2036 m_state.setFontDirty(false); 2015 2037 } 2016 2038 … … 2025 2047 return 0; 2026 2048 2027 m_state. mode = SelectorChecker::CollectingRules;2049 m_state.setMode(SelectorChecker::CollectingRules); 2028 2050 2029 2051 initElement(e); 2030 initForStyleResolve(e, 0, pseudoId);2052 m_state.initForStyleResolve(document(), e, 0, pseudoId); 2031 2053 2032 2054 MatchResult dummy; … … 2041 2063 2042 2064 if (m_matchAuthorAndUserStyles && (rulesToInclude & AuthorCSSRules)) { 2043 m_state.s ameOriginOnly = !(rulesToInclude & CrossOriginCSSRules);2065 m_state.setSameOriginOnly(!(rulesToInclude & CrossOriginCSSRules)); 2044 2066 2045 2067 // Check the rules in author sheets. 2046 2068 matchAuthorRules(dummy, rulesToInclude & EmptyCSSRules); 2047 2069 2048 m_state.s ameOriginOnly = false;2049 } 2050 2051 m_state. mode = SelectorChecker::ResolvingStyle;2052 2053 return m_state. ruleList.release();2054 } 2055 2056 inline bool StyleResolver::ruleMatches(const RuleData& ruleData, const ContainerNode* scope )2070 m_state.setSameOriginOnly(false); 2071 } 2072 2073 m_state.setMode(SelectorChecker::ResolvingStyle); 2074 2075 return m_state.takeRuleList(); 2076 } 2077 2078 inline bool StyleResolver::ruleMatches(const RuleData& ruleData, const ContainerNode* scope, PseudoId& dynamicPseudo) 2057 2079 { 2058 2080 State& state = m_state; 2059 state.dynamicPseudo = NOPSEUDO;2060 2081 2061 2082 if (ruleData.hasFastCheckableSelector()) { 2062 2083 // We know this selector does not include any pseudo elements. 2063 if (state.pseudoStyle != NOPSEUDO)2084 if (state.pseudoStyle() != NOPSEUDO) 2064 2085 return false; 2065 2086 // We know a sufficiently simple single part selector matches simply because we found it from the rule hash. 2066 2087 // This is limited to HTML only so we don't need to check the namespace. 2067 if (ruleData.hasRightmostSelectorMatchingHTMLBasedOnRuleHash() && state.element ->isHTMLElement()) {2088 if (ruleData.hasRightmostSelectorMatchingHTMLBasedOnRuleHash() && state.element()->isHTMLElement()) { 2068 2089 if (!ruleData.hasMultipartSelector()) 2069 2090 return true; 2070 2091 } 2071 if (ruleData.selector()->m_match == CSSSelector::Tag && !SelectorChecker::tagMatches(state.element , ruleData.selector()->tagQName()))2092 if (ruleData.selector()->m_match == CSSSelector::Tag && !SelectorChecker::tagMatches(state.element(), ruleData.selector()->tagQName())) 2072 2093 return false; 2073 if (!SelectorChecker::fastCheckRightmostAttributeSelector(state.element , ruleData.selector()))2094 if (!SelectorChecker::fastCheckRightmostAttributeSelector(state.element(), ruleData.selector())) 2074 2095 return false; 2075 2096 2076 return SelectorChecker::fastCheck(ruleData.selector(), state.element );2097 return SelectorChecker::fastCheck(ruleData.selector(), state.element()); 2077 2098 } 2078 2099 2079 2100 // Slow path. 2080 SelectorChecker selectorChecker(document(), state.mode );2081 SelectorChecker::SelectorCheckingContext context(ruleData.selector(), state.element , SelectorChecker::VisitedMatchEnabled);2082 context.elementStyle = state.style .get();2101 SelectorChecker selectorChecker(document(), state.mode()); 2102 SelectorChecker::SelectorCheckingContext context(ruleData.selector(), state.element(), SelectorChecker::VisitedMatchEnabled); 2103 context.elementStyle = state.style(); 2083 2104 context.scope = scope; 2084 context.pseudoStyle = state.pseudoStyle ;2085 SelectorChecker::Match match = selectorChecker.match(context, state.dynamicPseudo, DOMSiblingTraversalStrategy());2105 context.pseudoStyle = state.pseudoStyle(); 2106 SelectorChecker::Match match = selectorChecker.match(context, dynamicPseudo, DOMSiblingTraversalStrategy()); 2086 2107 if (match != SelectorChecker::SelectorMatches) 2087 2108 return false; 2088 if (state.pseudoStyle != NOPSEUDO && state.pseudoStyle != state.dynamicPseudo)2109 if (state.pseudoStyle() != NOPSEUDO && state.pseudoStyle() != dynamicPseudo) 2089 2110 return false; 2090 2111 return true; … … 2096 2117 return false; 2097 2118 2098 m_state.pseudoStyle = NOPSEUDO; 2099 2100 SelectorChecker selectorChecker(document(), SelectorChecker::ResolvingStyle); 2119 SelectorChecker selectorChecker(document(), m_state.mode()); 2101 2120 for (const CSSSelector* s = regionSelector; s; s = CSSSelectorList::next(s)) 2102 2121 if (selectorChecker.matches(s, regionElement)) … … 2122 2141 void StyleResolver::applyProperties(const StylePropertySet* properties, StyleRule* rule, bool isImportant, bool inheritedOnly, PropertyWhitelistType propertyWhitelistType) 2123 2142 { 2124 ASSERT((propertyWhitelistType != PropertyWhitelistRegion) || m_state.regionForStyling );2143 ASSERT((propertyWhitelistType != PropertyWhitelistRegion) || m_state.regionForStyling()); 2125 2144 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willProcessRule(document(), rule, this); 2126 2145 … … 2166 2185 // we apply line-height later 2167 2186 else if (property == CSSPropertyLineHeight) 2168 m_state. lineHeightValue = current.value();2187 m_state.setLineHeightValue(current.value()); 2169 2188 break; 2170 2189 case LowPriorityProperties: … … 2183 2202 2184 2203 State& state = m_state; 2185 if (state.style ->insideLink() != NotInsideLink) {2204 if (state.style()->insideLink() != NotInsideLink) { 2186 2205 for (int i = startIndex; i <= endIndex; ++i) { 2187 2206 const MatchedProperties& matchedProperties = matchResult.matchedProperties[i]; 2188 2207 unsigned linkMatchType = matchedProperties.linkMatchType; 2189 2208 // FIXME: It would be nicer to pass these as arguments but that requires changes in many places. 2190 state. applyPropertyToRegularStyle = linkMatchType & SelectorChecker::MatchLink;2191 state. applyPropertyToVisitedLinkStyle = linkMatchType & SelectorChecker::MatchVisited;2209 state.setApplyPropertyToRegularStyle(linkMatchType & SelectorChecker::MatchLink); 2210 state.setApplyPropertyToVisitedLinkStyle(linkMatchType & SelectorChecker::MatchVisited); 2192 2211 2193 2212 applyProperties<pass>(matchedProperties.properties.get(), matchResult.matchedRules[i], isImportant, inheritedOnly, static_cast<PropertyWhitelistType>(matchedProperties.whitelistType)); 2194 2213 } 2195 state. applyPropertyToRegularStyle = true;2196 state. applyPropertyToVisitedLinkStyle = false;2214 state.setApplyPropertyToRegularStyle(true); 2215 state.setApplyPropertyToVisitedLinkStyle(false); 2197 2216 return; 2198 2217 } … … 2310 2329 // style declarations. We then only need to apply the inherited properties, if any, as their values can depend on the 2311 2330 // element context. This is fast and saves memory by reusing the style data structures. 2312 state.style ->copyNonInheritedFrom(cacheItem->renderStyle.get());2313 if (state.parentStyle ->inheritedDataShared(cacheItem->parentRenderStyle.get()) && !isAtShadowBoundary(element)) {2314 EInsideLink linkStatus = state.style ->insideLink();2331 state.style()->copyNonInheritedFrom(cacheItem->renderStyle.get()); 2332 if (state.parentStyle()->inheritedDataShared(cacheItem->parentRenderStyle.get()) && !isAtShadowBoundary(element)) { 2333 EInsideLink linkStatus = state.style()->insideLink(); 2315 2334 // If the cache item parent style has identical inherited properties to the current parent style then the 2316 2335 // resulting style will be identical too. We copy the inherited properties over from the cache and are done. 2317 state.style ->inheritFrom(cacheItem->renderStyle.get());2336 state.style()->inheritFrom(cacheItem->renderStyle.get()); 2318 2337 2319 2338 // Unfortunately the link status is treated like an inherited property. We need to explicitly restore it. 2320 state.style ->setInsideLink(linkStatus);2339 state.style()->setInsideLink(linkStatus); 2321 2340 return; 2322 2341 } … … 2336 2355 // The order is (1) high-priority not important, (2) high-priority important, (3) normal not important 2337 2356 // and (4) normal important. 2338 state. lineHeightValue = 0;2357 state.setLineHeightValue(0); 2339 2358 applyMatchedProperties<HighPriorityProperties>(matchResult, false, 0, matchResult.matchedProperties.size() - 1, applyInheritedOnly); 2340 2359 applyMatchedProperties<HighPriorityProperties>(matchResult, true, matchResult.ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInheritedOnly); … … 2342 2361 applyMatchedProperties<HighPriorityProperties>(matchResult, true, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly); 2343 2362 2344 if (cacheItem && cacheItem->renderStyle->effectiveZoom() != state.style ->effectiveZoom()) {2345 state. fontDirty = true;2363 if (cacheItem && cacheItem->renderStyle->effectiveZoom() != state.style()->effectiveZoom()) { 2364 state.setFontDirty(true); 2346 2365 applyInheritedOnly = false; 2347 2366 } … … 2351 2370 2352 2371 // Line-height is set when we are sure we decided on the font-size. 2353 if (state.lineHeightValue )2354 applyProperty(CSSPropertyLineHeight, state.lineHeightValue );2372 if (state.lineHeightValue()) 2373 applyProperty(CSSPropertyLineHeight, state.lineHeightValue()); 2355 2374 2356 2375 // Many properties depend on the font. If it changes we just apply all properties. 2357 if (cacheItem && cacheItem->renderStyle->fontDescription() != state.style ->fontDescription())2376 if (cacheItem && cacheItem->renderStyle->fontDescription() != state.style()->fontDescription()) 2358 2377 applyInheritedOnly = false; 2359 2378 … … 2362 2381 2363 2382 // Cache our border and background so that we can examine them later. 2364 cacheBorderAndBackground();2383 state.cacheBorderAndBackground(); 2365 2384 2366 2385 // Now do the author and user normal priority properties and all the !important properties. … … 2373 2392 loadPendingResources(); 2374 2393 2375 ASSERT(!state.fontDirty );2394 ASSERT(!state.fontDirty()); 2376 2395 2377 2396 if (cacheItem || !cacheHash) 2378 2397 return; 2379 if (!isCacheableInMatchedPropertiesCache(state.element , state.style.get(), state.parentStyle))2380 return; 2381 addToMatchedPropertiesCache(state.style .get(), state.parentStyle, cacheHash, matchResult);2398 if (!isCacheableInMatchedPropertiesCache(state.element(), state.style(), state.parentStyle())) 2399 return; 2400 addToMatchedPropertiesCache(state.style(), state.parentStyle(), cacheHash, matchResult); 2382 2401 } 2383 2402 … … 2444 2463 { 2445 2464 bool isFirstPageLeft = false; 2446 if (!m_state.rootElementStyle ->isLeftToRightDirection())2465 if (!m_state.rootElementStyle()->isLeftToRightDirection()) 2447 2466 isFirstPageLeft = true; 2448 2467 … … 2465 2484 { 2466 2485 initElement(0); 2467 initForStyleResolve(0, style);2468 m_state.s tyle = style;2486 m_state.initForStyleResolve(document(), 0, style); 2487 m_state.setStyle(style); 2469 2488 applyPropertyToCurrentStyle(id, value); 2470 2489 } … … 2578 2597 bool StyleResolver::useSVGZoomRules() 2579 2598 { 2580 return m_state.element && m_state.element->isSVGElement();2599 return m_state.element() && m_state.element()->isSVGElement(); 2581 2600 } 2582 2601 … … 2593 2612 } 2594 2613 2595 workingLength = primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | ViewportPercentageConversion | AutoConversion>(state.style .get(), state.rootElementStyle, state.style->effectiveZoom());2614 workingLength = primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | ViewportPercentageConversion | AutoConversion>(state.style(), state.rootElementStyle(), state.style()->effectiveZoom()); 2596 2615 if (workingLength.isUndefined()) 2597 2616 return false; … … 2699 2718 void StyleResolver::resolveVariables(CSSPropertyID id, CSSValue* value, Vector<std::pair<CSSPropertyID, String> >& knownExpressions) 2700 2719 { 2701 std::pair<CSSPropertyID, String> expression(id, value->serializeResolvingVariables(*m_state.style ->variables()));2720 std::pair<CSSPropertyID, String> expression(id, value->serializeResolvingVariables(*m_state.style()->variables())); 2702 2721 2703 2722 if (knownExpressions.contains(expression)) … … 2732 2751 2733 2752 State& state = m_state; 2734 bool isInherit = state.parentNode && value->isInheritedValue();2735 bool isInitial = value->isInitialValue() || (!state.parentNode && value->isInheritedValue());2753 bool isInherit = state.parentNode() && value->isInheritedValue(); 2754 bool isInitial = value->isInitialValue() || (!state.parentNode() && value->isInheritedValue()); 2736 2755 2737 2756 ASSERT(!isInherit || !isInitial); // isInherit -> !isInitial && isInitial -> !isInherit 2738 ASSERT(!isInherit || (state.parentNode && state.parentStyle)); // isInherit -> (state.parentNode && state.parentStyle)2739 2740 if (!state.applyPropertyToRegularStyle && (!state.applyPropertyToVisitedLinkStyle|| !isValidVisitedLinkProperty(id))) {2757 ASSERT(!isInherit || (state.parentNode() && state.parentStyle())); // isInherit -> (state.parentNode() && state.parentStyle()) 2758 2759 if (!state.applyPropertyToRegularStyle() && (!state.applyPropertyToVisitedLinkStyle() || !isValidVisitedLinkProperty(id))) { 2741 2760 // Limit the properties that can be applied to only the ones honored by :visited. 2742 2761 return; 2743 2762 } 2744 2763 2745 if (isInherit && !state.parentStyle ->hasExplicitlyInheritedProperties() && !CSSProperty::isInheritedProperty(id))2746 state.parentStyle ->setHasExplicitlyInheritedProperties();2764 if (isInherit && !state.parentStyle()->hasExplicitlyInheritedProperties() && !CSSProperty::isInheritedProperty(id)) 2765 state.parentStyle()->setHasExplicitlyInheritedProperties(); 2747 2766 2748 2767 #if ENABLE(CSS_VARIABLES) … … 2752 2771 ASSERT(!variable->name().isEmpty()); 2753 2772 ASSERT(!variable->value().isEmpty()); 2754 state.style ->setVariable(variable->name(), variable->value());2773 state.style()->setVariable(variable->name(), variable->value()); 2755 2774 return; 2756 2775 } … … 2771 2790 CSSPrimitiveValue* primitiveValue = value->isPrimitiveValue() ? static_cast<CSSPrimitiveValue*>(value) : 0; 2772 2791 2773 float zoomFactor = state.style ->effectiveZoom();2792 float zoomFactor = state.style()->effectiveZoom(); 2774 2793 2775 2794 // What follows is a list that maps the CSS properties into their corresponding front-end … … 2785 2804 2786 2805 if (isInitial) { 2787 state.style ->clearContent();2806 state.style()->clearContent(); 2788 2807 return; 2789 2808 } … … 2797 2816 if (item->isImageGeneratorValue()) { 2798 2817 if (item->isGradientValue()) 2799 state.style ->setContent(StyleGeneratedImage::create(static_cast<CSSGradientValue*>(item)->gradientWithStylesResolved(this).get()), didSet);2818 state.style()->setContent(StyleGeneratedImage::create(static_cast<CSSGradientValue*>(item)->gradientWithStylesResolved(this).get()), didSet); 2800 2819 else 2801 state.style ->setContent(StyleGeneratedImage::create(static_cast<CSSImageGeneratorValue*>(item)), didSet);2820 state.style()->setContent(StyleGeneratedImage::create(static_cast<CSSImageGeneratorValue*>(item)), didSet); 2802 2821 didSet = true; 2803 2822 #if ENABLE(CSS_IMAGE_SET) 2804 2823 } else if (item->isImageSetValue()) { 2805 state.style ->setContent(setOrPendingFromValue(CSSPropertyContent, static_cast<CSSImageSetValue*>(item)), didSet);2824 state.style()->setContent(setOrPendingFromValue(CSSPropertyContent, static_cast<CSSImageSetValue*>(item)), didSet); 2806 2825 didSet = true; 2807 2826 #endif … … 2809 2828 2810 2829 if (item->isImageValue()) { 2811 state.style ->setContent(cachedOrPendingFromValue(CSSPropertyContent, static_cast<CSSImageValue*>(item)), didSet);2830 state.style()->setContent(cachedOrPendingFromValue(CSSPropertyContent, static_cast<CSSImageValue*>(item)), didSet); 2812 2831 didSet = true; 2813 2832 continue; … … 2820 2839 2821 2840 if (contentValue->isString()) { 2822 state.style ->setContent(contentValue->getStringValue().impl(), didSet);2841 state.style()->setContent(contentValue->getStringValue().impl(), didSet); 2823 2842 didSet = true; 2824 2843 } else if (contentValue->isAttr()) { 2825 2844 // FIXME: Can a namespace be specified for an attr(foo)? 2826 if (state.style ->styleType() == NOPSEUDO)2827 state.style ->setUnique();2845 if (state.style()->styleType() == NOPSEUDO) 2846 state.style()->setUnique(); 2828 2847 else 2829 state.parentStyle ->setUnique();2848 state.parentStyle()->setUnique(); 2830 2849 QualifiedName attr(nullAtom, contentValue->getStringValue().impl(), nullAtom); 2831 const AtomicString& value = state.element ->getAttribute(attr);2832 state.style ->setContent(value.isNull() ? emptyAtom : value.impl(), didSet);2850 const AtomicString& value = state.element()->getAttribute(attr); 2851 state.style()->setContent(value.isNull() ? emptyAtom : value.impl(), didSet); 2833 2852 didSet = true; 2834 2853 // register the fact that the attribute value affects the style … … 2841 2860 listStyleType = static_cast<EListStyleType>(listStyleIdent - CSSValueDisc); 2842 2861 OwnPtr<CounterContent> counter = adoptPtr(new CounterContent(counterValue->identifier(), listStyleType, counterValue->separator())); 2843 state.style ->setContent(counter.release(), didSet);2862 state.style()->setContent(counter.release(), didSet); 2844 2863 didSet = true; 2845 2864 } else { 2846 2865 switch (contentValue->getIdent()) { 2847 2866 case CSSValueOpenQuote: 2848 state.style ->setContent(OPEN_QUOTE, didSet);2867 state.style()->setContent(OPEN_QUOTE, didSet); 2849 2868 didSet = true; 2850 2869 break; 2851 2870 case CSSValueCloseQuote: 2852 state.style ->setContent(CLOSE_QUOTE, didSet);2871 state.style()->setContent(CLOSE_QUOTE, didSet); 2853 2872 didSet = true; 2854 2873 break; 2855 2874 case CSSValueNoOpenQuote: 2856 state.style ->setContent(NO_OPEN_QUOTE, didSet);2875 state.style()->setContent(NO_OPEN_QUOTE, didSet); 2857 2876 didSet = true; 2858 2877 break; 2859 2878 case CSSValueNoCloseQuote: 2860 state.style ->setContent(NO_CLOSE_QUOTE, didSet);2879 state.style()->setContent(NO_CLOSE_QUOTE, didSet); 2861 2880 didSet = true; 2862 2881 break; … … 2868 2887 } 2869 2888 if (!didSet) 2870 state.style ->clearContent();2889 state.style()->clearContent(); 2871 2890 return; 2872 2891 } 2873 2892 case CSSPropertyQuotes: 2874 2893 if (isInherit) { 2875 state.style ->setQuotes(state.parentStyle->quotes());2894 state.style()->setQuotes(state.parentStyle()->quotes()); 2876 2895 return; 2877 2896 } 2878 2897 if (isInitial) { 2879 state.style ->setQuotes(0);2898 state.style()->setQuotes(0); 2880 2899 return; 2881 2900 } … … 2895 2914 quotes->addPair(std::make_pair(startQuote, endQuote)); 2896 2915 } 2897 state.style ->setQuotes(quotes);2916 state.style()->setQuotes(quotes); 2898 2917 return; 2899 2918 } 2900 2919 if (primitiveValue) { 2901 2920 if (primitiveValue->getIdent() == CSSValueNone) 2902 state.style ->setQuotes(QuotesData::create());2921 state.style()->setQuotes(QuotesData::create()); 2903 2922 } 2904 2923 return; … … 2906 2925 // list of strings and ids 2907 2926 if (isInherit) { 2908 FontDescription parentFontDescription = state.parentStyle ->fontDescription();2909 FontDescription fontDescription = state.style ->fontDescription();2927 FontDescription parentFontDescription = state.parentStyle()->fontDescription(); 2928 FontDescription fontDescription = state.style()->fontDescription(); 2910 2929 fontDescription.setGenericFamily(parentFontDescription.genericFamily()); 2911 2930 fontDescription.setFamily(parentFontDescription.firstFamily()); … … 2917 2936 if (isInitial) { 2918 2937 FontDescription initialDesc = FontDescription(); 2919 FontDescription fontDescription = state.style ->fontDescription();2938 FontDescription fontDescription = state.style()->fontDescription(); 2920 2939 // We need to adjust the size to account for the generic family change from monospace 2921 2940 // to non-monospace. … … 2931 2950 if (!value->isValueList()) 2932 2951 return; 2933 FontDescription fontDescription = state.style ->fontDescription();2952 FontDescription fontDescription = state.style()->fontDescription(); 2934 2953 FontFamily& firstFamily = fontDescription.firstFamily(); 2935 2954 FontFamily* currFamily = 0; … … 3009 3028 case CSSPropertyBackground: 3010 3029 if (isInitial) { 3011 state.style ->clearBackgroundLayers();3012 state.style ->setBackgroundColor(Color());3030 state.style()->clearBackgroundLayers(); 3031 state.style()->setBackgroundColor(Color()); 3013 3032 } else if (isInherit) { 3014 state.style ->inheritBackgroundLayers(*state.parentStyle->backgroundLayers());3015 state.style ->setBackgroundColor(state.parentStyle->backgroundColor());3033 state.style()->inheritBackgroundLayers(*state.parentStyle()->backgroundLayers()); 3034 state.style()->setBackgroundColor(state.parentStyle()->backgroundColor()); 3016 3035 } 3017 3036 return; 3018 3037 case CSSPropertyWebkitMask: 3019 3038 if (isInitial) 3020 state.style ->clearMaskLayers();3039 state.style()->clearMaskLayers(); 3021 3040 else if (isInherit) 3022 state.style ->inheritMaskLayers(*state.parentStyle->maskLayers());3041 state.style()->inheritMaskLayers(*state.parentStyle()->maskLayers()); 3023 3042 return; 3024 3043 case CSSPropertyFont: 3025 3044 if (isInherit) { 3026 FontDescription fontDescription = state.parentStyle ->fontDescription();3027 state.style ->setLineHeight(state.parentStyle->specifiedLineHeight());3028 state. lineHeightValue = 0;3045 FontDescription fontDescription = state.parentStyle()->fontDescription(); 3046 state.style()->setLineHeight(state.parentStyle()->specifiedLineHeight()); 3047 state.setLineHeightValue(0); 3029 3048 setFontDescription(fontDescription); 3030 3049 } else if (isInitial) { … … 3035 3054 initializeFontStyle(settings); 3036 3055 } else if (primitiveValue) { 3037 state.style ->setLineHeight(RenderStyle::initialLineHeight());3038 state. lineHeightValue = 0;3056 state.style()->setLineHeight(RenderStyle::initialLineHeight()); 3057 state.setLineHeightValue(0); 3039 3058 3040 3059 FontDescription fontDescription; … … 3052 3071 3053 3072 // Handle the zoom factor. 3054 fontDescription.setComputedSize(getComputedSizeFromSpecifiedSize(document(), state.style .get(), fontDescription.isAbsoluteSize(), fontDescription.specifiedSize(), useSVGZoomRules()));3073 fontDescription.setComputedSize(getComputedSizeFromSpecifiedSize(document(), state.style(), fontDescription.isAbsoluteSize(), fontDescription.specifiedSize(), useSVGZoomRules())); 3055 3074 setFontDescription(fontDescription); 3056 3075 } … … 3070 3089 applyProperty(CSSPropertyFontSize, font->size.get()); 3071 3090 3072 state. lineHeightValue = font->lineHeight.get();3091 state.setLineHeightValue(font->lineHeight.get()); 3073 3092 3074 3093 applyProperty(CSSPropertyFontFamily, font->family.get()); … … 3082 3101 if (isInherit) { 3083 3102 if (id == CSSPropertyTextShadow) 3084 return state.style ->setTextShadow(state.parentStyle->textShadow() ? adoptPtr(new ShadowData(*state.parentStyle->textShadow())) : nullptr);3085 return state.style ->setBoxShadow(state.parentStyle->boxShadow() ? adoptPtr(new ShadowData(*state.parentStyle->boxShadow())) : nullptr);3103 return state.style()->setTextShadow(state.parentStyle()->textShadow() ? adoptPtr(new ShadowData(*state.parentStyle()->textShadow())) : nullptr); 3104 return state.style()->setBoxShadow(state.parentStyle()->boxShadow() ? adoptPtr(new ShadowData(*state.parentStyle()->boxShadow())) : nullptr); 3086 3105 } 3087 3106 if (isInitial || primitiveValue) // initial | none 3088 return id == CSSPropertyTextShadow ? state.style ->setTextShadow(nullptr) : state.style->setBoxShadow(nullptr);3107 return id == CSSPropertyTextShadow ? state.style()->setTextShadow(nullptr) : state.style()->setBoxShadow(nullptr); 3089 3108 3090 3109 if (!value->isValueList()) … … 3096 3115 continue; 3097 3116 ShadowValue* item = static_cast<ShadowValue*>(currValue); 3098 int x = item->x->computeLength<int>(state.style .get(), state.rootElementStyle, zoomFactor);3099 int y = item->y->computeLength<int>(state.style .get(), state.rootElementStyle, zoomFactor);3100 int blur = item->blur ? item->blur->computeLength<int>(state.style .get(), state.rootElementStyle, zoomFactor) : 0;3101 int spread = item->spread ? item->spread->computeLength<int>(state.style .get(), state.rootElementStyle, zoomFactor) : 0;3117 int x = item->x->computeLength<int>(state.style(), state.rootElementStyle(), zoomFactor); 3118 int y = item->y->computeLength<int>(state.style(), state.rootElementStyle(), zoomFactor); 3119 int blur = item->blur ? item->blur->computeLength<int>(state.style(), state.rootElementStyle(), zoomFactor) : 0; 3120 int spread = item->spread ? item->spread->computeLength<int>(state.style(), state.rootElementStyle(), zoomFactor) : 0; 3102 3121 ShadowStyle shadowStyle = item->style && item->style->getIdent() == CSSValueInset ? Inset : Normal; 3103 3122 Color color; 3104 3123 if (item->color) 3105 3124 color = colorFromPrimitiveValue(item->color.get()); 3106 else if (state.style )3107 color = state.style ->color();3125 else if (state.style()) 3126 color = state.style()->color(); 3108 3127 3109 3128 OwnPtr<ShadowData> shadowData = adoptPtr(new ShadowData(IntPoint(x, y), blur, spread, shadowStyle, id == CSSPropertyWebkitBoxShadow, color.isValid() ? color : Color::transparent)); 3110 3129 if (id == CSSPropertyTextShadow) 3111 state.style ->setTextShadow(shadowData.release(), i.index()); // add to the list if this is not the first entry3130 state.style()->setTextShadow(shadowData.release(), i.index()); // add to the list if this is not the first entry 3112 3131 else 3113 state.style ->setBoxShadow(shadowData.release(), i.index()); // add to the list if this is not the first entry3132 state.style()->setBoxShadow(shadowData.release(), i.index()); // add to the list if this is not the first entry 3114 3133 } 3115 3134 return; … … 3118 3137 HANDLE_INHERIT_AND_INITIAL(boxReflect, BoxReflect) 3119 3138 if (primitiveValue) { 3120 state.style ->setBoxReflect(RenderStyle::initialBoxReflect());3139 state.style()->setBoxReflect(RenderStyle::initialBoxReflect()); 3121 3140 return; 3122 3141 } … … 3129 3148 reflection->setDirection(*reflectValue->direction()); 3130 3149 if (reflectValue->offset()) 3131 reflection->setOffset(reflectValue->offset()->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion>(state.style .get(), state.rootElementStyle, zoomFactor));3150 reflection->setOffset(reflectValue->offset()->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion>(state.style(), state.rootElementStyle(), zoomFactor)); 3132 3151 NinePieceImage mask; 3133 3152 mask.setMaskDefaults(); … … 3135 3154 reflection->setMask(mask); 3136 3155 3137 state.style ->setBoxReflect(reflection.release());3156 state.style()->setBoxReflect(reflection.release()); 3138 3157 return; 3139 3158 } … … 3144 3163 case CSSPropertyWebkitColumnRule: 3145 3164 if (isInherit) { 3146 state.style ->setColumnRuleColor(state.parentStyle->columnRuleColor().isValid() ? state.parentStyle->columnRuleColor() : state.parentStyle->color());3147 state.style ->setColumnRuleStyle(state.parentStyle->columnRuleStyle());3148 state.style ->setColumnRuleWidth(state.parentStyle->columnRuleWidth());3165 state.style()->setColumnRuleColor(state.parentStyle()->columnRuleColor().isValid() ? state.parentStyle()->columnRuleColor() : state.parentStyle()->color()); 3166 state.style()->setColumnRuleStyle(state.parentStyle()->columnRuleStyle()); 3167 state.style()->setColumnRuleWidth(state.parentStyle()->columnRuleWidth()); 3149 3168 } else if (isInitial) 3150 state.style ->resetColumnRule();3169 state.style()->resetColumnRule(); 3151 3170 return; 3152 3171 case CSSPropertyWebkitMarquee: 3153 3172 if (!isInherit) 3154 3173 return; 3155 state.style ->setMarqueeDirection(state.parentStyle->marqueeDirection());3156 state.style ->setMarqueeIncrement(state.parentStyle->marqueeIncrement());3157 state.style ->setMarqueeSpeed(state.parentStyle->marqueeSpeed());3158 state.style ->setMarqueeLoopCount(state.parentStyle->marqueeLoopCount());3159 state.style ->setMarqueeBehavior(state.parentStyle->marqueeBehavior());3174 state.style()->setMarqueeDirection(state.parentStyle()->marqueeDirection()); 3175 state.style()->setMarqueeIncrement(state.parentStyle()->marqueeIncrement()); 3176 state.style()->setMarqueeSpeed(state.parentStyle()->marqueeSpeed()); 3177 state.style()->setMarqueeLoopCount(state.parentStyle()->marqueeLoopCount()); 3178 state.style()->setMarqueeBehavior(state.parentStyle()->marqueeBehavior()); 3160 3179 return; 3161 3180 case CSSPropertyWebkitMarqueeRepetition: { … … 3164 3183 return; 3165 3184 if (primitiveValue->getIdent() == CSSValueInfinite) 3166 state.style ->setMarqueeLoopCount(-1); // -1 means repeat forever.3185 state.style()->setMarqueeLoopCount(-1); // -1 means repeat forever. 3167 3186 else if (primitiveValue->isNumber()) 3168 state.style ->setMarqueeLoopCount(primitiveValue->getIntValue());3187 state.style()->setMarqueeLoopCount(primitiveValue->getIntValue()); 3169 3188 return; 3170 3189 } … … 3176 3195 switch (ident) { 3177 3196 case CSSValueSlow: 3178 state.style ->setMarqueeSpeed(500); // 500 msec.3197 state.style()->setMarqueeSpeed(500); // 500 msec. 3179 3198 break; 3180 3199 case CSSValueNormal: 3181 state.style ->setMarqueeSpeed(85); // 85msec. The WinIE default.3200 state.style()->setMarqueeSpeed(85); // 85msec. The WinIE default. 3182 3201 break; 3183 3202 case CSSValueFast: 3184 state.style ->setMarqueeSpeed(10); // 10msec. Super fast.3203 state.style()->setMarqueeSpeed(10); // 10msec. Super fast. 3185 3204 break; 3186 3205 } 3187 3206 } else if (primitiveValue->isTime()) 3188 state.style ->setMarqueeSpeed(primitiveValue->computeTime<int, CSSPrimitiveValue::Milliseconds>());3207 state.style()->setMarqueeSpeed(primitiveValue->computeTime<int, CSSPrimitiveValue::Milliseconds>()); 3189 3208 else if (primitiveValue->isNumber()) // For scrollamount support. 3190 state.style ->setMarqueeSpeed(primitiveValue->getIntValue());3209 state.style()->setMarqueeSpeed(primitiveValue->getIntValue()); 3191 3210 return; 3192 3211 } … … 3198 3217 switch (primitiveValue->getIdent()) { 3199 3218 case CSSValueSmall: 3200 state.style ->setMarqueeIncrement(Length(1, Fixed)); // 1px.3219 state.style()->setMarqueeIncrement(Length(1, Fixed)); // 1px. 3201 3220 break; 3202 3221 case CSSValueNormal: 3203 state.style ->setMarqueeIncrement(Length(6, Fixed)); // 6px. The WinIE default.3222 state.style()->setMarqueeIncrement(Length(6, Fixed)); // 6px. The WinIE default. 3204 3223 break; 3205 3224 case CSSValueLarge: 3206 state.style ->setMarqueeIncrement(Length(36, Fixed)); // 36px.3225 state.style()->setMarqueeIncrement(Length(36, Fixed)); // 36px. 3207 3226 break; 3208 3227 } 3209 3228 } else { 3210 Length marqueeLength = convertToIntLength(primitiveValue, state.style .get(), state.rootElementStyle);3229 Length marqueeLength = convertToIntLength(primitiveValue, state.style(), state.rootElementStyle()); 3211 3230 if (!marqueeLength.isUndefined()) 3212 state.style ->setMarqueeIncrement(marqueeLength);3231 state.style()->setMarqueeIncrement(marqueeLength); 3213 3232 } 3214 3233 return; … … 3219 3238 return; 3220 3239 if (primitiveValue->getIdent() == CSSValueAuto) 3221 state.style ->setLocale(nullAtom);3240 state.style()->setLocale(nullAtom); 3222 3241 else 3223 state.style ->setLocale(primitiveValue->getStringValue());3224 FontDescription fontDescription = state.style ->fontDescription();3225 fontDescription.setScript(localeToScriptCodeForFontSelection(state.style ->locale()));3242 state.style()->setLocale(primitiveValue->getStringValue()); 3243 FontDescription fontDescription = state.style()->fontDescription(); 3244 fontDescription.setScript(localeToScriptCodeForFontSelection(state.style()->locale())); 3226 3245 setFontDescription(fontDescription); 3227 3246 return; … … 3242 3261 3243 3262 if (primitiveValue->getIdent() == CSSValueNone) { 3244 state.style ->setDashboardRegions(RenderStyle::noneDashboardRegions());3263 state.style()->setDashboardRegions(RenderStyle::noneDashboardRegions()); 3245 3264 return; 3246 3265 } … … 3252 3271 DashboardRegion* first = region; 3253 3272 while (region) { 3254 Length top = convertToIntLength(region->top(), state.style .get(), state.rootElementStyle);3255 Length right = convertToIntLength(region->right(), state.style .get(), state.rootElementStyle);3256 Length bottom = convertToIntLength(region->bottom(), state.style .get(), state.rootElementStyle);3257 Length left = convertToIntLength(region->left(), state.style .get(), state.rootElementStyle);3273 Length top = convertToIntLength(region->top(), state.style(), state.rootElementStyle()); 3274 Length right = convertToIntLength(region->right(), state.style(), state.rootElementStyle()); 3275 Length bottom = convertToIntLength(region->bottom(), state.style(), state.rootElementStyle()); 3276 Length left = convertToIntLength(region->left(), state.style(), state.rootElementStyle()); 3258 3277 3259 3278 if (top.isUndefined()) … … 3267 3286 3268 3287 if (region->m_isCircle) 3269 state.style ->setDashboardRegion(StyleDashboardRegion::Circle, region->m_label, top, right, bottom, left, region == first ? false : true);3288 state.style()->setDashboardRegion(StyleDashboardRegion::Circle, region->m_label, top, right, bottom, left, region == first ? false : true); 3270 3289 else if (region->m_isRectangle) 3271 state.style ->setDashboardRegion(StyleDashboardRegion::Rectangle, region->m_label, top, right, bottom, left, region == first ? false : true);3290 state.style()->setDashboardRegion(StyleDashboardRegion::Rectangle, region->m_label, top, right, bottom, left, region == first ? false : true); 3272 3291 region = region->m_next.get(); 3273 3292 } 3274 3293 3275 state. element->document()->setHasAnnotatedRegions(true);3294 state.document()->setHasAnnotatedRegions(true); 3276 3295 3277 3296 return; … … 3282 3301 if (!primitiveValue || !primitiveValue->getIdent()) 3283 3302 return; 3284 state.style ->setDraggableRegionMode(primitiveValue->getIdent() == CSSValueDrag ? DraggableRegionDrag : DraggableRegionNoDrag);3285 state. element->document()->setHasAnnotatedRegions(true);3303 state.style()->setDraggableRegionMode(primitiveValue->getIdent() == CSSValueDrag ? DraggableRegionDrag : DraggableRegionNoDrag); 3304 state.document()->setHasAnnotatedRegions(true); 3286 3305 return; 3287 3306 } … … 3299 3318 else if (primitiveValue->getIdent() == CSSValueThick) 3300 3319 result *= 5; 3301 width = CSSPrimitiveValue::create(result, CSSPrimitiveValue::CSS_EMS)->computeLength<float>(state.style .get(), state.rootElementStyle, zoomFactor);3320 width = CSSPrimitiveValue::create(result, CSSPrimitiveValue::CSS_EMS)->computeLength<float>(state.style(), state.rootElementStyle(), zoomFactor); 3302 3321 break; 3303 3322 } 3304 3323 default: 3305 width = primitiveValue->computeLength<float>(state.style .get(), state.rootElementStyle, zoomFactor);3324 width = primitiveValue->computeLength<float>(state.style(), state.rootElementStyle(), zoomFactor); 3306 3325 break; 3307 3326 } 3308 state.style ->setTextStrokeWidth(width);3327 state.style()->setTextStrokeWidth(width); 3309 3328 return; 3310 3329 } … … 3312 3331 HANDLE_INHERIT_AND_INITIAL(transform, Transform); 3313 3332 TransformOperations operations; 3314 createTransformOperations(value, state.style .get(), state.rootElementStyle, operations);3315 state.style ->setTransform(operations);3333 createTransformOperations(value, state.style(), state.rootElementStyle(), operations); 3334 state.style()->setTransform(operations); 3316 3335 return; 3317 3336 } … … 3323 3342 3324 3343 if (primitiveValue->getIdent() == CSSValueNone) { 3325 state.style ->setPerspective(0);3344 state.style()->setPerspective(0); 3326 3345 return; 3327 3346 } … … 3329 3348 float perspectiveValue; 3330 3349 if (primitiveValue->isLength()) 3331 perspectiveValue = primitiveValue->computeLength<float>(state.style .get(), state.rootElementStyle, zoomFactor);3350 perspectiveValue = primitiveValue->computeLength<float>(state.style(), state.rootElementStyle(), zoomFactor); 3332 3351 else if (primitiveValue->isNumber()) { 3333 3352 // For backward compatibility, treat valueless numbers as px. 3334 perspectiveValue = CSSPrimitiveValue::create(primitiveValue->getDoubleValue(), CSSPrimitiveValue::CSS_PX)->computeLength<float>(state.style .get(), state.rootElementStyle, zoomFactor);3353 perspectiveValue = CSSPrimitiveValue::create(primitiveValue->getDoubleValue(), CSSPrimitiveValue::CSS_PX)->computeLength<float>(state.style(), state.rootElementStyle(), zoomFactor); 3335 3354 } else 3336 3355 return; 3337 3356 3338 3357 if (perspectiveValue >= 0.0f) 3339 state.style ->setPerspective(perspectiveValue);3358 state.style()->setPerspective(perspectiveValue); 3340 3359 return; 3341 3360 } 3342 3361 case CSSPropertyWebkitAnimation: 3343 3362 if (isInitial) 3344 state.style ->clearAnimations();3363 state.style()->clearAnimations(); 3345 3364 else if (isInherit) 3346 state.style ->inheritAnimations(state.parentStyle->animations());3365 state.style()->inheritAnimations(state.parentStyle()->animations()); 3347 3366 return; 3348 3367 case CSSPropertyWebkitTransition: 3349 3368 if (isInitial) 3350 state.style ->clearTransitions();3369 state.style()->clearTransitions(); 3351 3370 else if (isInherit) 3352 state.style ->inheritTransitions(state.parentStyle->transitions());3371 state.style()->inheritTransitions(state.parentStyle()->transitions()); 3353 3372 return; 3354 3373 #if ENABLE(TOUCH_EVENTS) … … 3359 3378 3360 3379 Color col = colorFromPrimitiveValue(primitiveValue); 3361 state.style ->setTapHighlightColor(col);3380 state.style()->setTapHighlightColor(col); 3362 3381 return; 3363 3382 } … … 3368 3387 if (!primitiveValue) 3369 3388 break; 3370 state.style ->setUseTouchOverflowScrolling(primitiveValue->getIdent() == CSSValueTouch);3389 state.style()->setUseTouchOverflowScrolling(primitiveValue->getIdent() == CSSValueTouch); 3371 3390 return; 3372 3391 } … … 3411 3430 case CSSPropertyWebkitMaxLogicalHeight: 3412 3431 { 3413 CSSPropertyID newId = CSSProperty::resolveDirectionAwareProperty(id, state.style ->direction(), state.style->writingMode());3432 CSSPropertyID newId = CSSProperty::resolveDirectionAwareProperty(id, state.style()->direction(), state.style()->writingMode()); 3414 3433 ASSERT(newId != id); 3415 3434 return applyProperty(newId, value); … … 3446 3465 3447 3466 // FIXME: It is not ok to modify document state while applying style. 3448 if (state.element && state.element == state.element->document()->documentElement())3449 state. element->document()->setWritingModeSetOnDocumentElement(true);3467 if (state.element() && state.element() == state.document()->documentElement()) 3468 state.document()->setWritingModeSetOnDocumentElement(true); 3450 3469 return; 3451 3470 } … … 3463 3482 HANDLE_INHERIT_AND_INITIAL(lineBoxContain, LineBoxContain) 3464 3483 if (primitiveValue && primitiveValue->getIdent() == CSSValueNone) { 3465 state.style ->setLineBoxContain(LineBoxContainNone);3484 state.style()->setLineBoxContain(LineBoxContainNone); 3466 3485 return; 3467 3486 } … … 3471 3490 3472 3491 CSSLineBoxContainValue* lineBoxContainValue = static_cast<CSSLineBoxContainValue*>(value); 3473 state.style ->setLineBoxContain(lineBoxContainValue->value());3492 state.style()->setLineBoxContain(lineBoxContainValue->value()); 3474 3493 return; 3475 3494 } … … 3478 3497 case CSSPropertyWebkitFontFeatureSettings: { 3479 3498 if (primitiveValue && primitiveValue->getIdent() == CSSValueNormal) { 3480 setFontDescription(state.style ->fontDescription().makeNormalFeatureSettings());3499 setFontDescription(state.style()->fontDescription().makeNormalFeatureSettings()); 3481 3500 return; 3482 3501 } … … 3485 3504 return; 3486 3505 3487 FontDescription fontDescription = state.style ->fontDescription();3506 FontDescription fontDescription = state.style()->fontDescription(); 3488 3507 CSSValueList* list = static_cast<CSSValueList*>(value); 3489 3508 RefPtr<FontFeatureSettings> settings = FontFeatureSettings::create(); … … 3505 3524 HANDLE_INHERIT_AND_INITIAL(filter, Filter); 3506 3525 FilterOperations operations; 3507 if (createFilterOperations(value, state.style .get(), state.rootElementStyle, operations))3508 state.style ->setFilter(operations);3526 if (createFilterOperations(value, state.style(), state.rootElementStyle(), operations)) 3527 state.style()->setFilter(operations); 3509 3528 return; 3510 3529 } … … 3514 3533 if (!createGridTrackList(value, trackSizes, state)) 3515 3534 return; 3516 state.style ->setGridColumns(trackSizes);3535 state.style()->setGridColumns(trackSizes); 3517 3536 return; 3518 3537 } … … 3521 3540 if (!createGridTrackList(value, trackSizes, state)) 3522 3541 return; 3523 state.style ->setGridRows(trackSizes);3542 state.style()->setGridRows(trackSizes); 3524 3543 return; 3525 3544 } … … 3529 3548 if (!createGridPosition(value, column)) 3530 3549 return; 3531 state.style ->setGridItemColumn(column);3550 state.style()->setGridItemColumn(column); 3532 3551 return; 3533 3552 } … … 3536 3555 if (!createGridPosition(value, row)) 3537 3556 return; 3538 state.style ->setGridItemRow(row);3557 state.style()->setGridItemRow(row); 3539 3558 return; 3540 3559 } … … 3858 3877 RefPtr<StyleImage> image = value->cachedOrPendingImage(); 3859 3878 if (image && image->isPendingImage()) 3860 m_state.pendingImageProperties .set(property, value);3879 m_state.pendingImageProperties().set(property, value); 3861 3880 return image.release(); 3862 3881 } … … 3865 3884 { 3866 3885 if (value->isPending()) { 3867 m_state.pendingImageProperties .set(property, value);3886 m_state.pendingImageProperties().set(property, value); 3868 3887 return StylePendingImage::create(value); 3869 3888 } … … 3876 3895 RefPtr<StyleImage> image = value->cachedOrPendingImageSet(document()); 3877 3896 if (image && image->isPendingImage()) 3878 m_state.pendingImageProperties .set(property, value);3897 m_state.pendingImageProperties().set(property, value); 3879 3898 return image.release(); 3880 3899 } … … 3885 3904 RefPtr<StyleImage> image = value->cachedOrPendingImage(document()); 3886 3905 if (image && image->isPendingImage()) 3887 m_state.pendingImageProperties .set(property, value);3906 m_state.pendingImageProperties().set(property, value); 3888 3907 return image.release(); 3889 3908 } … … 3891 3910 void StyleResolver::checkForTextSizeAdjust() 3892 3911 { 3893 RenderStyle* style = m_state.style .get();3912 RenderStyle* style = m_state.style(); 3894 3913 3895 3914 if (style->textSizeAdjust()) … … 3963 3982 fontDescription.setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1); 3964 3983 setFontSize(fontDescription, fontSizeForKeyword(document(), CSSValueMedium, false)); 3965 m_state.style ->setLineHeight(RenderStyle::initialLineHeight());3966 m_state. lineHeightValue = 0;3984 m_state.style()->setLineHeight(RenderStyle::initialLineHeight()); 3985 m_state.setLineHeightValue(0); 3967 3986 setFontDescription(fontDescription); 3968 3987 } … … 3971 3990 { 3972 3991 fontDescription.setSpecifiedSize(size); 3973 fontDescription.setComputedSize(getComputedSizeFromSpecifiedSize(document(), m_state.style .get(), fontDescription.isAbsoluteSize(), size, useSVGZoomRules()));3992 fontDescription.setComputedSize(getComputedSizeFromSpecifiedSize(document(), m_state.style(), fontDescription.isAbsoluteSize(), size, useSVGZoomRules())); 3974 3993 } 3975 3994 … … 4180 4199 return Color(); 4181 4200 case CSSValueWebkitText: 4182 return state. element->document()->textColor();4201 return state.document()->textColor(); 4183 4202 case CSSValueWebkitLink: 4184 return (state.element ->isLink() && forVisitedLink) ? state.element->document()->visitedLinkColor() : state.element->document()->linkColor();4203 return (state.element()->isLink() && forVisitedLink) ? state.document()->visitedLinkColor() : state.document()->linkColor(); 4185 4204 case CSSValueWebkitActivelink: 4186 return state. element->document()->activeLinkColor();4205 return state.document()->activeLinkColor(); 4187 4206 case CSSValueWebkitFocusRingColor: 4188 4207 return RenderTheme::focusRingColor(); 4189 4208 case CSSValueCurrentcolor: 4190 return state.style ->color();4209 return state.style()->color(); 4191 4210 default: 4192 4211 return colorForCSSValue(ident); … … 4523 4542 { 4524 4543 State& state = m_state; 4525 if (!state.style ->hasFilter() || state.pendingSVGDocuments.isEmpty())4526 return; 4527 4528 CachedResourceLoader* cachedResourceLoader = state. element->document()->cachedResourceLoader();4529 Vector<RefPtr<FilterOperation> >& filterOperations = state.style ->mutableFilter().operations();4544 if (!state.style()->hasFilter() || state.pendingSVGDocuments().isEmpty()) 4545 return; 4546 4547 CachedResourceLoader* cachedResourceLoader = state.document()->cachedResourceLoader(); 4548 Vector<RefPtr<FilterOperation> >& filterOperations = state.style()->mutableFilter().operations(); 4530 4549 for (unsigned i = 0; i < filterOperations.size(); ++i) { 4531 4550 RefPtr<FilterOperation> filterOperation = filterOperations.at(i); … … 4533 4552 ReferenceFilterOperation* referenceFilter = static_cast<ReferenceFilterOperation*>(filterOperation.get()); 4534 4553 4535 WebKitCSSSVGDocumentValue* value = state.pendingSVGDocuments .get(referenceFilter).get();4554 WebKitCSSSVGDocumentValue* value = state.pendingSVGDocuments().get(referenceFilter).get(); 4536 4555 if (!value) 4537 4556 continue; … … 4544 4563 } 4545 4564 } 4546 state.pendingSVGDocuments .clear();4565 state.pendingSVGDocuments().clear(); 4547 4566 } 4548 4567 #endif … … 4560 4579 StyleShader* shader = value->cachedOrPendingShader(); 4561 4580 if (shader && shader->isPendingShader()) 4562 m_state. hasPendingShaders = true;4581 m_state.setHasPendingShaders(true); 4563 4582 return shader; 4564 4583 } … … 4566 4585 void StyleResolver::loadPendingShaders() 4567 4586 { 4568 if (!m_state.style ->hasFilter() || !m_state.hasPendingShaders)4569 return; 4570 4571 CachedResourceLoader* cachedResourceLoader = m_state. element->document()->cachedResourceLoader();4572 4573 Vector<RefPtr<FilterOperation> >& filterOperations = m_state.style ->mutableFilter().operations();4587 if (!m_state.style()->hasFilter() || !m_state.hasPendingShaders()) 4588 return; 4589 4590 CachedResourceLoader* cachedResourceLoader = m_state.document()->cachedResourceLoader(); 4591 4592 Vector<RefPtr<FilterOperation> >& filterOperations = m_state.style()->mutableFilter().operations(); 4574 4593 for (unsigned i = 0; i < filterOperations.size(); ++i) { 4575 4594 RefPtr<FilterOperation> filterOperation = filterOperations.at(i); … … 4588 4607 } 4589 4608 } 4590 m_state. hasPendingShaders = false;4609 m_state.setHasPendingShaders(false); 4591 4610 } 4592 4611 … … 4630 4649 RefPtr<CustomFilterTransformParameter> transformParameter = CustomFilterTransformParameter::create(name); 4631 4650 TransformOperations operations; 4632 createTransformOperations(values, m_state.style .get(), m_state.rootElementStyle, operations);4651 createTransformOperations(values, m_state.style(), m_state.rootElementStyle(), operations); 4633 4652 transformParameter->setOperations(operations); 4634 4653 return transformParameter.release(); … … 4880 4899 4881 4900 WebKitCSSSVGDocumentValue* svgDocumentValue = static_cast<WebKitCSSSVGDocumentValue*>(argument); 4882 KURL url = m_state. element->document()->completeURL(svgDocumentValue->url());4901 KURL url = m_state.document()->completeURL(svgDocumentValue->url()); 4883 4902 4884 4903 RefPtr<ReferenceFilterOperation> operation = ReferenceFilterOperation::create(svgDocumentValue->url(), url.fragmentIdentifier(), operationType); 4885 if (SVGURIReference::isExternalURIReference(svgDocumentValue->url(), m_state. element->document())) {4904 if (SVGURIReference::isExternalURIReference(svgDocumentValue->url(), m_state.document())) { 4886 4905 if (!svgDocumentValue->loadRequested()) 4887 m_state.pendingSVGDocuments .set(operation.get(), svgDocumentValue);4906 m_state.pendingSVGDocuments().set(operation.get(), svgDocumentValue); 4888 4907 else if (svgDocumentValue->cachedSVGDocument()) 4889 4908 operation->setCachedSVGDocumentReference(adoptPtr(new CachedSVGDocumentReference(svgDocumentValue->cachedSVGDocument()))); … … 4989 5008 PassRefPtr<StyleImage> StyleResolver::loadPendingImage(StylePendingImage* pendingImage) 4990 5009 { 4991 CachedResourceLoader* cachedResourceLoader = m_state. element->document()->cachedResourceLoader();5010 CachedResourceLoader* cachedResourceLoader = m_state.document()->cachedResourceLoader(); 4992 5011 4993 5012 if (pendingImage->cssImageValue()) { … … 5019 5038 void StyleResolver::loadPendingImages() 5020 5039 { 5021 if (m_state.pendingImageProperties .isEmpty())5022 return; 5023 5024 PendingImagePropertyMap::const_iterator::Keys end = m_state.pendingImageProperties .end().keys();5025 for (PendingImagePropertyMap::const_iterator::Keys it = m_state.pendingImageProperties .begin().keys(); it != end; ++it) {5040 if (m_state.pendingImageProperties().isEmpty()) 5041 return; 5042 5043 PendingImagePropertyMap::const_iterator::Keys end = m_state.pendingImageProperties().end().keys(); 5044 for (PendingImagePropertyMap::const_iterator::Keys it = m_state.pendingImageProperties().begin().keys(); it != end; ++it) { 5026 5045 CSSPropertyID currentProperty = *it; 5027 5046 5028 5047 switch (currentProperty) { 5029 5048 case CSSPropertyBackgroundImage: { 5030 for (FillLayer* backgroundLayer = m_state.style ->accessBackgroundLayers(); backgroundLayer; backgroundLayer = backgroundLayer->next()) {5049 for (FillLayer* backgroundLayer = m_state.style()->accessBackgroundLayers(); backgroundLayer; backgroundLayer = backgroundLayer->next()) { 5031 5050 if (backgroundLayer->image() && backgroundLayer->image()->isPendingImage()) 5032 5051 backgroundLayer->setImage(loadPendingImage(static_cast<StylePendingImage*>(backgroundLayer->image()))); … … 5035 5054 } 5036 5055 case CSSPropertyContent: { 5037 for (ContentData* contentData = const_cast<ContentData*>(m_state.style ->contentData()); contentData; contentData = contentData->next()) {5056 for (ContentData* contentData = const_cast<ContentData*>(m_state.style()->contentData()); contentData; contentData = contentData->next()) { 5038 5057 if (contentData->isImage()) { 5039 5058 StyleImage* image = static_cast<ImageContentData*>(contentData)->image(); … … 5048 5067 } 5049 5068 case CSSPropertyCursor: { 5050 if (CursorList* cursorList = m_state.style ->cursors()) {5069 if (CursorList* cursorList = m_state.style()->cursors()) { 5051 5070 for (size_t i = 0; i < cursorList->size(); ++i) { 5052 5071 CursorData& currentCursor = cursorList->at(i); … … 5060 5079 } 5061 5080 case CSSPropertyListStyleImage: { 5062 if (m_state.style ->listStyleImage() && m_state.style->listStyleImage()->isPendingImage())5063 m_state.style ->setListStyleImage(loadPendingImage(static_cast<StylePendingImage*>(m_state.style->listStyleImage())));5081 if (m_state.style()->listStyleImage() && m_state.style()->listStyleImage()->isPendingImage()) 5082 m_state.style()->setListStyleImage(loadPendingImage(static_cast<StylePendingImage*>(m_state.style()->listStyleImage()))); 5064 5083 break; 5065 5084 } 5066 5085 case CSSPropertyBorderImageSource: { 5067 if (m_state.style ->borderImageSource() && m_state.style->borderImageSource()->isPendingImage())5068 m_state.style ->setBorderImageSource(loadPendingImage(static_cast<StylePendingImage*>(m_state.style->borderImageSource())));5086 if (m_state.style()->borderImageSource() && m_state.style()->borderImageSource()->isPendingImage()) 5087 m_state.style()->setBorderImageSource(loadPendingImage(static_cast<StylePendingImage*>(m_state.style()->borderImageSource()))); 5069 5088 break; 5070 5089 } 5071 5090 case CSSPropertyWebkitBoxReflect: { 5072 if (StyleReflection* reflection = m_state.style ->boxReflect()) {5091 if (StyleReflection* reflection = m_state.style()->boxReflect()) { 5073 5092 const NinePieceImage& maskImage = reflection->mask(); 5074 5093 if (maskImage.image() && maskImage.image()->isPendingImage()) { … … 5080 5099 } 5081 5100 case CSSPropertyWebkitMaskBoxImageSource: { 5082 if (m_state.style ->maskBoxImageSource() && m_state.style->maskBoxImageSource()->isPendingImage())5083 m_state.style ->setMaskBoxImageSource(loadPendingImage(static_cast<StylePendingImage*>(m_state.style->maskBoxImageSource())));5101 if (m_state.style()->maskBoxImageSource() && m_state.style()->maskBoxImageSource()->isPendingImage()) 5102 m_state.style()->setMaskBoxImageSource(loadPendingImage(static_cast<StylePendingImage*>(m_state.style()->maskBoxImageSource()))); 5084 5103 break; 5085 5104 } 5086 5105 case CSSPropertyWebkitMaskImage: { 5087 for (FillLayer* maskLayer = m_state.style ->accessMaskLayers(); maskLayer; maskLayer = maskLayer->next()) {5106 for (FillLayer* maskLayer = m_state.style()->accessMaskLayers(); maskLayer; maskLayer = maskLayer->next()) { 5088 5107 if (maskLayer->image() && maskLayer->image()->isPendingImage()) 5089 5108 maskLayer->setImage(loadPendingImage(static_cast<StylePendingImage*>(maskLayer->image()))); … … 5096 5115 } 5097 5116 5098 m_state.pendingImageProperties .clear();5117 m_state.pendingImageProperties().clear(); 5099 5118 } 5100 5119 -
trunk/Source/WebCore/css/StyleResolver.h
r142591 r142757 166 166 static PassRefPtr<RenderStyle> styleForDocument(Document*, CSSFontSelector* = 0); 167 167 168 RenderStyle* style() const { return m_state.style .get(); }169 RenderStyle* parentStyle() const { return m_state.parentStyle ; }170 RenderStyle* rootElementStyle() const { return m_state.rootElementStyle ; }171 Element* element() const { return m_state.element; }172 Document* document() const{ return m_document; }168 RenderStyle* style() const { return m_state.style(); } 169 RenderStyle* parentStyle() const { return m_state.parentStyle(); } 170 RenderStyle* rootElementStyle() const { return m_state.rootElementStyle(); } 171 Element* element() { return m_state.element(); } 172 Document* document() { return m_document; } 173 173 StyleScopeResolver* scopeResolver() const { return m_scopeResolver.get(); } 174 const FontDescription& fontDescription() { return style()->fontDescription(); } 175 const FontDescription& parentFontDescription() { return parentStyle()->fontDescription(); } 176 void setFontDescription(const FontDescription& fontDescription) { m_state.fontDirty |= style()->setFontDescription(fontDescription); } 177 void setZoom(float f) { m_state.fontDirty |= style()->setZoom(f); } 178 void setEffectiveZoom(float f) { m_state.fontDirty |= style()->setEffectiveZoom(f); } 179 void setTextSizeAdjust(bool b) { m_state.fontDirty |= style()->setTextSizeAdjust(b); } 180 void setWritingMode(WritingMode writingMode) { m_state.fontDirty |= style()->setWritingMode(writingMode); } 181 void setTextOrientation(TextOrientation textOrientation) { m_state.fontDirty |= style()->setTextOrientation(textOrientation); } 182 bool hasParentNode() const { return m_state.parentNode; } 174 bool hasParentNode() const { return m_state.parentNode(); } 183 175 184 176 // FIXME: It could be better to call m_ruleSets.appendAuthorStyleSheets() directly after we factor StyleRsolver further. … … 208 200 209 201 private: 210 void initForStyleResolve(Element*, RenderStyle* parentStyle = 0, PseudoId = NOPSEUDO);211 202 void initElement(Element*); 212 203 RenderStyle* locateSharedStyle(); … … 315 306 void adjustRenderStyle(RenderStyle* styleToAdjust, RenderStyle* parentStyle, Element*); 316 307 317 void addMatchedRule(const RuleData* rule) { m_state.matchedRules.append(rule); }318 319 308 struct RuleRange { 320 309 RuleRange(int& firstRuleIndex, int& lastRuleIndex): firstRuleIndex(firstRuleIndex), lastRuleIndex(lastRuleIndex) { } … … 388 377 void sortAndTransferMatchedRules(MatchResult&); 389 378 390 bool ruleMatches(const RuleData&, const ContainerNode* scope );379 bool ruleMatches(const RuleData&, const ContainerNode* scope, PseudoId&); 391 380 bool checkRegionSelector(const CSSSelector* regionSelector, Element* regionElement); 392 381 void applyMatchedProperties(const MatchResult&, const Element*); … … 433 422 public: 434 423 State() 435 : element(0)436 , styledElement(0)437 , parentNode(0)438 , parentStyle(0)439 , rootElementStyle(0)440 , regionForStyling(0)441 , sameOriginOnly(false)442 , pseudoStyle(NOPSEUDO)443 , elementLinkState(NotInsideLink)444 , distributedToInsertionPoint(false)445 , elementAffectedByClassRules(false)446 , m ode(SelectorChecker::ResolvingStyle)447 , applyPropertyToRegularStyle(true)448 , applyPropertyToVisitedLinkStyle(false)424 : m_element(0) 425 , m_styledElement(0) 426 , m_parentNode(0) 427 , m_parentStyle(0) 428 , m_rootElementStyle(0) 429 , m_regionForStyling(0) 430 , m_sameOriginOnly(false) 431 , m_pseudoStyle(NOPSEUDO) 432 , m_elementLinkState(NotInsideLink) 433 , m_distributedToInsertionPoint(false) 434 , m_elementAffectedByClassRules(false) 435 , m_mode(SelectorChecker::ResolvingStyle) 436 , m_applyPropertyToRegularStyle(true) 437 , m_applyPropertyToVisitedLinkStyle(false) 449 438 #if ENABLE(CSS_SHADERS) 450 , hasPendingShaders(false) 451 #endif 452 , lineHeightValue(0) 453 , fontDirty(false) 454 , hasUAAppearance(false) 455 , backgroundData(BackgroundFillLayer) { } 439 , m_hasPendingShaders(false) 440 #endif 441 , m_lineHeightValue(0) 442 , m_fontDirty(false) 443 , m_hasUAAppearance(false) 444 , m_backgroundData(BackgroundFillLayer) { } 445 446 public: 447 void initElement(Element*); 448 void initForStyleResolve(Document*, Element*, RenderStyle* parentStyle = 0, PseudoId = NOPSEUDO, RenderRegion* regionForStyling = 0); 449 void clear(); 450 451 Document* document() const { return m_element->document(); } 452 Element* element() const { return m_element; } 453 StyledElement* styledElement() const { return m_styledElement; } 454 void setStyle(PassRefPtr<RenderStyle> style) { m_style = style; } 455 RenderStyle* style() const { return m_style.get(); } 456 PassRefPtr<RenderStyle> takeStyle() { return m_style.release(); } 457 458 StaticCSSRuleList* ensureRuleList(); 459 PassRefPtr<CSSRuleList> takeRuleList() { return m_ruleList.release(); } 460 461 const ContainerNode* parentNode() const { return m_parentNode; } 462 void setParentStyle(RenderStyle* parentStyle) { m_parentStyle = parentStyle; } 463 RenderStyle* parentStyle() const { return m_parentStyle; } 464 RenderStyle* rootElementStyle() const { return m_rootElementStyle; } 465 466 const RenderRegion* regionForStyling() const { return m_regionForStyling; } 467 void setSameOriginOnly(bool isSameOriginOnly) { m_sameOriginOnly = isSameOriginOnly; } 468 bool isSameOriginOnly() const { return m_sameOriginOnly; } 469 PseudoId pseudoStyle() const { return m_pseudoStyle; } 470 EInsideLink elementLinkState() const { return m_elementLinkState; } 471 bool distributedToInsertionPoint() const { return m_distributedToInsertionPoint; } 472 void setElementAffectedByClassRules(bool isAffected) { m_elementAffectedByClassRules = isAffected; } 473 bool elementAffectedByClassRules() const { return m_elementAffectedByClassRules; } 474 void setMode(SelectorChecker::Mode mode) { m_mode = mode; } 475 SelectorChecker::Mode mode() const { return m_mode; } 456 476 457 public: 477 void setApplyPropertyToRegularStyle(bool isApply) { m_applyPropertyToRegularStyle = isApply; } 478 void setApplyPropertyToVisitedLinkStyle(bool isApply) { m_applyPropertyToVisitedLinkStyle = isApply; } 479 bool applyPropertyToRegularStyle() const { return m_applyPropertyToRegularStyle; } 480 bool applyPropertyToVisitedLinkStyle() const { return m_applyPropertyToVisitedLinkStyle; } 481 PendingImagePropertyMap& pendingImageProperties() { return m_pendingImageProperties; } 482 #if ENABLE(CSS_FILTERS) && ENABLE(SVG) 483 PendingSVGDocumentMap& pendingSVGDocuments() { return m_pendingSVGDocuments; } 484 #endif 485 #if ENABLE(CSS_SHADERS) 486 void setHasPendingShaders(bool hasPendingShaders) { m_hasPendingShaders = hasPendingShaders; } 487 bool hasPendingShaders() const { return m_hasPendingShaders; } 488 #endif 489 490 void setLineHeightValue(CSSValue* value) { m_lineHeightValue = value; } 491 CSSValue* lineHeightValue() { return m_lineHeightValue; } 492 void setFontDirty(bool isDirty) { m_fontDirty = isDirty; } 493 bool fontDirty() const { return m_fontDirty; } 494 495 void cacheBorderAndBackground(); 496 bool hasUAAppearance() const { return m_hasUAAppearance; } 497 BorderData borderData() const { return m_borderData; } 498 FillLayer backgroundData() const { return m_backgroundData; } 499 Color backgroundColor() const { return m_backgroundColor; } 500 501 const FontDescription& fontDescription() { return m_style->fontDescription(); } 502 const FontDescription& parentFontDescription() { return m_parentStyle->fontDescription(); } 503 void setFontDescription(const FontDescription& fontDescription) { m_fontDirty |= m_style->setFontDescription(fontDescription); } 504 void setZoom(float f) { m_fontDirty |= m_style->setZoom(f); } 505 void setEffectiveZoom(float f) { m_fontDirty |= m_style->setEffectiveZoom(f); } 506 void setTextSizeAdjust(bool b) { m_fontDirty |= m_style->setTextSizeAdjust(b); } 507 void setWritingMode(WritingMode writingMode) { m_fontDirty |= m_style->setWritingMode(writingMode); } 508 void setTextOrientation(TextOrientation textOrientation) { m_fontDirty |= m_style->setTextOrientation(textOrientation); } 509 510 Vector<const RuleData*, 32>& matchedRules() { return m_matchedRules; } 511 void addMatchedRule(const RuleData* rule) { m_matchedRules.append(rule); } 512 513 private: 458 514 // FIXME(bug 108563): to make it easier to review, these member 459 515 // variables are public. However we should add methods to access 460 516 // these variables. 461 Element* element;462 RefPtr<RenderStyle> style;463 StyledElement* styledElement;464 ContainerNode* parentNode;465 RenderStyle* parentStyle;466 RenderStyle* rootElementStyle;517 Element* m_element; 518 RefPtr<RenderStyle> m_style; 519 StyledElement* m_styledElement; 520 ContainerNode* m_parentNode; 521 RenderStyle* m_parentStyle; 522 RenderStyle* m_rootElementStyle; 467 523 468 RenderRegion* regionForStyling; 469 bool sameOriginOnly; 470 PseudoId pseudoStyle; 471 472 EInsideLink elementLinkState; 473 474 bool distributedToInsertionPoint; 475 476 bool elementAffectedByClassRules; 477 478 PseudoId dynamicPseudo; 479 480 SelectorChecker::Mode mode; 524 RenderRegion* m_regionForStyling; 525 bool m_sameOriginOnly; 526 PseudoId m_pseudoStyle; 527 528 EInsideLink m_elementLinkState; 529 530 bool m_distributedToInsertionPoint; 531 532 bool m_elementAffectedByClassRules; 533 534 SelectorChecker::Mode m_mode; 481 535 482 536 // A buffer used to hold the set of matched rules for an element, 483 537 // and a temporary buffer used for merge sorting. 484 Vector<const RuleData*, 32> m atchedRules;485 RefPtr<StaticCSSRuleList> ruleList;486 487 bool applyPropertyToRegularStyle;488 bool applyPropertyToVisitedLinkStyle;489 490 PendingImagePropertyMap pendingImageProperties;538 Vector<const RuleData*, 32> m_matchedRules; 539 RefPtr<StaticCSSRuleList> m_ruleList; 540 541 bool m_applyPropertyToRegularStyle; 542 bool m_applyPropertyToVisitedLinkStyle; 543 544 PendingImagePropertyMap m_pendingImageProperties; 491 545 #if ENABLE(CSS_SHADERS) 492 bool hasPendingShaders;546 bool m_hasPendingShaders; 493 547 #endif 494 548 #if ENABLE(CSS_FILTERS) && ENABLE(SVG) 495 PendingSVGDocumentMap pendingSVGDocuments;496 #endif 497 CSSValue* lineHeightValue;498 bool fontDirty;499 500 bool hasUAAppearance;501 BorderData borderData;502 FillLayer backgroundData;503 Color backgroundColor;549 PendingSVGDocumentMap m_pendingSVGDocuments; 550 #endif 551 CSSValue* m_lineHeightValue; 552 bool m_fontDirty; 553 554 bool m_hasUAAppearance; 555 BorderData m_borderData; 556 FillLayer m_backgroundData; 557 Color m_backgroundColor; 504 558 }; 505 559 … … 514 568 PassRefPtr<StyleImage> cursorOrPendingFromValue(CSSPropertyID, CSSCursorImageValue*); 515 569 516 bool applyPropertyToRegularStyle() const { return m_state.applyPropertyToRegularStyle ; }517 bool applyPropertyToVisitedLinkStyle() const { return m_state.applyPropertyToVisitedLinkStyle ; }570 bool applyPropertyToRegularStyle() const { return m_state.applyPropertyToRegularStyle(); } 571 bool applyPropertyToVisitedLinkStyle() const { return m_state.applyPropertyToVisitedLinkStyle(); } 518 572 519 573 static Length convertToIntLength(CSSPrimitiveValue*, RenderStyle*, RenderStyle* rootStyle, double multiplier = 1); … … 522 576 CSSToStyleMap* styleMap() { return &m_styleMap; } 523 577 InspectorCSSOMWrappers& inspectorCSSOMWrappers() { return m_inspectorCSSOMWrappers; } 524 578 const FontDescription& fontDescription() { return m_state.fontDescription(); } 579 const FontDescription& parentFontDescription() { return m_state.parentFontDescription(); } 580 void setFontDescription(const FontDescription& fontDescription) { m_state.setFontDescription(fontDescription); } 581 void setZoom(float f) { m_state.setZoom(f); } 582 void setEffectiveZoom(float f) { m_state.setEffectiveZoom(f); } 583 void setTextSizeAdjust(bool b) { m_state.setTextSizeAdjust(b); } 584 void setWritingMode(WritingMode writingMode) { m_state.setWritingMode(writingMode); } 585 void setTextOrientation(TextOrientation textOrientation) { m_state.setTextOrientation(textOrientation); } 586 525 587 void reportMemoryUsage(MemoryObjectInfo*) const; 526 588
Note: See TracChangeset
for help on using the changeset viewer.