Changeset 141742 in webkit
- Timestamp:
- Feb 3, 2013 11:02:55 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r141741 r141742 1 2013-02-03 Takashi Sakamoto <tasak@google.com> 2 3 Split per-resolve logic out from StyleResolver. 4 https://bugs.webkit.org/show_bug.cgi?id=96421 5 6 Reviewed by Eric Seidel. 7 8 Implemented class StyleResolver::State and added m_state to 9 StyleResolver. All member variables used for per-resolve logic are 10 moved into the state class. 11 12 No new tests, because just refactoring. 13 14 * css/SVGCSSStyleSelector.cpp: 15 (WebCore::StyleResolver::applySVGProperty): 16 * css/StyleResolver.cpp: 17 (WebCore): 18 (WebCore::StyleResolver::StyleResolver): 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::initElement): 32 (WebCore::StyleResolver::initForStyleResolve): 33 (WebCore::StyleResolver::styleSharingCandidateMatchesRuleSet): 34 (WebCore::StyleResolver::canShareStyleWithControl): 35 (WebCore::StyleResolver::sharingCandidateHasIdenticalStyleAffectingAttributes): 36 (WebCore::StyleResolver::canShareStyleWithElement): 37 (WebCore::StyleResolver::locateSharedStyle): 38 (WebCore::StyleResolver::styleForElement): 39 (WebCore::StyleResolver::styleForKeyframe): 40 (WebCore::StyleResolver::pseudoStyleForElement): 41 (WebCore::StyleResolver::styleForPage): 42 (WebCore::StyleResolver::defaultStyleForElement): 43 (WebCore::StyleResolver::adjustRenderStyle): 44 (WebCore::StyleResolver::updateFont): 45 (WebCore::StyleResolver::cacheBorderAndBackground): 46 (WebCore::StyleResolver::pseudoStyleRulesForElement): 47 (WebCore::StyleResolver::ruleMatches): 48 (WebCore::StyleResolver::checkRegionSelector): 49 (WebCore::StyleResolver::applyProperties): 50 (WebCore::StyleResolver::applyMatchedProperties): 51 (WebCore::StyleResolver::isLeftPage): 52 (WebCore::StyleResolver::applyPropertyToStyle): 53 (WebCore::StyleResolver::useSVGZoomRules): 54 (WebCore::createGridTrackBreadth): 55 (WebCore::createGridTrackMinMax): 56 (WebCore::createGridTrackGroup): 57 (WebCore::createGridTrackList): 58 (WebCore::StyleResolver::resolveVariables): 59 (WebCore::StyleResolver::applyProperty): 60 (WebCore::StyleResolver::cachedOrPendingFromValue): 61 (WebCore::StyleResolver::generatedOrPendingFromValue): 62 (WebCore::StyleResolver::setOrPendingFromValue): 63 (WebCore::StyleResolver::cursorOrPendingFromValue): 64 (WebCore::StyleResolver::checkForTextSizeAdjust): 65 (WebCore::StyleResolver::initializeFontStyle): 66 (WebCore::StyleResolver::setFontSize): 67 (WebCore::StyleResolver::colorFromPrimitiveValue): 68 (WebCore::StyleResolver::loadPendingSVGDocuments): 69 (WebCore::StyleResolver::cachedOrPendingStyleShaderFromValue): 70 (WebCore::StyleResolver::loadPendingShaders): 71 (WebCore::StyleResolver::parseCustomFilterTransformParameter): 72 (WebCore::StyleResolver::createFilterOperations): 73 (WebCore::StyleResolver::loadPendingImage): 74 (WebCore::StyleResolver::loadPendingImages): 75 (WebCore::StyleResolver::reportMemoryUsage): 76 * css/StyleResolver.h: 77 (WebCore::StyleResolver::style): 78 (WebCore::StyleResolver::parentStyle): 79 (WebCore::StyleResolver::rootElementStyle): 80 (WebCore::StyleResolver::element): 81 (WebCore::StyleResolver::setFontDescription): 82 (WebCore::StyleResolver::setZoom): 83 (WebCore::StyleResolver::setEffectiveZoom): 84 (WebCore::StyleResolver::setTextSizeAdjust): 85 (WebCore::StyleResolver::setWritingMode): 86 (WebCore::StyleResolver::setTextOrientation): 87 (WebCore::StyleResolver::hasParentNode): 88 (WebCore::StyleResolver::addMatchedRule): 89 (StyleResolver): 90 (State): 91 (WebCore::StyleResolver::State::State): 92 (WebCore::StyleResolver::applyPropertyToRegularStyle): 93 (WebCore::StyleResolver::applyPropertyToVisitedLinkStyle): 94 Added "m_state." to access member variables used for per-resolve logic. 95 1 96 2013-02-03 Kent Tamura <tkent@chromium.org> 2 97 -
trunk/Source/WebCore/css/SVGCSSStyleSelector.cpp
r133420 r141742 50 50 if (isInherit) \ 51 51 { \ 52 svgstyle->set##Prop( m_parentStyle->svgStyle()->prop()); \52 svgstyle->set##Prop(state.parentStyle->svgStyle()->prop()); \ 53 53 return; \ 54 54 } … … 110 110 primitiveValue = static_cast<CSSPrimitiveValue*>(value); 111 111 112 SVGRenderStyle* svgstyle = m_style->accessSVGStyle(); 113 114 bool isInherit = m_parentNode && value->isInheritedValue(); 115 bool isInitial = value->isInitialValue() || (!m_parentNode && value->isInheritedValue()); 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()); 116 117 117 118 // What follows is a list that maps the CSS properties into their … … 230 231 { 231 232 if (isInherit) { 232 const SVGRenderStyle* svgParentStyle = m_parentStyle->svgStyle();233 const SVGRenderStyle* svgParentStyle = state.parentStyle->svgStyle(); 233 234 svgstyle->setFillPaint(svgParentStyle->fillPaintType(), svgParentStyle->fillPaintColor(), svgParentStyle->fillPaintUri(), applyPropertyToRegularStyle(), applyPropertyToVisitedLinkStyle()); 234 235 return; … … 240 241 if (value->isSVGPaint()) { 241 242 SVGPaint* svgPaint = static_cast<SVGPaint*>(value); 242 svgstyle->setFillPaint(svgPaint->paintType(), colorFromSVGColorCSSValue(svgPaint, m_style->color()), svgPaint->uri(), applyPropertyToRegularStyle(), applyPropertyToVisitedLinkStyle());243 svgstyle->setFillPaint(svgPaint->paintType(), colorFromSVGColorCSSValue(svgPaint, state.style->color()), svgPaint->uri(), applyPropertyToRegularStyle(), applyPropertyToVisitedLinkStyle()); 243 244 } 244 245 break; … … 247 248 { 248 249 if (isInherit) { 249 const SVGRenderStyle* svgParentStyle = m_parentStyle->svgStyle();250 const SVGRenderStyle* svgParentStyle = state.parentStyle->svgStyle(); 250 251 svgstyle->setStrokePaint(svgParentStyle->strokePaintType(), svgParentStyle->strokePaintColor(), svgParentStyle->strokePaintUri(), applyPropertyToRegularStyle(), applyPropertyToVisitedLinkStyle()); 251 252 return; … … 257 258 if (value->isSVGPaint()) { 258 259 SVGPaint* svgPaint = static_cast<SVGPaint*>(value); 259 svgstyle->setStrokePaint(svgPaint->paintType(), colorFromSVGColorCSSValue(svgPaint, m_style->color()), svgPaint->uri(), applyPropertyToRegularStyle(), applyPropertyToVisitedLinkStyle());260 svgstyle->setStrokePaint(svgPaint->paintType(), colorFromSVGColorCSSValue(svgPaint, state.style->color()), svgPaint->uri(), applyPropertyToRegularStyle(), applyPropertyToVisitedLinkStyle()); 260 261 } 261 262 break; … … 364 365 s = primitiveValue->getStringValue(); 365 366 366 svgstyle->setMarkerStartResource(SVGURIReference::fragmentIdentifierFromIRIString(s, m_element->document()));367 svgstyle->setMarkerStartResource(SVGURIReference::fragmentIdentifierFromIRIString(s, state.element->document())); 367 368 break; 368 369 } … … 378 379 s = primitiveValue->getStringValue(); 379 380 380 svgstyle->setMarkerMidResource(SVGURIReference::fragmentIdentifierFromIRIString(s, m_element->document()));381 svgstyle->setMarkerMidResource(SVGURIReference::fragmentIdentifierFromIRIString(s, state.element->document())); 381 382 break; 382 383 } … … 392 393 s = primitiveValue->getStringValue(); 393 394 394 svgstyle->setMarkerEndResource(SVGURIReference::fragmentIdentifierFromIRIString(s, m_element->document()));395 svgstyle->setMarkerEndResource(SVGURIReference::fragmentIdentifierFromIRIString(s, state.element->document())); 395 396 break; 396 397 } … … 429 430 s = primitiveValue->getStringValue(); 430 431 431 svgstyle->setFilterResource(SVGURIReference::fragmentIdentifierFromIRIString(s, m_element->document()));432 svgstyle->setFilterResource(SVGURIReference::fragmentIdentifierFromIRIString(s, state.element->document())); 432 433 break; 433 434 } … … 443 444 s = primitiveValue->getStringValue(); 444 445 445 svgstyle->setMaskerResource(SVGURIReference::fragmentIdentifierFromIRIString(s, m_element->document()));446 svgstyle->setMaskerResource(SVGURIReference::fragmentIdentifierFromIRIString(s, state.element->document())); 446 447 break; 447 448 } … … 457 458 s = primitiveValue->getStringValue(); 458 459 459 svgstyle->setClipperResource(SVGURIReference::fragmentIdentifierFromIRIString(s, m_element->document()));460 svgstyle->setClipperResource(SVGURIReference::fragmentIdentifierFromIRIString(s, state.element->document())); 460 461 break; 461 462 } … … 478 479 HANDLE_INHERIT_AND_INITIAL(stopColor, StopColor); 479 480 if (value->isSVGColor()) 480 svgstyle->setStopColor(colorFromSVGColorCSSValue(static_cast<SVGColor*>(value), m_style->color()));481 svgstyle->setStopColor(colorFromSVGColorCSSValue(static_cast<SVGColor*>(value), state.style->color())); 481 482 break; 482 483 } … … 485 486 HANDLE_INHERIT_AND_INITIAL(lightingColor, LightingColor); 486 487 if (value->isSVGColor()) 487 svgstyle->setLightingColor(colorFromSVGColorCSSValue(static_cast<SVGColor*>(value), m_style->color()));488 svgstyle->setLightingColor(colorFromSVGColorCSSValue(static_cast<SVGColor*>(value), state.style->color())); 488 489 break; 489 490 } … … 510 511 HANDLE_INHERIT_AND_INITIAL(floodColor, FloodColor); 511 512 if (value->isSVGColor()) 512 svgstyle->setFloodColor(colorFromSVGColorCSSValue(static_cast<SVGColor*>(value), m_style->color()));513 svgstyle->setFloodColor(colorFromSVGColorCSSValue(static_cast<SVGColor*>(value), state.style->color())); 513 514 break; 514 515 } … … 550 551 case CSSPropertyWebkitSvgShadow: { 551 552 if (isInherit) 552 return svgstyle->setShadow(adoptPtr( m_parentStyle->svgStyle()->shadow() ? new ShadowData(*m_parentStyle->svgStyle()->shadow()) : 0));553 return svgstyle->setShadow(adoptPtr(state.parentStyle->svgStyle()->shadow() ? new ShadowData(*state.parentStyle->svgStyle()->shadow()) : 0)); 553 554 if (isInitial || primitiveValue) // initial | none 554 555 return svgstyle->setShadow(nullptr); … … 565 566 return; 566 567 ShadowValue* item = static_cast<ShadowValue*>(firstValue); 567 IntPoint location(item->x->computeLength<int>(st yle(), m_rootElementStyle),568 item->y->computeLength<int>(style(), m_rootElementStyle));569 int blur = item->blur ? item->blur->computeLength<int>(st yle(), m_rootElementStyle) : 0;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; 570 571 Color color; 571 572 if (item->color) -
trunk/Source/WebCore/css/StyleResolver.cpp
r141733 r141742 46 46 #include "CSSPropertyNames.h" 47 47 #include "CSSReflectValue.h" 48 #include "CSSRuleList.h"49 48 #include "CSSSelector.h" 50 49 #include "CSSSelectorList.h" … … 200 199 #define HANDLE_INHERIT(prop, Prop) \ 201 200 if (isInherit) { \ 202 m_st yle->set##Prop(m_parentStyle->prop()); \201 m_state.style->set##Prop(m_state.parentStyle->prop()); \ 203 202 return; \ 204 203 } … … 207 206 HANDLE_INHERIT(prop, Prop) \ 208 207 if (isInitial) { \ 209 m_st yle->set##Prop(RenderStyle::initial##Prop()); \208 m_state.style->set##Prop(RenderStyle::initial##Prop()); \ 210 209 return; \ 211 210 } … … 231 230 232 231 StyleResolver::StyleResolver(Document* document, bool matchAuthorAndUserStyles) 233 : m_hasUAAppearance(false) 234 , m_backgroundData(BackgroundFillLayer) 235 , m_matchedPropertiesCacheAdditionsSinceLastSweep(0) 232 : m_matchedPropertiesCacheAdditionsSinceLastSweep(0) 236 233 , m_matchedPropertiesCacheSweepTimer(this, &StyleResolver::sweepMatchedPropertiesCache) 237 234 , m_document(document) 238 235 , m_selectorChecker(document) 239 , m_parentStyle(0)240 , m_rootElementStyle(0)241 , m_element(0)242 , m_styledElement(0)243 , m_regionForStyling(0)244 , m_elementLinkState(NotInsideLink)245 , m_parentNode(0)246 , m_lineHeightValue(0)247 , m_fontDirty(false)248 236 , m_matchAuthorAndUserStyles(matchAuthorAndUserStyles) 249 , m_sameOriginOnly(false)250 , m_distributedToInsertionPoint(false)251 237 , m_fontSelector(CSSFontSelector::create(document)) 252 238 #if ENABLE(CSS_DEVICE_ADAPTATION) 253 239 , m_viewportStyleResolver(ViewportStyleResolver::create(document)) 254 240 #endif 255 , m_applyPropertyToRegularStyle(true)256 , m_applyPropertyToVisitedLinkStyle(false)257 241 , m_styleBuilder(StyleBuilder::sharedStyleBuilder()) 258 #if ENABLE(CSS_SHADERS)259 , m_hasPendingShaders(false)260 #endif261 242 , m_styleMap(this) 262 243 { … … 499 480 { 500 481 ASSERT(matchRequest.ruleSet); 501 ASSERT(m_element); 502 503 const AtomicString& pseudoId = m_element->shadowPseudoId(); 482 ASSERT(m_state.element); 483 484 State& state = m_state; 485 Element* element = state.element; 486 StyledElement* styledElement = state.styledElement; 487 const AtomicString& pseudoId = element->shadowPseudoId(); 504 488 if (!pseudoId.isEmpty()) { 505 ASSERT( m_styledElement);489 ASSERT(styledElement); 506 490 collectMatchingRulesForList(matchRequest.ruleSet->shadowPseudoElementRules(pseudoId.impl()), matchRequest, ruleRange); 507 491 } 508 492 509 493 #if ENABLE(VIDEO_TRACK) 510 if ( m_element->isWebVTTElement())494 if (element->isWebVTTElement()) 511 495 collectMatchingRulesForList(matchRequest.ruleSet->cuePseudoRules(), matchRequest, ruleRange); 512 496 #endif … … 515 499 // b) the tree scope allows author rules 516 500 // c) the rules comes from a scoped style sheet within the same tree scope 517 TreeScope* treeScope = m_element->treeScope();501 TreeScope* treeScope = element->treeScope(); 518 502 if (!MatchingUARulesScope::isMatchingUARules() 519 503 && !treeScope->applyAuthorStyles() … … 523 507 // We need to collect the rules for id, class, tag, and everything else into a buffer and 524 508 // then sort the buffer. 525 if ( m_element->hasID())526 collectMatchingRulesForList(matchRequest.ruleSet->idRules( m_element->idForStyleResolution().impl()), matchRequest, ruleRange);527 if ( m_styledElement && m_styledElement->hasClass()) {528 for (size_t i = 0; i < m_styledElement->classNames().size(); ++i)529 collectMatchingRulesForList(matchRequest.ruleSet->classRules( m_styledElement->classNames()[i].impl()), matchRequest, ruleRange);530 } 531 532 if ( m_element->isLink())509 if (element->hasID()) 510 collectMatchingRulesForList(matchRequest.ruleSet->idRules(element->idForStyleResolution().impl()), matchRequest, ruleRange); 511 if (styledElement && styledElement->hasClass()) { 512 for (size_t i = 0; i < styledElement->classNames().size(); ++i) 513 collectMatchingRulesForList(matchRequest.ruleSet->classRules(styledElement->classNames()[i].impl()), matchRequest, ruleRange); 514 } 515 516 if (element->isLink()) 533 517 collectMatchingRulesForList(matchRequest.ruleSet->linkPseudoClassRules(), matchRequest, ruleRange); 534 if (m_selectorChecker.matchesFocusPseudoClass( m_element))518 if (m_selectorChecker.matchesFocusPseudoClass(element)) 535 519 collectMatchingRulesForList(matchRequest.ruleSet->focusPseudoClassRules(), matchRequest, ruleRange); 536 collectMatchingRulesForList(matchRequest.ruleSet->tagRules( m_element->localName().impl()), matchRequest, ruleRange);520 collectMatchingRulesForList(matchRequest.ruleSet->tagRules(element->localName().impl()), matchRequest, ruleRange); 537 521 collectMatchingRulesForList(matchRequest.ruleSet->universalRules(), matchRequest, ruleRange); 538 522 } … … 540 524 void StyleResolver::collectMatchingRulesForRegion(const MatchRequest& matchRequest, RuleRange& ruleRange) 541 525 { 542 if (!m_ regionForStyling)526 if (!m_state.regionForStyling) 543 527 return; 544 528 … … 546 530 for (unsigned i = 0; i < size; ++i) { 547 531 const CSSSelector* regionSelector = matchRequest.ruleSet->m_regionSelectorsAndRuleSets.at(i).selector; 548 if (checkRegionSelector(regionSelector, static_cast<Element*>(m_ regionForStyling->node()))) {532 if (checkRegionSelector(regionSelector, static_cast<Element*>(m_state.regionForStyling->node()))) { 549 533 RuleSet* regionRules = matchRequest.ruleSet->m_regionSelectorsAndRuleSets.at(i).ruleSet.get(); 550 534 ASSERT(regionRules); … … 556 540 void StyleResolver::sortAndTransferMatchedRules(MatchResult& result) 557 541 { 558 if (m_matchedRules.isEmpty()) 542 State& state = m_state; 543 if (state.matchedRules.isEmpty()) 559 544 return; 560 545 … … 562 547 563 548 if (m_selectorChecker.mode() == SelectorChecker::CollectingRules) { 564 if (! m_ruleList)565 m_ruleList = StaticCSSRuleList::create();566 for (unsigned i = 0; i < m_matchedRules.size(); ++i)567 m_ruleList->rules().append(m_matchedRules[i]->rule()->createCSSOMWrapper());549 if (!state.ruleList) 550 state.ruleList = StaticCSSRuleList::create(); 551 for (unsigned i = 0; i < state.matchedRules.size(); ++i) 552 state.ruleList->rules().append(state.matchedRules[i]->rule()->createCSSOMWrapper()); 568 553 return; 569 554 } 570 555 571 556 // Now transfer the set of matched rules over to our list of declarations. 572 for (unsigned i = 0; i < m_matchedRules.size(); i++) {573 if ( m_style && m_matchedRules[i]->containsUncommonAttributeSelector())574 m_style->setUnique();575 addMatchedProperties(result, m_matchedRules[i]->rule()->properties(), m_matchedRules[i]->rule(), m_matchedRules[i]->linkMatchType(), m_matchedRules[i]->propertyWhitelistType());557 for (unsigned i = 0; i < state.matchedRules.size(); i++) { 558 if (state.style && state.matchedRules[i]->containsUncommonAttributeSelector()) 559 state.style->setUnique(); 560 addMatchedProperties(result, state.matchedRules[i]->rule()->properties(), state.matchedRules[i]->rule(), state.matchedRules[i]->linkMatchType(), state.matchedRules[i]->propertyWhitelistType()); 576 561 } 577 562 } … … 584 569 585 570 // Match scoped author rules by traversing the scoped element stack (rebuild it if it got inconsistent). 586 if (m_scopeResolver->hasScopedStyles() && m_scopeResolver->ensureStackConsistency(m_ element)) {587 bool applyAuthorStyles = m_ element->treeScope()->applyAuthorStyles();571 if (m_scopeResolver->hasScopedStyles() && m_scopeResolver->ensureStackConsistency(m_state.element)) { 572 bool applyAuthorStyles = m_state.element->treeScope()->applyAuthorStyles(); 588 573 bool documentScope = true; 589 574 unsigned scopeSize = m_scopeResolver->stackSize(); 590 575 for (unsigned i = 0; i < scopeSize; ++i) { 591 m_ matchedRules.clear();576 m_state.matchedRules.clear(); 592 577 result.ranges.lastAuthorRule = result.matchedProperties.size() - 1; 593 578 … … 620 605 { 621 606 #if ENABLE(SHADOW_DOM) 622 return m_scopeResolver && m_scopeResolver->styleSharingCandidateMatchesHostRules(m_ element);607 return m_scopeResolver && m_scopeResolver->styleSharingCandidateMatchesHostRules(m_state.element); 623 608 #else 624 609 return false; … … 631 616 ASSERT(m_scopeResolver); 632 617 633 m_ matchedRules.clear();618 m_state.matchedRules.clear(); 634 619 result.ranges.lastAuthorRule = result.matchedProperties.size() - 1; 635 620 636 621 Vector<RuleSet*> matchedRules; 637 m_scopeResolver->matchHostRules(m_ element, matchedRules);622 m_scopeResolver->matchHostRules(m_state.element, matchedRules); 638 623 if (matchedRules.isEmpty()) 639 624 return; … … 641 626 for (unsigned i = matchedRules.size(); i > 0; --i) { 642 627 RuleRange ruleRange = result.ranges.authorRuleRange(); 643 collectMatchingRules(MatchRequest(matchedRules.at(i-1), includeEmptyRules, m_ element), ruleRange);628 collectMatchingRules(MatchRequest(matchedRules.at(i-1), includeEmptyRules, m_state.element), ruleRange); 644 629 } 645 630 sortAndTransferMatchedRules(result); … … 652 637 void StyleResolver::matchAuthorRules(MatchResult& result, bool includeEmptyRules) 653 638 { 654 m_ matchedRules.clear();639 m_state.matchedRules.clear(); 655 640 result.ranges.lastAuthorRule = result.matchedProperties.size() - 1; 656 641 657 if (!m_ element)642 if (!m_state.element) 658 643 return; 659 644 … … 673 658 return; 674 659 675 m_ matchedRules.clear();660 m_state.matchedRules.clear(); 676 661 677 662 result.ranges.lastUserRule = result.matchedProperties.size() - 1; … … 686 671 void StyleResolver::matchUARules(MatchResult& result, RuleSet* rules) 687 672 { 688 m_ matchedRules.clear();673 m_state.matchedRules.clear(); 689 674 690 675 result.ranges.lastUARule = result.matchedProperties.size() - 1; … … 700 685 return; 701 686 687 State& state = m_state; 702 688 // In some cases we may end up looking up style for random elements in the middle of a recursive tree resolve. 703 689 // Ancestor identifier filter won't be up-to-date in that case and we can't use the fast path. 704 bool canUseFastReject = m_selectorFilter.parentStackIsConsistent( m_parentNode);690 bool canUseFastReject = m_selectorFilter.parentStackIsConsistent(state.parentNode); 705 691 706 692 unsigned size = rules->size(); … … 720 706 } 721 707 // FIXME: Exposing the non-standard getMatchedCSSRules API to web is the only reason this is needed. 722 if ( m_sameOriginOnly && !ruleData.hasDocumentSecurityOrigin()) {708 if (state.sameOriginOnly && !ruleData.hasDocumentSecurityOrigin()) { 723 709 InspectorInstrumentation::didMatchRule(cookie, false); 724 710 continue; … … 726 712 // If we're matching normal rules, set a pseudo bit if 727 713 // we really just matched a pseudo-element. 728 if ( m_dynamicPseudo != NOPSEUDO && m_pseudoStyle == NOPSEUDO) {714 if (state.dynamicPseudo != NOPSEUDO && state.pseudoStyle == NOPSEUDO) { 729 715 if (m_selectorChecker.mode() == SelectorChecker::CollectingRules) { 730 716 InspectorInstrumentation::didMatchRule(cookie, false); 731 717 continue; 732 718 } 733 if ( m_dynamicPseudo < FIRST_INTERNAL_PSEUDOID)734 m_style->setHasPseudoStyle(m_dynamicPseudo);719 if (state.dynamicPseudo < FIRST_INTERNAL_PSEUDOID) 720 state.style->setHasPseudoStyle(state.dynamicPseudo); 735 721 } else { 736 722 // Update our first/last rule indices in the matched rules array. … … 758 744 void StyleResolver::sortMatchedRules() 759 745 { 760 std::sort(m_ matchedRules.begin(), m_matchedRules.end(), compareRules);746 std::sort(m_state.matchedRules.begin(), m_state.matchedRules.end(), compareRules); 761 747 } 762 748 … … 768 754 if (m_matchAuthorAndUserStyles) 769 755 matchUserRules(result, false); 770 756 771 757 // Now check author rules, beginning first with presentational attributes mapped from HTML. 772 if (m_st yledElement) {773 addElementStyleProperties(result, m_st yledElement->presentationAttributeStyle());758 if (m_state.styledElement) { 759 addElementStyleProperties(result, m_state.styledElement->presentationAttributeStyle()); 774 760 775 761 // Now we check additional mapped declarations. 776 762 // Tables and table cells share an additional mapped rule that must be applied 777 763 // after all attributes, since their mapped style depends on the values of multiple attributes. 778 addElementStyleProperties(result, m_st yledElement->additionalPresentationAttributeStyle());779 780 if (m_st yledElement->isHTMLElement()) {764 addElementStyleProperties(result, m_state.styledElement->additionalPresentationAttributeStyle()); 765 766 if (m_state.styledElement->isHTMLElement()) { 781 767 bool isAuto; 782 TextDirection textDirection = toHTMLElement(m_st yledElement)->directionalityIfhasDirAutoAttribute(isAuto);768 TextDirection textDirection = toHTMLElement(m_state.styledElement)->directionalityIfhasDirAutoAttribute(isAuto); 783 769 if (isAuto) 784 770 addMatchedProperties(result, textDirection == LTR ? leftToRightDeclaration() : rightToLeftDeclaration()); … … 791 777 792 778 // Now check our inline style attribute. 793 if (m_matchAuthorAndUserStyles && m_st yledElement && m_styledElement->inlineStyle()) {779 if (m_matchAuthorAndUserStyles && m_state.styledElement && m_state.styledElement->inlineStyle()) { 794 780 // Inline style is immutable as long as there is no CSSOM wrapper. 795 781 // FIXME: Media control shadow trees seem to have problems with caching. 796 bool isInlineStyleCacheable = !m_st yledElement->inlineStyle()->isMutable() && !m_styledElement->isInShadowTree();782 bool isInlineStyleCacheable = !m_state.styledElement->inlineStyle()->isMutable() && !m_state.styledElement->isInShadowTree(); 797 783 // FIXME: Constify. 798 addElementStyleProperties(result, m_st yledElement->inlineStyle(), isInlineStyleCacheable);784 addElementStyleProperties(result, m_state.styledElement->inlineStyle(), isInlineStyleCacheable); 799 785 } 800 786 801 787 #if ENABLE(SVG) 802 788 // Now check SMIL animation override style. 803 if (includeSMILProperties && m_matchAuthorAndUserStyles && m_st yledElement && m_styledElement->isSVGElement())804 addElementStyleProperties(result, static_cast<SVGElement*>(m_st yledElement)->animatedSMILStyleProperties(), false /* isCacheable */);789 if (includeSMILProperties && m_matchAuthorAndUserStyles && m_state.styledElement && m_state.styledElement->isSVGElement()) 790 addElementStyleProperties(result, static_cast<SVGElement*>(m_state.styledElement)->animatedSMILStyleProperties(), false /* isCacheable */); 805 791 #else 806 792 UNUSED_PARAM(includeSMILProperties); … … 819 805 inline void StyleResolver::initElement(Element* e) 820 806 { 821 if (m_ element != e) {822 m_ element = e;823 m_st yledElement = m_element && m_element->isStyledElement() ? static_cast<StyledElement*>(m_element) : 0;824 m_ elementLinkState = document()->visitedLinkState()->determineLinkState(m_element);807 if (m_state.element != e) { 808 m_state.element = e; 809 m_state.styledElement = m_state.element && m_state.element->isStyledElement() ? static_cast<StyledElement*>(m_state.element) : 0; 810 m_state.elementLinkState = document()->visitedLinkState()->determineLinkState(e); 825 811 if (e && e == e->document()->documentElement()) { 826 812 e->document()->setDirectionSetOnDocumentElement(false); … … 832 818 inline void StyleResolver::initForStyleResolve(Element* e, RenderStyle* parentStyle, PseudoId pseudoID) 833 819 { 834 m_pseudoStyle = pseudoID; 820 State& state = m_state; 821 state.pseudoStyle = pseudoID; 835 822 836 823 if (e) { 837 824 NodeRenderingContext context(e); 838 m_parentNode = context.parentNodeForRenderingAndStyle();839 m_parentStyle = context.resetStyleInheritance() ? 0 :825 state.parentNode = context.parentNodeForRenderingAndStyle(); 826 state.parentStyle = context.resetStyleInheritance() ? 0 : 840 827 parentStyle ? parentStyle : 841 m_parentNode ? m_parentNode->renderStyle() : 0;842 m_distributedToInsertionPoint = context.insertionPoint();828 state.parentNode ? state.parentNode->renderStyle() : 0; 829 state.distributedToInsertionPoint = context.insertionPoint(); 843 830 } else { 844 m_parentNode = 0;845 m_parentStyle = parentStyle;846 m_distributedToInsertionPoint = false;831 state.parentNode = 0; 832 state.parentStyle = parentStyle; 833 state.distributedToInsertionPoint = false; 847 834 } 848 835 849 836 Node* docElement = e ? e->document()->documentElement() : 0; 850 837 RenderStyle* docStyle = document()->renderStyle(); 851 m_rootElementStyle = docElement && e != docElement ? docElement->renderStyle() : docStyle;852 853 m_style = 0;854 855 m_pendingImageProperties.clear();856 857 m_ruleList = 0;858 859 m_fontDirty = false;838 state.rootElementStyle = docElement && e != docElement ? docElement->renderStyle() : docStyle; 839 840 state.style = 0; 841 842 state.pendingImageProperties.clear(); 843 844 state.ruleList = 0; 845 846 state.fontDirty = false; 860 847 } 861 848 … … 920 907 if (!ruleSet) 921 908 return false; 922 m_ matchedRules.clear();909 m_state.matchedRules.clear(); 923 910 924 911 m_selectorChecker.setMode(SelectorChecker::SharingRules); … … 927 914 collectMatchingRules(MatchRequest(ruleSet), ruleRange); 928 915 m_selectorChecker.setMode(SelectorChecker::ResolvingStyle); 929 if (m_ matchedRules.isEmpty())930 return false; 931 m_ matchedRules.clear();916 if (m_state.matchedRules.isEmpty()) 917 return false; 918 m_state.matchedRules.clear(); 932 919 return true; 933 920 } … … 935 922 bool StyleResolver::canShareStyleWithControl(StyledElement* element) const 936 923 { 924 const State& state = m_state; 937 925 HTMLInputElement* thisInputElement = element->toInputElement(); 938 HTMLInputElement* otherInputElement = m_element->toInputElement();926 HTMLInputElement* otherInputElement = state.element->toInputElement(); 939 927 940 928 if (!thisInputElement || !otherInputElement) … … 957 945 return false; 958 946 959 if (element->isEnabledFormControl() != m_element->isEnabledFormControl())960 return false; 961 962 if (element->isDefaultButtonForForm() != m_element->isDefaultButtonForForm())963 return false; 964 965 if ( m_element->document()->containsValidityStyleRules()) {947 if (element->isEnabledFormControl() != state.element->isEnabledFormControl()) 948 return false; 949 950 if (element->isDefaultButtonForForm() != state.element->isDefaultButtonForForm()) 951 return false; 952 953 if (state.element->document()->containsValidityStyleRules()) { 966 954 bool willValidate = element->willValidate(); 967 955 968 if (willValidate != m_element->willValidate())956 if (willValidate != state.element->willValidate()) 969 957 return false; 970 958 971 if (willValidate && (element->isValidFormControlElement() != m_element->isValidFormControlElement()))959 if (willValidate && (element->isValidFormControlElement() != state.element->isValidFormControlElement())) 972 960 return false; 973 961 974 if (element->isInRange() != m_element->isInRange())962 if (element->isInRange() != state.element->isInRange()) 975 963 return false; 976 964 977 if (element->isOutOfRange() != m_element->isOutOfRange())965 if (element->isOutOfRange() != state.element->isOutOfRange()) 978 966 return false; 979 967 } … … 990 978 bool StyleResolver::sharingCandidateHasIdenticalStyleAffectingAttributes(StyledElement* sharingCandidate) const 991 979 { 992 if (m_element->attributeData() == sharingCandidate->attributeData()) 980 const State& state = m_state; 981 if (state.element->attributeData() == sharingCandidate->attributeData()) 993 982 return true; 994 if ( m_element->fastGetAttribute(XMLNames::langAttr) != sharingCandidate->fastGetAttribute(XMLNames::langAttr))995 return false; 996 if ( m_element->fastGetAttribute(langAttr) != sharingCandidate->fastGetAttribute(langAttr))997 return false; 998 999 if (! m_elementAffectedByClassRules) {983 if (state.element->fastGetAttribute(XMLNames::langAttr) != sharingCandidate->fastGetAttribute(XMLNames::langAttr)) 984 return false; 985 if (state.element->fastGetAttribute(langAttr) != sharingCandidate->fastGetAttribute(langAttr)) 986 return false; 987 988 if (!state.elementAffectedByClassRules) { 1000 989 if (sharingCandidate->hasClass() && classNamesAffectedByRules(sharingCandidate->classNames())) 1001 990 return false; … … 1003 992 #if ENABLE(SVG) 1004 993 // SVG elements require a (slow!) getAttribute comparision because "class" is an animatable attribute for SVG. 1005 if ( m_element->isSVGElement()) {1006 if ( m_element->getAttribute(classAttr) != sharingCandidate->getAttribute(classAttr))994 if (state.element->isSVGElement()) { 995 if (state.element->getAttribute(classAttr) != sharingCandidate->getAttribute(classAttr)) 1007 996 return false; 1008 997 } else { 1009 998 #endif 1010 if ( m_element->classNames() != sharingCandidate->classNames())999 if (state.element->classNames() != sharingCandidate->classNames()) 1011 1000 return false; 1012 1001 #if ENABLE(SVG) … … 1016 1005 return false; 1017 1006 1018 if ( m_styledElement->presentationAttributeStyle() != sharingCandidate->presentationAttributeStyle())1007 if (state.styledElement->presentationAttributeStyle() != sharingCandidate->presentationAttributeStyle()) 1019 1008 return false; 1020 1009 1021 1010 #if ENABLE(PROGRESS_ELEMENT) 1022 if ( m_element->hasTagName(progressTag)) {1023 if (static_cast<HTMLProgressElement*>( m_element)->isDeterminate() != static_cast<HTMLProgressElement*>(sharingCandidate)->isDeterminate())1011 if (state.element->hasTagName(progressTag)) { 1012 if (static_cast<HTMLProgressElement*>(state.element)->isDeterminate() != static_cast<HTMLProgressElement*>(sharingCandidate)->isDeterminate()) 1024 1013 return false; 1025 1014 } … … 1032 1021 { 1033 1022 RenderStyle* style = element->renderStyle(); 1023 const State& state = m_state; 1034 1024 1035 1025 if (!style) … … 1037 1027 if (style->unique()) 1038 1028 return false; 1039 if (element->tagQName() != m_element->tagQName())1029 if (element->tagQName() != state.element->tagQName()) 1040 1030 return false; 1041 1031 if (element->inlineStyle()) … … 1047 1037 return false; 1048 1038 #endif 1049 if (element->isLink() != m_element->isLink())1050 return false; 1051 if (element->hovered() != m_element->hovered())1052 return false; 1053 if (element->active() != m_element->active())1054 return false; 1055 if (element->focused() != m_element->focused())1056 return false; 1057 if (element->shadowPseudoId() != m_element->shadowPseudoId())1039 if (element->isLink() != state.element->isLink()) 1040 return false; 1041 if (element->hovered() != state.element->hovered()) 1042 return false; 1043 if (element->active() != state.element->active()) 1044 return false; 1045 if (element->focused() != state.element->focused()) 1046 return false; 1047 if (element->shadowPseudoId() != state.element->shadowPseudoId()) 1058 1048 return false; 1059 1049 if (element == element->document()->cssTarget()) … … 1061 1051 if (!sharingCandidateHasIdenticalStyleAffectingAttributes(element)) 1062 1052 return false; 1063 if (element->additionalPresentationAttributeStyle() != m_styledElement->additionalPresentationAttributeStyle())1053 if (element->additionalPresentationAttributeStyle() != state.styledElement->additionalPresentationAttributeStyle()) 1064 1054 return false; 1065 1055 … … 1077 1067 bool isControl = element->isFormControlElement(); 1078 1068 1079 if (isControl != m_element->isFormControlElement())1069 if (isControl != state.element->isFormControlElement()) 1080 1070 return false; 1081 1071 … … 1101 1091 return false; 1102 1092 1103 if (element->isLink() && m_elementLinkState != style->insideLink())1093 if (element->isLink() && state.elementLinkState != style->insideLink()) 1104 1094 return false; 1105 1095 1106 1096 #if ENABLE(VIDEO_TRACK) 1107 1097 // Deny sharing styles between WebVTT and non-WebVTT nodes. 1108 if (element->isWebVTTElement() != m_element->isWebVTTElement())1109 return false; 1110 1111 if (element->isWebVTTElement() && m_element->isWebVTTElement() && toWebVTTElement(element)->isPastNode() != toWebVTTElement(m_element)->isPastNode())1098 if (element->isWebVTTElement() != state.element->isWebVTTElement()) 1099 return false; 1100 1101 if (element->isWebVTTElement() && state.element->isWebVTTElement() && toWebVTTElement(element)->isPastNode() != toWebVTTElement(state.element)->isPastNode()) 1112 1102 return false; 1113 1103 #endif 1114 1104 1115 1105 #if ENABLE(FULLSCREEN_API) 1116 if (element == element->document()->webkitCurrentFullScreenElement() || m_element == m_element->document()->webkitCurrentFullScreenElement())1106 if (element == element->document()->webkitCurrentFullScreenElement() || state.element == state.element->document()->webkitCurrentFullScreenElement()) 1117 1107 return false; 1118 1108 #endif … … 1135 1125 RenderStyle* StyleResolver::locateSharedStyle() 1136 1126 { 1137 if (!m_styledElement || !m_parentStyle) 1127 State& state = m_state; 1128 if (!state.styledElement || !state.parentStyle) 1138 1129 return 0; 1130 1139 1131 // If the element has inline style it is probably unique. 1140 if ( m_styledElement->inlineStyle())1132 if (state.styledElement->inlineStyle()) 1141 1133 return 0; 1142 1134 #if ENABLE(SVG) 1143 if ( m_styledElement->isSVGElement() && static_cast<SVGElement*>(m_styledElement)->animatedSMILStyleProperties())1135 if (state.styledElement->isSVGElement() && static_cast<SVGElement*>(state.styledElement)->animatedSMILStyleProperties()) 1144 1136 return 0; 1145 1137 #endif 1146 1138 // Ids stop style sharing if they show up in the stylesheets. 1147 if ( m_styledElement->hasID() && m_features.idsInRules.contains(m_styledElement->idForStyleResolution().impl()))1139 if (state.styledElement->hasID() && m_features.idsInRules.contains(state.styledElement->idForStyleResolution().impl())) 1148 1140 return 0; 1149 if (parentElementPreventsSharing( m_element->parentElement()))1141 if (parentElementPreventsSharing(state.element->parentElement())) 1150 1142 return 0; 1151 if ( m_styledElement->hasScopedHTMLStyleChild())1143 if (state.styledElement->hasScopedHTMLStyleChild()) 1152 1144 return 0; 1153 if ( m_element == m_element->document()->cssTarget())1145 if (state.element == state.element->document()->cssTarget()) 1154 1146 return 0; 1155 if (elementHasDirectionAuto( m_element))1147 if (elementHasDirectionAuto(state.element)) 1156 1148 return 0; 1157 1149 1158 // Cache whether m_element is affected by any known class selectors.1150 // Cache whether state.element is affected by any known class selectors. 1159 1151 // FIXME: This shouldn't be a member variable. The style sharing code could be factored out of StyleResolver. 1160 m_elementAffectedByClassRules = m_element && m_element->hasClass() && classNamesAffectedByRules(m_element->classNames());1152 state.elementAffectedByClassRules = state.element && state.element->hasClass() && classNamesAffectedByRules(state.element->classNames()); 1161 1153 1162 1154 // Check previous siblings and their cousins. … … 1164 1156 unsigned visitedNodeCount = 0; 1165 1157 StyledElement* shareElement = 0; 1166 Node* cousinList = m_styledElement->previousSibling();1158 Node* cousinList = state.styledElement->previousSibling(); 1167 1159 while (cousinList) { 1168 1160 shareElement = findSiblingForStyleSharing(cousinList, count); … … 1186 1178 return 0; 1187 1179 // Tracking child index requires unique style for each node. This may get set by the sibling rule match above. 1188 if (parentElementPreventsSharing( m_element->parentElement()))1180 if (parentElementPreventsSharing(state.element->parentElement())) 1189 1181 return 0; 1190 1182 return shareElement->renderStyle(); … … 1406 1398 } 1407 1399 1400 State& state = m_state; 1408 1401 initElement(element); 1409 1402 initForStyleResolve(element, defaultParent); 1410 m_regionForStyling = regionForStyling;1411 if (sharingBehavior == AllowStyleSharing && ! m_distributedToInsertionPoint) {1403 state.regionForStyling = regionForStyling; 1404 if (sharingBehavior == AllowStyleSharing && !state.distributedToInsertionPoint) { 1412 1405 RenderStyle* sharedStyle = locateSharedStyle(); 1413 1406 if (sharedStyle) … … 1417 1410 RefPtr<RenderStyle> cloneForParent; 1418 1411 1419 if ( m_parentStyle) {1420 m_style = RenderStyle::create();1421 m_style->inheritFrom(m_parentStyle, isAtShadowBoundary(element) ? RenderStyle::AtShadowBoundary : RenderStyle::NotAtShadowBoundary);1412 if (state.parentStyle) { 1413 state.style = RenderStyle::create(); 1414 state.style->inheritFrom(state.parentStyle, isAtShadowBoundary(element) ? RenderStyle::AtShadowBoundary : RenderStyle::NotAtShadowBoundary); 1422 1415 } else { 1423 m_style = defaultStyleForElement();1424 cloneForParent = RenderStyle::clone(st yle());1425 m_parentStyle = cloneForParent.get();1416 state.style = defaultStyleForElement(); 1417 cloneForParent = RenderStyle::clone(state.style.get()); 1418 state.parentStyle = cloneForParent.get(); 1426 1419 } 1427 1420 // contenteditable attribute (implemented by -webkit-user-modify) should 1428 1421 // be propagated from shadow host to distributed node. 1429 if ( m_distributedToInsertionPoint) {1422 if (state.distributedToInsertionPoint) { 1430 1423 if (Element* parent = element->parentElement()) { 1431 1424 if (RenderStyle* styleOfShadowHost = parent->renderStyle()) 1432 m_style->setUserModify(styleOfShadowHost->userModify());1425 state.style->setUserModify(styleOfShadowHost->userModify()); 1433 1426 } 1434 1427 } 1435 1428 1436 1429 if (element->isLink()) { 1437 m_style->setIsLink(true);1438 EInsideLink linkState = m_elementLinkState;1439 if ( m_elementLinkState != NotInsideLink) {1430 state.style->setIsLink(true); 1431 EInsideLink linkState = state.elementLinkState; 1432 if (linkState != NotInsideLink) { 1440 1433 bool forceVisited = InspectorInstrumentation::forcePseudoState(element, CSSSelector::PseudoVisited); 1441 1434 if (forceVisited) 1442 1435 linkState = InsideVisitedLink; 1443 1436 } 1444 1445 m_style->setInsideLink(linkState); 1437 state.style->setInsideLink(linkState); 1446 1438 } 1447 1439 … … 1457 1449 1458 1450 // Clean up our style object's display and text decorations (among other fixups). 1459 adjustRenderStyle(st yle(), m_parentStyle, element);1451 adjustRenderStyle(state.style.get(), state.parentStyle, element); 1460 1452 1461 1453 initElement(0); // Clear out for the next resolve. 1462 1454 1463 1455 if (cloneForParent) 1464 m_parentStyle = 0;1456 state.parentStyle = 0; 1465 1457 1466 1458 document()->didAccessStyleResolver(); 1467 1459 1468 1460 // Now return the style. 1469 return m_style.release();1461 return state.style.release(); 1470 1462 } 1471 1463 … … 1476 1468 addMatchedProperties(result, keyframe->properties()); 1477 1469 1478 ASSERT(!m_style); 1470 ASSERT(!m_state.style); 1471 1472 State& state = m_state; 1479 1473 1480 1474 // Create the style 1481 m_style = RenderStyle::clone(elementStyle);1482 1483 m_lineHeightValue = 0;1475 state.style = RenderStyle::clone(elementStyle); 1476 1477 state.lineHeightValue = 0; 1484 1478 1485 1479 // We don't need to bother with !important. Since there is only ever one … … 1493 1487 1494 1488 // Line-height is set when we are sure we decided on the font-size 1495 if ( m_lineHeightValue)1496 applyProperty(CSSPropertyLineHeight, m_lineHeightValue);1489 if (state.lineHeightValue) 1490 applyProperty(CSSPropertyLineHeight, state.lineHeightValue); 1497 1491 1498 1492 // Now do rest of the properties. … … 1521 1515 document()->didAccessStyleResolver(); 1522 1516 1523 return m_style.release();1517 return state.style.release(); 1524 1518 } 1525 1519 … … 1589 1583 PassRefPtr<RenderStyle> StyleResolver::pseudoStyleForElement(PseudoId pseudo, Element* e, RenderStyle* parentStyle) 1590 1584 { 1591 ASSERT(m_ parentStyle);1585 ASSERT(m_state.parentStyle); 1592 1586 if (!e) 1593 1587 return 0; 1594 1588 1589 State& state = m_state; 1590 1595 1591 initElement(e); 1596 1592 1597 1593 initForStyleResolve(e, parentStyle, pseudo); 1598 m_style = RenderStyle::create();1599 m_style->inheritFrom(m_parentStyle);1594 state.style = RenderStyle::create(); 1595 state.style->inheritFrom(m_state.parentStyle); 1600 1596 1601 1597 // Since we don't use pseudo-elements in any of our quirk/print user agent rules, don't waste time walking … … 1614 1610 return 0; 1615 1611 1616 m_style->setStyleType(pseudo);1612 state.style->setStyleType(pseudo); 1617 1613 1618 1614 applyMatchedProperties(matchResult, e); 1619 1615 1620 1616 // Clean up our style object's display and text decorations (among other fixups). 1621 adjustRenderStyle(st yle(),parentStyle, 0);1617 adjustRenderStyle(state.style.get(), m_state.parentStyle, 0); 1622 1618 1623 1619 // Start loading resources referenced by this style. … … 1627 1623 1628 1624 // Now return the style. 1629 return m_style.release();1625 return state.style.release(); 1630 1626 } 1631 1627 … … 1634 1630 initForStyleResolve(document()->documentElement()); // m_rootElementStyle will be set to the document style. 1635 1631 1636 m_st yle = RenderStyle::create();1637 m_st yle->inheritFrom(m_rootElementStyle);1632 m_state.style = RenderStyle::create(); 1633 m_state.style->inheritFrom(m_state.rootElementStyle); 1638 1634 1639 1635 const bool isLeft = isLeftPage(pageIndex); … … 1646 1642 // Only consider the global author RuleSet for @page rules, as per the HTML5 spec. 1647 1643 matchPageRules(result, m_authorStyle.get(), isLeft, isFirst, page); 1648 m_ lineHeightValue = 0;1644 m_state.lineHeightValue = 0; 1649 1645 bool inheritedOnly = false; 1650 1646 #if ENABLE(CSS_VARIABLES) … … 1657 1653 1658 1654 // Line-height is set when we are sure we decided on the font-size. 1659 if (m_ lineHeightValue)1660 applyProperty(CSSPropertyLineHeight, m_ lineHeightValue);1655 if (m_state.lineHeightValue) 1656 applyProperty(CSSPropertyLineHeight, m_state.lineHeightValue); 1661 1657 1662 1658 applyMatchedProperties<LowPriorityProperties>(result, false, 0, result.matchedProperties.size() - 1, inheritedOnly); … … 1668 1664 1669 1665 // Now return the style. 1670 return m_st yle.release();1666 return m_state.style.release(); 1671 1667 } 1672 1668 1673 1669 PassRefPtr<RenderStyle> StyleResolver::defaultStyleForElement() 1674 1670 { 1675 m_st yle = RenderStyle::create();1671 m_state.style = RenderStyle::create(); 1676 1672 // Make sure our fonts are initialized if we don't inherit them from our parent style. 1677 1673 if (Settings* settings = documentSettings()) { 1678 1674 initializeFontStyle(settings); 1679 m_st yle->font().update(fontSelector());1675 m_state.style->font().update(fontSelector()); 1680 1676 } else 1681 m_st yle->font().update(0);1682 1683 return m_st yle.release();1677 m_state.style->font().update(0); 1678 1679 return m_state.style.release(); 1684 1680 } 1685 1681 … … 1969 1965 // Let the theme also have a crack at adjusting the style. 1970 1966 if (style->hasAppearance()) 1971 RenderTheme::defaultTheme()->adjustStyle(this, style, e, m_ hasUAAppearance, m_borderData, m_backgroundData, m_backgroundColor);1967 RenderTheme::defaultTheme()->adjustStyle(this, style, e, m_state.hasUAAppearance, m_state.borderData, m_state.backgroundData, m_state.backgroundColor); 1972 1968 1973 1969 // If we have first-letter pseudo style, do not share this style. … … 2052 2048 void StyleResolver::updateFont() 2053 2049 { 2054 if (!m_ fontDirty)2050 if (!m_state.fontDirty) 2055 2051 return; 2056 2052 2057 2053 checkForTextSizeAdjust(); 2058 checkForGenericFamilyChange(style(), m_parentStyle); 2059 checkForZoomChange(style(), m_parentStyle); 2060 checkForOrientationChange(style()); 2061 m_style->font().update(m_fontSelector); 2062 m_fontDirty = false; 2054 RenderStyle* style = m_state.style.get(); 2055 checkForGenericFamilyChange(style, m_state.parentStyle); 2056 checkForZoomChange(style, m_state.parentStyle); 2057 checkForOrientationChange(style); 2058 m_state.style->font().update(m_fontSelector); 2059 m_state.fontDirty = false; 2063 2060 } 2064 2061 2065 2062 void StyleResolver::cacheBorderAndBackground() 2066 2063 { 2067 m_ hasUAAppearance = m_style->hasAppearance();2068 if (m_ hasUAAppearance) {2069 m_ borderData = m_style->border();2070 m_ backgroundData = *m_style->backgroundLayers();2071 m_ backgroundColor = m_style->backgroundColor();2064 m_state.hasUAAppearance = m_state.style->hasAppearance(); 2065 if (m_state.hasUAAppearance) { 2066 m_state.borderData = m_state.style->border(); 2067 m_state.backgroundData = *m_state.style->backgroundLayers(); 2068 m_state.backgroundColor = m_state.style->backgroundColor(); 2072 2069 } 2073 2070 } … … 2099 2096 2100 2097 if (m_matchAuthorAndUserStyles && (rulesToInclude & AuthorCSSRules)) { 2101 m_s ameOriginOnly = !(rulesToInclude & CrossOriginCSSRules);2098 m_state.sameOriginOnly = !(rulesToInclude & CrossOriginCSSRules); 2102 2099 2103 2100 // Check the rules in author sheets. 2104 2101 matchAuthorRules(dummy, rulesToInclude & EmptyCSSRules); 2105 2102 2106 m_s ameOriginOnly = false;2103 m_state.sameOriginOnly = false; 2107 2104 } 2108 2105 2109 2106 m_selectorChecker.setMode(SelectorChecker::ResolvingStyle); 2110 2107 2111 return m_ ruleList.release();2108 return m_state.ruleList.release(); 2112 2109 } 2113 2110 2114 2111 inline bool StyleResolver::ruleMatches(const RuleData& ruleData, const ContainerNode* scope) 2115 2112 { 2116 m_dynamicPseudo = NOPSEUDO; 2113 State& state = m_state; 2114 state.dynamicPseudo = NOPSEUDO; 2117 2115 2118 2116 if (ruleData.hasFastCheckableSelector()) { 2119 2117 // We know this selector does not include any pseudo elements. 2120 if ( m_pseudoStyle != NOPSEUDO)2118 if (state.pseudoStyle != NOPSEUDO) 2121 2119 return false; 2122 2120 // We know a sufficiently simple single part selector matches simply because we found it from the rule hash. 2123 2121 // This is limited to HTML only so we don't need to check the namespace. 2124 if (ruleData.hasRightmostSelectorMatchingHTMLBasedOnRuleHash() && m_element->isHTMLElement()) {2122 if (ruleData.hasRightmostSelectorMatchingHTMLBasedOnRuleHash() && state.element->isHTMLElement()) { 2125 2123 if (!ruleData.hasMultipartSelector()) 2126 2124 return true; 2127 2125 } 2128 if (ruleData.selector()->m_match == CSSSelector::Tag && !SelectorChecker::tagMatches( m_element, ruleData.selector()->tagQName()))2126 if (ruleData.selector()->m_match == CSSSelector::Tag && !SelectorChecker::tagMatches(state.element, ruleData.selector()->tagQName())) 2129 2127 return false; 2130 if (!SelectorChecker::fastCheckRightmostAttributeSelector( m_element, ruleData.selector()))2128 if (!SelectorChecker::fastCheckRightmostAttributeSelector(state.element, ruleData.selector())) 2131 2129 return false; 2132 return m_selectorChecker.fastCheck(ruleData.selector(), m_element); 2130 2131 return m_selectorChecker.fastCheck(ruleData.selector(), state.element); 2133 2132 } 2134 2133 2135 2134 // Slow path. 2136 SelectorChecker::SelectorCheckingContext context(ruleData.selector(), m_element, SelectorChecker::VisitedMatchEnabled);2137 context.elementStyle = st yle();2135 SelectorChecker::SelectorCheckingContext context(ruleData.selector(), state.element, SelectorChecker::VisitedMatchEnabled); 2136 context.elementStyle = state.style.get(); 2138 2137 context.scope = scope; 2139 context.pseudoStyle = m_pseudoStyle;2140 SelectorChecker::Match match = m_selectorChecker.match(context, m_dynamicPseudo, DOMSiblingTraversalStrategy());2138 context.pseudoStyle = state.pseudoStyle; 2139 SelectorChecker::Match match = m_selectorChecker.match(context, state.dynamicPseudo, DOMSiblingTraversalStrategy()); 2141 2140 if (match != SelectorChecker::SelectorMatches) 2142 2141 return false; 2143 if ( m_pseudoStyle != NOPSEUDO && m_pseudoStyle != m_dynamicPseudo)2142 if (state.pseudoStyle != NOPSEUDO && state.pseudoStyle != state.dynamicPseudo) 2144 2143 return false; 2145 2144 return true; … … 2151 2150 return false; 2152 2151 2153 m_ pseudoStyle = NOPSEUDO;2152 m_state.pseudoStyle = NOPSEUDO; 2154 2153 2155 2154 for (const CSSSelector* s = regionSelector; s; s = CSSSelectorList::next(s)) … … 2176 2175 void StyleResolver::applyProperties(const StylePropertySet* properties, StyleRule* rule, bool isImportant, bool inheritedOnly, PropertyWhitelistType propertyWhitelistType) 2177 2176 { 2178 ASSERT((propertyWhitelistType != PropertyWhitelistRegion) || m_ regionForStyling);2177 ASSERT((propertyWhitelistType != PropertyWhitelistRegion) || m_state.regionForStyling); 2179 2178 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willProcessRule(document(), rule, this); 2180 2179 … … 2220 2219 // we apply line-height later 2221 2220 else if (property == CSSPropertyLineHeight) 2222 m_ lineHeightValue = current.value();2221 m_state.lineHeightValue = current.value(); 2223 2222 break; 2224 2223 case LowPriorityProperties: … … 2236 2235 return; 2237 2236 2238 if (m_style->insideLink() != NotInsideLink) { 2237 State& state = m_state; 2238 if (state.style->insideLink() != NotInsideLink) { 2239 2239 for (int i = startIndex; i <= endIndex; ++i) { 2240 2240 const MatchedProperties& matchedProperties = matchResult.matchedProperties[i]; 2241 2241 unsigned linkMatchType = matchedProperties.linkMatchType; 2242 2242 // FIXME: It would be nicer to pass these as arguments but that requires changes in many places. 2243 m_applyPropertyToRegularStyle = linkMatchType & SelectorChecker::MatchLink;2244 m_applyPropertyToVisitedLinkStyle = linkMatchType & SelectorChecker::MatchVisited;2243 state.applyPropertyToRegularStyle = linkMatchType & SelectorChecker::MatchLink; 2244 state.applyPropertyToVisitedLinkStyle = linkMatchType & SelectorChecker::MatchVisited; 2245 2245 2246 2246 applyProperties<pass>(matchedProperties.properties.get(), matchResult.matchedRules[i], isImportant, inheritedOnly, static_cast<PropertyWhitelistType>(matchedProperties.whitelistType)); 2247 2247 } 2248 m_applyPropertyToRegularStyle = true;2249 m_applyPropertyToVisitedLinkStyle = false;2248 state.applyPropertyToRegularStyle = true; 2249 state.applyPropertyToVisitedLinkStyle = false; 2250 2250 return; 2251 2251 } … … 2355 2355 { 2356 2356 ASSERT(element); 2357 State& state = m_state; 2357 2358 unsigned cacheHash = matchResult.isCacheable ? computeMatchedPropertiesHash(matchResult.matchedProperties.data(), matchResult.matchedProperties.size()) : 0; 2358 2359 bool applyInheritedOnly = false; … … 2362 2363 // style declarations. We then only need to apply the inherited properties, if any, as their values can depend on the 2363 2364 // element context. This is fast and saves memory by reusing the style data structures. 2364 m_style->copyNonInheritedFrom(cacheItem->renderStyle.get());2365 if ( m_parentStyle->inheritedDataShared(cacheItem->parentRenderStyle.get()) && !isAtShadowBoundary(element)) {2366 EInsideLink linkStatus = m_style->insideLink();2365 state.style->copyNonInheritedFrom(cacheItem->renderStyle.get()); 2366 if (state.parentStyle->inheritedDataShared(cacheItem->parentRenderStyle.get()) && !isAtShadowBoundary(element)) { 2367 EInsideLink linkStatus = state.style->insideLink(); 2367 2368 // If the cache item parent style has identical inherited properties to the current parent style then the 2368 2369 // resulting style will be identical too. We copy the inherited properties over from the cache and are done. 2369 m_style->inheritFrom(cacheItem->renderStyle.get());2370 state.style->inheritFrom(cacheItem->renderStyle.get()); 2370 2371 2371 2372 // Unfortunately the link status is treated like an inherited property. We need to explicitly restore it. 2372 m_style->setInsideLink(linkStatus);2373 state.style->setInsideLink(linkStatus); 2373 2374 return; 2374 2375 } … … 2388 2389 // The order is (1) high-priority not important, (2) high-priority important, (3) normal not important 2389 2390 // and (4) normal important. 2390 m_lineHeightValue = 0;2391 state.lineHeightValue = 0; 2391 2392 applyMatchedProperties<HighPriorityProperties>(matchResult, false, 0, matchResult.matchedProperties.size() - 1, applyInheritedOnly); 2392 2393 applyMatchedProperties<HighPriorityProperties>(matchResult, true, matchResult.ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInheritedOnly); … … 2394 2395 applyMatchedProperties<HighPriorityProperties>(matchResult, true, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly); 2395 2396 2396 if (cacheItem && cacheItem->renderStyle->effectiveZoom() != m_style->effectiveZoom()) {2397 m_fontDirty = true;2397 if (cacheItem && cacheItem->renderStyle->effectiveZoom() != state.style->effectiveZoom()) { 2398 state.fontDirty = true; 2398 2399 applyInheritedOnly = false; 2399 2400 } … … 2403 2404 2404 2405 // Line-height is set when we are sure we decided on the font-size. 2405 if ( m_lineHeightValue)2406 applyProperty(CSSPropertyLineHeight, m_lineHeightValue);2406 if (state.lineHeightValue) 2407 applyProperty(CSSPropertyLineHeight, state.lineHeightValue); 2407 2408 2408 2409 // Many properties depend on the font. If it changes we just apply all properties. 2409 if (cacheItem && cacheItem->renderStyle->fontDescription() != m_style->fontDescription())2410 if (cacheItem && cacheItem->renderStyle->fontDescription() != state.style->fontDescription()) 2410 2411 applyInheritedOnly = false; 2411 2412 … … 2425 2426 loadPendingResources(); 2426 2427 2427 ASSERT(! m_fontDirty);2428 ASSERT(!state.fontDirty); 2428 2429 2429 2430 if (cacheItem || !cacheHash) 2430 2431 return; 2431 if (!isCacheableInMatchedPropertiesCache( m_element, m_style.get(), m_parentStyle))2432 return; 2433 addToMatchedPropertiesCache( m_style.get(), m_parentStyle, cacheHash, matchResult);2432 if (!isCacheableInMatchedPropertiesCache(state.element, state.style.get(), state.parentStyle)) 2433 return; 2434 addToMatchedPropertiesCache(state.style.get(), state.parentStyle, cacheHash, matchResult); 2434 2435 } 2435 2436 … … 2496 2497 { 2497 2498 bool isFirstPageLeft = false; 2498 if (!m_ rootElementStyle->isLeftToRightDirection())2499 if (!m_state.rootElementStyle->isLeftToRightDirection()) 2499 2500 isFirstPageLeft = true; 2500 2501 … … 2609 2610 initElement(0); 2610 2611 initForStyleResolve(0, style); 2611 m_st yle = style;2612 m_state.style = style; 2612 2613 applyPropertyToCurrentStyle(id, value); 2613 2614 } … … 2721 2722 bool StyleResolver::useSVGZoomRules() 2722 2723 { 2723 return m_ element && m_element->isSVGElement();2724 } 2725 2726 static bool createGridTrackBreadth(CSSPrimitiveValue* primitiveValue, StyleResolver* selector, Length& workingLength)2724 return m_state.element && m_state.element->isSVGElement(); 2725 } 2726 2727 static bool createGridTrackBreadth(CSSPrimitiveValue* primitiveValue, const StyleResolver::State& state, Length& workingLength) 2727 2728 { 2728 2729 if (primitiveValue->getIdent() == CSSValueWebkitMinContent) { … … 2736 2737 } 2737 2738 2738 workingLength = primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | ViewportPercentageConversion | AutoConversion>(s elector->style(), selector->rootElementStyle(), selector->style()->effectiveZoom());2739 workingLength = primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | ViewportPercentageConversion | AutoConversion>(state.style.get(), state.rootElementStyle, state.style->effectiveZoom()); 2739 2740 if (workingLength.isUndefined()) 2740 2741 return false; … … 2746 2747 } 2747 2748 2748 static bool createGridTrackMinMax(CSSPrimitiveValue* primitiveValue, StyleResolver* selector, GridTrackSize& trackSize)2749 static bool createGridTrackMinMax(CSSPrimitiveValue* primitiveValue, const StyleResolver::State& state, GridTrackSize& trackSize) 2749 2750 { 2750 2751 Pair* minMaxTrackBreadth = primitiveValue->getPairValue(); 2751 2752 if (!minMaxTrackBreadth) { 2752 2753 Length workingLength; 2753 if (!createGridTrackBreadth(primitiveValue, s elector, workingLength))2754 if (!createGridTrackBreadth(primitiveValue, state, workingLength)) 2754 2755 return false; 2755 2756 … … 2760 2761 Length minTrackBreadth; 2761 2762 Length maxTrackBreadth; 2762 if (!createGridTrackBreadth(minMaxTrackBreadth->first(), s elector, minTrackBreadth) || !createGridTrackBreadth(minMaxTrackBreadth->second(), selector, maxTrackBreadth))2763 if (!createGridTrackBreadth(minMaxTrackBreadth->first(), state, minTrackBreadth) || !createGridTrackBreadth(minMaxTrackBreadth->second(), state, maxTrackBreadth)) 2763 2764 return false; 2764 2765 … … 2767 2768 } 2768 2769 2769 static bool createGridTrackGroup(CSSValue* value, StyleResolver* selector, Vector<GridTrackSize>& trackSizes)2770 static bool createGridTrackGroup(CSSValue* value, const StyleResolver::State& state, Vector<GridTrackSize>& trackSizes) 2770 2771 { 2771 2772 if (!value->isValueList()) … … 2778 2779 2779 2780 GridTrackSize trackSize; 2780 if (!createGridTrackMinMax(static_cast<CSSPrimitiveValue*>(currValue), s elector, trackSize))2781 if (!createGridTrackMinMax(static_cast<CSSPrimitiveValue*>(currValue), state, trackSize)) 2781 2782 return false; 2782 2783 … … 2786 2787 } 2787 2788 2788 static bool createGridTrackList(CSSValue* value, Vector<GridTrackSize>& trackSizes, StyleResolver* selector)2789 static bool createGridTrackList(CSSValue* value, Vector<GridTrackSize>& trackSizes, const StyleResolver::State& state) 2789 2790 { 2790 2791 // Handle 'none'. … … 2794 2795 } 2795 2796 2796 return createGridTrackGroup(value, s elector, trackSizes);2797 return createGridTrackGroup(value, state, trackSizes); 2797 2798 } 2798 2799 … … 2842 2843 void StyleResolver::resolveVariables(CSSPropertyID id, CSSValue* value, Vector<std::pair<CSSPropertyID, String> >& knownExpressions) 2843 2844 { 2844 std::pair<CSSPropertyID, String> expression(id, value->serializeResolvingVariables(* style()->variables()));2845 std::pair<CSSPropertyID, String> expression(id, value->serializeResolvingVariables(*m_state.style->variables())); 2845 2846 2846 2847 if (knownExpressions.contains(expression)) … … 2874 2875 #endif 2875 2876 2876 bool isInherit = m_parentNode && value->isInheritedValue(); 2877 bool isInitial = value->isInitialValue() || (!m_parentNode && value->isInheritedValue()); 2877 State& state = m_state; 2878 bool isInherit = state.parentNode && value->isInheritedValue(); 2879 bool isInitial = value->isInitialValue() || (!state.parentNode && value->isInheritedValue()); 2878 2880 2879 2881 ASSERT(!isInherit || !isInitial); // isInherit -> !isInitial && isInitial -> !isInherit 2880 ASSERT(!isInherit || ( m_parentNode && m_parentStyle)); // isInherit -> (m_parentNode && m_parentStyle)2881 2882 if (! applyPropertyToRegularStyle() && (!applyPropertyToVisitedLinkStyle()|| !isValidVisitedLinkProperty(id))) {2882 ASSERT(!isInherit || (state.parentNode && state.parentStyle)); // isInherit -> (state.parentNode && state.parentStyle) 2883 2884 if (!state.applyPropertyToRegularStyle && (!state.applyPropertyToVisitedLinkStyle || !isValidVisitedLinkProperty(id))) { 2883 2885 // Limit the properties that can be applied to only the ones honored by :visited. 2884 2886 return; 2885 2887 } 2886 2888 2887 if (isInherit && ! m_parentStyle->hasExplicitlyInheritedProperties() && !CSSProperty::isInheritedProperty(id))2888 m_parentStyle->setHasExplicitlyInheritedProperties();2889 if (isInherit && !state.parentStyle->hasExplicitlyInheritedProperties() && !CSSProperty::isInheritedProperty(id)) 2890 state.parentStyle->setHasExplicitlyInheritedProperties(); 2889 2891 2890 2892 #if ENABLE(CSS_VARIABLES) … … 2894 2896 ASSERT(!variable->name().isEmpty()); 2895 2897 ASSERT(!variable->value().isEmpty()); 2896 m_style->setVariable(variable->name(), variable->value());2898 state.style->setVariable(variable->name(), variable->value()); 2897 2899 return; 2898 2900 } … … 2913 2915 CSSPrimitiveValue* primitiveValue = value->isPrimitiveValue() ? static_cast<CSSPrimitiveValue*>(value) : 0; 2914 2916 2915 float zoomFactor = m_style->effectiveZoom();2917 float zoomFactor = state.style->effectiveZoom(); 2916 2918 2917 2919 // What follows is a list that maps the CSS properties into their corresponding front-end … … 2927 2929 2928 2930 if (isInitial) { 2929 m_style->clearContent();2931 state.style->clearContent(); 2930 2932 return; 2931 2933 } … … 2939 2941 if (item->isImageGeneratorValue()) { 2940 2942 if (item->isGradientValue()) 2941 m_style->setContent(StyleGeneratedImage::create(static_cast<CSSGradientValue*>(item)->gradientWithStylesResolved(this).get()), didSet);2943 state.style->setContent(StyleGeneratedImage::create(static_cast<CSSGradientValue*>(item)->gradientWithStylesResolved(this).get()), didSet); 2942 2944 else 2943 m_style->setContent(StyleGeneratedImage::create(static_cast<CSSImageGeneratorValue*>(item)), didSet);2945 state.style->setContent(StyleGeneratedImage::create(static_cast<CSSImageGeneratorValue*>(item)), didSet); 2944 2946 didSet = true; 2945 2947 #if ENABLE(CSS_IMAGE_SET) 2946 2948 } else if (item->isImageSetValue()) { 2947 m_style->setContent(setOrPendingFromValue(CSSPropertyContent, static_cast<CSSImageSetValue*>(item)), didSet);2949 state.style->setContent(setOrPendingFromValue(CSSPropertyContent, static_cast<CSSImageSetValue*>(item)), didSet); 2948 2950 didSet = true; 2949 2951 #endif … … 2951 2953 2952 2954 if (item->isImageValue()) { 2953 m_style->setContent(cachedOrPendingFromValue(CSSPropertyContent, static_cast<CSSImageValue*>(item)), didSet);2955 state.style->setContent(cachedOrPendingFromValue(CSSPropertyContent, static_cast<CSSImageValue*>(item)), didSet); 2954 2956 didSet = true; 2955 2957 continue; … … 2962 2964 2963 2965 if (contentValue->isString()) { 2964 m_style->setContent(contentValue->getStringValue().impl(), didSet);2966 state.style->setContent(contentValue->getStringValue().impl(), didSet); 2965 2967 didSet = true; 2966 2968 } else if (contentValue->isAttr()) { 2967 2969 // FIXME: Can a namespace be specified for an attr(foo)? 2968 if ( m_style->styleType() == NOPSEUDO)2969 m_style->setUnique();2970 if (state.style->styleType() == NOPSEUDO) 2971 state.style->setUnique(); 2970 2972 else 2971 m_parentStyle->setUnique();2973 state.parentStyle->setUnique(); 2972 2974 QualifiedName attr(nullAtom, contentValue->getStringValue().impl(), nullAtom); 2973 const AtomicString& value = m_element->getAttribute(attr);2974 m_style->setContent(value.isNull() ? emptyAtom : value.impl(), didSet);2975 const AtomicString& value = state.element->getAttribute(attr); 2976 state.style->setContent(value.isNull() ? emptyAtom : value.impl(), didSet); 2975 2977 didSet = true; 2976 2978 // register the fact that the attribute value affects the style … … 2983 2985 listStyleType = static_cast<EListStyleType>(listStyleIdent - CSSValueDisc); 2984 2986 OwnPtr<CounterContent> counter = adoptPtr(new CounterContent(counterValue->identifier(), listStyleType, counterValue->separator())); 2985 m_style->setContent(counter.release(), didSet);2987 state.style->setContent(counter.release(), didSet); 2986 2988 didSet = true; 2987 2989 } else { 2988 2990 switch (contentValue->getIdent()) { 2989 2991 case CSSValueOpenQuote: 2990 m_style->setContent(OPEN_QUOTE, didSet);2992 state.style->setContent(OPEN_QUOTE, didSet); 2991 2993 didSet = true; 2992 2994 break; 2993 2995 case CSSValueCloseQuote: 2994 m_style->setContent(CLOSE_QUOTE, didSet);2996 state.style->setContent(CLOSE_QUOTE, didSet); 2995 2997 didSet = true; 2996 2998 break; 2997 2999 case CSSValueNoOpenQuote: 2998 m_style->setContent(NO_OPEN_QUOTE, didSet);3000 state.style->setContent(NO_OPEN_QUOTE, didSet); 2999 3001 didSet = true; 3000 3002 break; 3001 3003 case CSSValueNoCloseQuote: 3002 m_style->setContent(NO_CLOSE_QUOTE, didSet);3004 state.style->setContent(NO_CLOSE_QUOTE, didSet); 3003 3005 didSet = true; 3004 3006 break; … … 3010 3012 } 3011 3013 if (!didSet) 3012 m_style->clearContent();3014 state.style->clearContent(); 3013 3015 return; 3014 3016 } 3015 3017 case CSSPropertyQuotes: 3016 3018 if (isInherit) { 3017 m_style->setQuotes(m_parentStyle->quotes());3019 state.style->setQuotes(state.parentStyle->quotes()); 3018 3020 return; 3019 3021 } 3020 3022 if (isInitial) { 3021 m_style->setQuotes(0);3023 state.style->setQuotes(0); 3022 3024 return; 3023 3025 } … … 3037 3039 quotes->addPair(std::make_pair(startQuote, endQuote)); 3038 3040 } 3039 m_style->setQuotes(quotes);3041 state.style->setQuotes(quotes); 3040 3042 return; 3041 3043 } 3042 3044 if (primitiveValue) { 3043 3045 if (primitiveValue->getIdent() == CSSValueNone) 3044 m_style->setQuotes(QuotesData::create());3046 state.style->setQuotes(QuotesData::create()); 3045 3047 } 3046 3048 return; … … 3048 3050 // list of strings and ids 3049 3051 if (isInherit) { 3050 FontDescription parentFontDescription = m_parentStyle->fontDescription();3051 FontDescription fontDescription = m_style->fontDescription();3052 FontDescription parentFontDescription = state.parentStyle->fontDescription(); 3053 FontDescription fontDescription = state.style->fontDescription(); 3052 3054 fontDescription.setGenericFamily(parentFontDescription.genericFamily()); 3053 3055 fontDescription.setFamily(parentFontDescription.firstFamily()); … … 3059 3061 if (isInitial) { 3060 3062 FontDescription initialDesc = FontDescription(); 3061 FontDescription fontDescription = m_style->fontDescription();3063 FontDescription fontDescription = state.style->fontDescription(); 3062 3064 // We need to adjust the size to account for the generic family change from monospace 3063 3065 // to non-monospace. … … 3073 3075 if (!value->isValueList()) 3074 3076 return; 3075 FontDescription fontDescription = m_style->fontDescription();3077 FontDescription fontDescription = state.style->fontDescription(); 3076 3078 FontFamily& firstFamily = fontDescription.firstFamily(); 3077 3079 FontFamily* currFamily = 0; … … 3151 3153 case CSSPropertyBackground: 3152 3154 if (isInitial) { 3153 m_style->clearBackgroundLayers();3154 m_style->setBackgroundColor(Color());3155 state.style->clearBackgroundLayers(); 3156 state.style->setBackgroundColor(Color()); 3155 3157 } else if (isInherit) { 3156 m_style->inheritBackgroundLayers(*m_parentStyle->backgroundLayers());3157 m_style->setBackgroundColor(m_parentStyle->backgroundColor());3158 state.style->inheritBackgroundLayers(*state.parentStyle->backgroundLayers()); 3159 state.style->setBackgroundColor(state.parentStyle->backgroundColor()); 3158 3160 } 3159 3161 return; 3160 3162 case CSSPropertyWebkitMask: 3161 3163 if (isInitial) 3162 m_style->clearMaskLayers();3164 state.style->clearMaskLayers(); 3163 3165 else if (isInherit) 3164 m_style->inheritMaskLayers(*m_parentStyle->maskLayers());3166 state.style->inheritMaskLayers(*state.parentStyle->maskLayers()); 3165 3167 return; 3166 3168 case CSSPropertyFont: 3167 3169 if (isInherit) { 3168 FontDescription fontDescription = m_parentStyle->fontDescription();3169 m_style->setLineHeight(m_parentStyle->specifiedLineHeight());3170 m_lineHeightValue = 0;3170 FontDescription fontDescription = state.parentStyle->fontDescription(); 3171 state.style->setLineHeight(state.parentStyle->specifiedLineHeight()); 3172 state.lineHeightValue = 0; 3171 3173 setFontDescription(fontDescription); 3172 3174 } else if (isInitial) { … … 3177 3179 initializeFontStyle(settings); 3178 3180 } else if (primitiveValue) { 3179 m_style->setLineHeight(RenderStyle::initialLineHeight());3180 m_lineHeightValue = 0;3181 state.style->setLineHeight(RenderStyle::initialLineHeight()); 3182 state.lineHeightValue = 0; 3181 3183 3182 3184 FontDescription fontDescription; … … 3194 3196 3195 3197 // Handle the zoom factor. 3196 fontDescription.setComputedSize(getComputedSizeFromSpecifiedSize(document(), m_style.get(), fontDescription.isAbsoluteSize(), fontDescription.specifiedSize(), useSVGZoomRules()));3198 fontDescription.setComputedSize(getComputedSizeFromSpecifiedSize(document(), state.style.get(), fontDescription.isAbsoluteSize(), fontDescription.specifiedSize(), useSVGZoomRules())); 3197 3199 setFontDescription(fontDescription); 3198 3200 } … … 3212 3214 applyProperty(CSSPropertyFontSize, font->size.get()); 3213 3215 3214 m_lineHeightValue = font->lineHeight.get();3216 state.lineHeightValue = font->lineHeight.get(); 3215 3217 3216 3218 applyProperty(CSSPropertyFontFamily, font->family.get()); … … 3224 3226 if (isInherit) { 3225 3227 if (id == CSSPropertyTextShadow) 3226 return m_style->setTextShadow(m_parentStyle->textShadow() ? adoptPtr(new ShadowData(*m_parentStyle->textShadow())) : nullptr);3227 return m_style->setBoxShadow(m_parentStyle->boxShadow() ? adoptPtr(new ShadowData(*m_parentStyle->boxShadow())) : nullptr);3228 return state.style->setTextShadow(state.parentStyle->textShadow() ? adoptPtr(new ShadowData(*state.parentStyle->textShadow())) : nullptr); 3229 return state.style->setBoxShadow(state.parentStyle->boxShadow() ? adoptPtr(new ShadowData(*state.parentStyle->boxShadow())) : nullptr); 3228 3230 } 3229 3231 if (isInitial || primitiveValue) // initial | none 3230 return id == CSSPropertyTextShadow ? m_style->setTextShadow(nullptr) : m_style->setBoxShadow(nullptr);3232 return id == CSSPropertyTextShadow ? state.style->setTextShadow(nullptr) : state.style->setBoxShadow(nullptr); 3231 3233 3232 3234 if (!value->isValueList()) … … 3238 3240 continue; 3239 3241 ShadowValue* item = static_cast<ShadowValue*>(currValue); 3240 int x = item->x->computeLength<int>(st yle(), m_rootElementStyle, zoomFactor);3241 int y = item->y->computeLength<int>(st yle(), m_rootElementStyle, zoomFactor);3242 int blur = item->blur ? item->blur->computeLength<int>(st yle(), m_rootElementStyle, zoomFactor) : 0;3243 int spread = item->spread ? item->spread->computeLength<int>(st yle(), m_rootElementStyle, zoomFactor) : 0;3242 int x = item->x->computeLength<int>(state.style.get(), state.rootElementStyle, zoomFactor); 3243 int y = item->y->computeLength<int>(state.style.get(), state.rootElementStyle, zoomFactor); 3244 int blur = item->blur ? item->blur->computeLength<int>(state.style.get(), state.rootElementStyle, zoomFactor) : 0; 3245 int spread = item->spread ? item->spread->computeLength<int>(state.style.get(), state.rootElementStyle, zoomFactor) : 0; 3244 3246 ShadowStyle shadowStyle = item->style && item->style->getIdent() == CSSValueInset ? Inset : Normal; 3245 3247 Color color; 3246 3248 if (item->color) 3247 3249 color = colorFromPrimitiveValue(item->color.get()); 3248 else if ( m_style)3249 color = m_style->color();3250 else if (state.style) 3251 color = state.style->color(); 3250 3252 3251 3253 OwnPtr<ShadowData> shadowData = adoptPtr(new ShadowData(IntPoint(x, y), blur, spread, shadowStyle, id == CSSPropertyWebkitBoxShadow, color.isValid() ? color : Color::transparent)); 3252 3254 if (id == CSSPropertyTextShadow) 3253 m_style->setTextShadow(shadowData.release(), i.index()); // add to the list if this is not the first entry3255 state.style->setTextShadow(shadowData.release(), i.index()); // add to the list if this is not the first entry 3254 3256 else 3255 m_style->setBoxShadow(shadowData.release(), i.index()); // add to the list if this is not the first entry3257 state.style->setBoxShadow(shadowData.release(), i.index()); // add to the list if this is not the first entry 3256 3258 } 3257 3259 return; … … 3260 3262 HANDLE_INHERIT_AND_INITIAL(boxReflect, BoxReflect) 3261 3263 if (primitiveValue) { 3262 m_style->setBoxReflect(RenderStyle::initialBoxReflect());3264 state.style->setBoxReflect(RenderStyle::initialBoxReflect()); 3263 3265 return; 3264 3266 } … … 3271 3273 reflection->setDirection(*reflectValue->direction()); 3272 3274 if (reflectValue->offset()) 3273 reflection->setOffset(reflectValue->offset()->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion>(st yle(), m_rootElementStyle, zoomFactor));3275 reflection->setOffset(reflectValue->offset()->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion>(state.style.get(), state.rootElementStyle, zoomFactor)); 3274 3276 NinePieceImage mask; 3275 3277 mask.setMaskDefaults(); … … 3277 3279 reflection->setMask(mask); 3278 3280 3279 m_style->setBoxReflect(reflection.release());3281 state.style->setBoxReflect(reflection.release()); 3280 3282 return; 3281 3283 } … … 3286 3288 case CSSPropertyWebkitColumnRule: 3287 3289 if (isInherit) { 3288 m_style->setColumnRuleColor(m_parentStyle->columnRuleColor().isValid() ? m_parentStyle->columnRuleColor() : m_parentStyle->color());3289 m_style->setColumnRuleStyle(m_parentStyle->columnRuleStyle());3290 m_style->setColumnRuleWidth(m_parentStyle->columnRuleWidth());3290 state.style->setColumnRuleColor(state.parentStyle->columnRuleColor().isValid() ? state.parentStyle->columnRuleColor() : state.parentStyle->color()); 3291 state.style->setColumnRuleStyle(state.parentStyle->columnRuleStyle()); 3292 state.style->setColumnRuleWidth(state.parentStyle->columnRuleWidth()); 3291 3293 } else if (isInitial) 3292 m_style->resetColumnRule();3294 state.style->resetColumnRule(); 3293 3295 return; 3294 3296 case CSSPropertyWebkitMarquee: 3295 3297 if (!isInherit) 3296 3298 return; 3297 m_style->setMarqueeDirection(m_parentStyle->marqueeDirection());3298 m_style->setMarqueeIncrement(m_parentStyle->marqueeIncrement());3299 m_style->setMarqueeSpeed(m_parentStyle->marqueeSpeed());3300 m_style->setMarqueeLoopCount(m_parentStyle->marqueeLoopCount());3301 m_style->setMarqueeBehavior(m_parentStyle->marqueeBehavior());3299 state.style->setMarqueeDirection(state.parentStyle->marqueeDirection()); 3300 state.style->setMarqueeIncrement(state.parentStyle->marqueeIncrement()); 3301 state.style->setMarqueeSpeed(state.parentStyle->marqueeSpeed()); 3302 state.style->setMarqueeLoopCount(state.parentStyle->marqueeLoopCount()); 3303 state.style->setMarqueeBehavior(state.parentStyle->marqueeBehavior()); 3302 3304 return; 3303 3305 case CSSPropertyWebkitMarqueeRepetition: { … … 3306 3308 return; 3307 3309 if (primitiveValue->getIdent() == CSSValueInfinite) 3308 m_style->setMarqueeLoopCount(-1); // -1 means repeat forever.3310 state.style->setMarqueeLoopCount(-1); // -1 means repeat forever. 3309 3311 else if (primitiveValue->isNumber()) 3310 m_style->setMarqueeLoopCount(primitiveValue->getIntValue());3312 state.style->setMarqueeLoopCount(primitiveValue->getIntValue()); 3311 3313 return; 3312 3314 } … … 3318 3320 switch (ident) { 3319 3321 case CSSValueSlow: 3320 m_style->setMarqueeSpeed(500); // 500 msec.3322 state.style->setMarqueeSpeed(500); // 500 msec. 3321 3323 break; 3322 3324 case CSSValueNormal: 3323 m_style->setMarqueeSpeed(85); // 85msec. The WinIE default.3325 state.style->setMarqueeSpeed(85); // 85msec. The WinIE default. 3324 3326 break; 3325 3327 case CSSValueFast: 3326 m_style->setMarqueeSpeed(10); // 10msec. Super fast.3328 state.style->setMarqueeSpeed(10); // 10msec. Super fast. 3327 3329 break; 3328 3330 } 3329 3331 } else if (primitiveValue->isTime()) 3330 m_style->setMarqueeSpeed(primitiveValue->computeTime<int, CSSPrimitiveValue::Milliseconds>());3332 state.style->setMarqueeSpeed(primitiveValue->computeTime<int, CSSPrimitiveValue::Milliseconds>()); 3331 3333 else if (primitiveValue->isNumber()) // For scrollamount support. 3332 m_style->setMarqueeSpeed(primitiveValue->getIntValue());3334 state.style->setMarqueeSpeed(primitiveValue->getIntValue()); 3333 3335 return; 3334 3336 } … … 3340 3342 switch (primitiveValue->getIdent()) { 3341 3343 case CSSValueSmall: 3342 m_style->setMarqueeIncrement(Length(1, Fixed)); // 1px.3344 state.style->setMarqueeIncrement(Length(1, Fixed)); // 1px. 3343 3345 break; 3344 3346 case CSSValueNormal: 3345 m_style->setMarqueeIncrement(Length(6, Fixed)); // 6px. The WinIE default.3347 state.style->setMarqueeIncrement(Length(6, Fixed)); // 6px. The WinIE default. 3346 3348 break; 3347 3349 case CSSValueLarge: 3348 m_style->setMarqueeIncrement(Length(36, Fixed)); // 36px.3350 state.style->setMarqueeIncrement(Length(36, Fixed)); // 36px. 3349 3351 break; 3350 3352 } 3351 3353 } else { 3352 Length marqueeLength = convertToIntLength(primitiveValue, st yle(), m_rootElementStyle);3354 Length marqueeLength = convertToIntLength(primitiveValue, state.style.get(), state.rootElementStyle); 3353 3355 if (!marqueeLength.isUndefined()) 3354 m_style->setMarqueeIncrement(marqueeLength);3356 state.style->setMarqueeIncrement(marqueeLength); 3355 3357 } 3356 3358 return; … … 3361 3363 return; 3362 3364 if (primitiveValue->getIdent() == CSSValueAuto) 3363 m_style->setLocale(nullAtom);3365 state.style->setLocale(nullAtom); 3364 3366 else 3365 m_style->setLocale(primitiveValue->getStringValue());3366 FontDescription fontDescription = m_style->fontDescription();3367 fontDescription.setScript(localeToScriptCodeForFontSelection( m_style->locale()));3367 state.style->setLocale(primitiveValue->getStringValue()); 3368 FontDescription fontDescription = state.style->fontDescription(); 3369 fontDescription.setScript(localeToScriptCodeForFontSelection(state.style->locale())); 3368 3370 setFontDescription(fontDescription); 3369 3371 return; … … 3384 3386 3385 3387 if (primitiveValue->getIdent() == CSSValueNone) { 3386 m_style->setDashboardRegions(RenderStyle::noneDashboardRegions());3388 state.style->setDashboardRegions(RenderStyle::noneDashboardRegions()); 3387 3389 return; 3388 3390 } … … 3394 3396 DashboardRegion* first = region; 3395 3397 while (region) { 3396 Length top = convertToIntLength(region->top(), st yle(), m_rootElementStyle);3397 Length right = convertToIntLength(region->right(), st yle(), m_rootElementStyle);3398 Length bottom = convertToIntLength(region->bottom(), st yle(), m_rootElementStyle);3399 Length left = convertToIntLength(region->left(), st yle(), m_rootElementStyle);3398 Length top = convertToIntLength(region->top(), state.style.get(), state.rootElementStyle); 3399 Length right = convertToIntLength(region->right(), state.style.get(), state.rootElementStyle); 3400 Length bottom = convertToIntLength(region->bottom(), state.style.get(), state.rootElementStyle); 3401 Length left = convertToIntLength(region->left(), state.style.get(), state.rootElementStyle); 3400 3402 3401 3403 if (top.isUndefined()) … … 3409 3411 3410 3412 if (region->m_isCircle) 3411 m_style->setDashboardRegion(StyleDashboardRegion::Circle, region->m_label, top, right, bottom, left, region == first ? false : true);3413 state.style->setDashboardRegion(StyleDashboardRegion::Circle, region->m_label, top, right, bottom, left, region == first ? false : true); 3412 3414 else if (region->m_isRectangle) 3413 m_style->setDashboardRegion(StyleDashboardRegion::Rectangle, region->m_label, top, right, bottom, left, region == first ? false : true);3415 state.style->setDashboardRegion(StyleDashboardRegion::Rectangle, region->m_label, top, right, bottom, left, region == first ? false : true); 3414 3416 region = region->m_next.get(); 3415 3417 } 3416 3418 3417 m_element->document()->setHasAnnotatedRegions(true);3419 state.element->document()->setHasAnnotatedRegions(true); 3418 3420 3419 3421 return; … … 3424 3426 if (!primitiveValue || !primitiveValue->getIdent()) 3425 3427 return; 3426 m_style->setDraggableRegionMode(primitiveValue->getIdent() == CSSValueDrag ? DraggableRegionDrag : DraggableRegionNoDrag);3427 m_element->document()->setHasAnnotatedRegions(true);3428 state.style->setDraggableRegionMode(primitiveValue->getIdent() == CSSValueDrag ? DraggableRegionDrag : DraggableRegionNoDrag); 3429 state.element->document()->setHasAnnotatedRegions(true); 3428 3430 return; 3429 3431 } … … 3441 3443 else if (primitiveValue->getIdent() == CSSValueThick) 3442 3444 result *= 5; 3443 width = CSSPrimitiveValue::create(result, CSSPrimitiveValue::CSS_EMS)->computeLength<float>(st yle(), m_rootElementStyle, zoomFactor);3445 width = CSSPrimitiveValue::create(result, CSSPrimitiveValue::CSS_EMS)->computeLength<float>(state.style.get(), state.rootElementStyle, zoomFactor); 3444 3446 break; 3445 3447 } 3446 3448 default: 3447 width = primitiveValue->computeLength<float>(st yle(), m_rootElementStyle, zoomFactor);3449 width = primitiveValue->computeLength<float>(state.style.get(), state.rootElementStyle, zoomFactor); 3448 3450 break; 3449 3451 } 3450 m_style->setTextStrokeWidth(width);3452 state.style->setTextStrokeWidth(width); 3451 3453 return; 3452 3454 } … … 3454 3456 HANDLE_INHERIT_AND_INITIAL(transform, Transform); 3455 3457 TransformOperations operations; 3456 createTransformOperations(value, st yle(), m_rootElementStyle, operations);3457 m_style->setTransform(operations);3458 createTransformOperations(value, state.style.get(), state.rootElementStyle, operations); 3459 state.style->setTransform(operations); 3458 3460 return; 3459 3461 } … … 3465 3467 3466 3468 if (primitiveValue->getIdent() == CSSValueNone) { 3467 m_style->setPerspective(0);3469 state.style->setPerspective(0); 3468 3470 return; 3469 3471 } … … 3471 3473 float perspectiveValue; 3472 3474 if (primitiveValue->isLength()) 3473 perspectiveValue = primitiveValue->computeLength<float>(st yle(), m_rootElementStyle, zoomFactor);3475 perspectiveValue = primitiveValue->computeLength<float>(state.style.get(), state.rootElementStyle, zoomFactor); 3474 3476 else if (primitiveValue->isNumber()) { 3475 3477 // For backward compatibility, treat valueless numbers as px. 3476 perspectiveValue = CSSPrimitiveValue::create(primitiveValue->getDoubleValue(), CSSPrimitiveValue::CSS_PX)->computeLength<float>(st yle(), m_rootElementStyle, zoomFactor);3478 perspectiveValue = CSSPrimitiveValue::create(primitiveValue->getDoubleValue(), CSSPrimitiveValue::CSS_PX)->computeLength<float>(state.style.get(), state.rootElementStyle, zoomFactor); 3477 3479 } else 3478 3480 return; 3479 3481 3480 3482 if (perspectiveValue >= 0.0f) 3481 m_style->setPerspective(perspectiveValue);3483 state.style->setPerspective(perspectiveValue); 3482 3484 return; 3483 3485 } 3484 3486 case CSSPropertyWebkitAnimation: 3485 3487 if (isInitial) 3486 m_style->clearAnimations();3488 state.style->clearAnimations(); 3487 3489 else if (isInherit) 3488 m_style->inheritAnimations(m_parentStyle->animations());3490 state.style->inheritAnimations(state.parentStyle->animations()); 3489 3491 return; 3490 3492 case CSSPropertyWebkitTransition: 3491 3493 if (isInitial) 3492 m_style->clearTransitions();3494 state.style->clearTransitions(); 3493 3495 else if (isInherit) 3494 m_style->inheritTransitions(m_parentStyle->transitions());3496 state.style->inheritTransitions(state.parentStyle->transitions()); 3495 3497 return; 3496 3498 #if ENABLE(TOUCH_EVENTS) … … 3501 3503 3502 3504 Color col = colorFromPrimitiveValue(primitiveValue); 3503 m_style->setTapHighlightColor(col);3505 state.style->setTapHighlightColor(col); 3504 3506 return; 3505 3507 } … … 3510 3512 if (!primitiveValue) 3511 3513 break; 3512 m_style->setUseTouchOverflowScrolling(primitiveValue->getIdent() == CSSValueTouch);3514 state.style->setUseTouchOverflowScrolling(primitiveValue->getIdent() == CSSValueTouch); 3513 3515 return; 3514 3516 } … … 3553 3555 case CSSPropertyWebkitMaxLogicalHeight: 3554 3556 { 3555 CSSPropertyID newId = CSSProperty::resolveDirectionAwareProperty(id, m_style->direction(), m_style->writingMode());3557 CSSPropertyID newId = CSSProperty::resolveDirectionAwareProperty(id, state.style->direction(), state.style->writingMode()); 3556 3558 ASSERT(newId != id); 3557 3559 return applyProperty(newId, value); … … 3588 3590 3589 3591 // FIXME: It is not ok to modify document state while applying style. 3590 if (m_element && m_element == m_element->document()->documentElement()) 3591 m_element->document()->setWritingModeSetOnDocumentElement(true); 3592 3592 if (state.element && state.element == state.element->document()->documentElement()) 3593 state.element->document()->setWritingModeSetOnDocumentElement(true); 3593 3594 return; 3594 3595 } … … 3606 3607 HANDLE_INHERIT_AND_INITIAL(lineBoxContain, LineBoxContain) 3607 3608 if (primitiveValue && primitiveValue->getIdent() == CSSValueNone) { 3608 m_style->setLineBoxContain(LineBoxContainNone);3609 state.style->setLineBoxContain(LineBoxContainNone); 3609 3610 return; 3610 3611 } … … 3614 3615 3615 3616 CSSLineBoxContainValue* lineBoxContainValue = static_cast<CSSLineBoxContainValue*>(value); 3616 m_style->setLineBoxContain(lineBoxContainValue->value());3617 state.style->setLineBoxContain(lineBoxContainValue->value()); 3617 3618 return; 3618 3619 } … … 3621 3622 case CSSPropertyWebkitFontFeatureSettings: { 3622 3623 if (primitiveValue && primitiveValue->getIdent() == CSSValueNormal) { 3623 setFontDescription( m_style->fontDescription().makeNormalFeatureSettings());3624 setFontDescription(state.style->fontDescription().makeNormalFeatureSettings()); 3624 3625 return; 3625 3626 } … … 3628 3629 return; 3629 3630 3630 FontDescription fontDescription = m_style->fontDescription();3631 FontDescription fontDescription = state.style->fontDescription(); 3631 3632 CSSValueList* list = static_cast<CSSValueList*>(value); 3632 3633 RefPtr<FontFeatureSettings> settings = FontFeatureSettings::create(); … … 3648 3649 HANDLE_INHERIT_AND_INITIAL(filter, Filter); 3649 3650 FilterOperations operations; 3650 if (createFilterOperations(value, st yle(), m_rootElementStyle, operations))3651 m_style->setFilter(operations);3651 if (createFilterOperations(value, state.style.get(), state.rootElementStyle, operations)) 3652 state.style->setFilter(operations); 3652 3653 return; 3653 3654 } … … 3655 3656 case CSSPropertyWebkitGridColumns: { 3656 3657 Vector<GridTrackSize> trackSizes; 3657 if (!createGridTrackList(value, trackSizes, this))3658 if (!createGridTrackList(value, trackSizes, state)) 3658 3659 return; 3659 m_style->setGridColumns(trackSizes);3660 state.style->setGridColumns(trackSizes); 3660 3661 return; 3661 3662 } 3662 3663 case CSSPropertyWebkitGridRows: { 3663 3664 Vector<GridTrackSize> trackSizes; 3664 if (!createGridTrackList(value, trackSizes, this))3665 if (!createGridTrackList(value, trackSizes, state)) 3665 3666 return; 3666 m_style->setGridRows(trackSizes);3667 state.style->setGridRows(trackSizes); 3667 3668 return; 3668 3669 } … … 3672 3673 if (!createGridPosition(value, column)) 3673 3674 return; 3674 m_style->setGridItemColumn(column);3675 state.style->setGridItemColumn(column); 3675 3676 return; 3676 3677 } … … 3679 3680 if (!createGridPosition(value, row)) 3680 3681 return; 3681 m_style->setGridItemRow(row);3682 state.style->setGridItemRow(row); 3682 3683 return; 3683 3684 } … … 4001 4002 RefPtr<StyleImage> image = value->cachedOrPendingImage(); 4002 4003 if (image && image->isPendingImage()) 4003 m_ pendingImageProperties.set(property, value);4004 m_state.pendingImageProperties.set(property, value); 4004 4005 return image.release(); 4005 4006 } … … 4008 4009 { 4009 4010 if (value->isPending()) { 4010 m_ pendingImageProperties.set(property, value);4011 m_state.pendingImageProperties.set(property, value); 4011 4012 return StylePendingImage::create(value); 4012 4013 } … … 4019 4020 RefPtr<StyleImage> image = value->cachedOrPendingImageSet(document()); 4020 4021 if (image && image->isPendingImage()) 4021 m_ pendingImageProperties.set(property, value);4022 m_state.pendingImageProperties.set(property, value); 4022 4023 return image.release(); 4023 4024 } … … 4028 4029 RefPtr<StyleImage> image = value->cachedOrPendingImage(document()); 4029 4030 if (image && image->isPendingImage()) 4030 m_ pendingImageProperties.set(property, value);4031 m_state.pendingImageProperties.set(property, value); 4031 4032 return image.release(); 4032 4033 } … … 4034 4035 void StyleResolver::checkForTextSizeAdjust() 4035 4036 { 4036 if (m_style->textSizeAdjust()) 4037 return; 4038 4039 FontDescription newFontDescription(m_style->fontDescription()); 4037 RenderStyle* style = m_state.style.get(); 4038 4039 if (style->textSizeAdjust()) 4040 return; 4041 4042 FontDescription newFontDescription(style->fontDescription()); 4040 4043 newFontDescription.setComputedSize(newFontDescription.specifiedSize()); 4041 m_style->setFontDescription(newFontDescription);4044 style->setFontDescription(newFontDescription); 4042 4045 } 4043 4046 … … 4104 4107 fontDescription.setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1); 4105 4108 setFontSize(fontDescription, fontSizeForKeyword(document(), CSSValueMedium, false)); 4106 m_st yle->setLineHeight(RenderStyle::initialLineHeight());4107 m_ lineHeightValue = 0;4109 m_state.style->setLineHeight(RenderStyle::initialLineHeight()); 4110 m_state.lineHeightValue = 0; 4108 4111 setFontDescription(fontDescription); 4109 4112 } … … 4112 4115 { 4113 4116 fontDescription.setSpecifiedSize(size); 4114 fontDescription.setComputedSize(getComputedSizeFromSpecifiedSize(document(), m_st yle.get(), fontDescription.isAbsoluteSize(), size, useSVGZoomRules()));4117 fontDescription.setComputedSize(getComputedSizeFromSpecifiedSize(document(), m_state.style.get(), fontDescription.isAbsoluteSize(), size, useSVGZoomRules())); 4115 4118 } 4116 4119 … … 4315 4318 return Color(value->getRGBA32Value()); 4316 4319 4320 const State& state = m_state; 4317 4321 int ident = value->getIdent(); 4318 4322 switch (ident) { … … 4320 4324 return Color(); 4321 4325 case CSSValueWebkitText: 4322 return m_element->document()->textColor();4326 return state.element->document()->textColor(); 4323 4327 case CSSValueWebkitLink: 4324 return ( m_element->isLink() && forVisitedLink) ? m_element->document()->visitedLinkColor() : m_element->document()->linkColor();4328 return (state.element->isLink() && forVisitedLink) ? state.element->document()->visitedLinkColor() : state.element->document()->linkColor(); 4325 4329 case CSSValueWebkitActivelink: 4326 return m_element->document()->activeLinkColor();4330 return state.element->document()->activeLinkColor(); 4327 4331 case CSSValueWebkitFocusRingColor: 4328 4332 return RenderTheme::focusRingColor(); 4329 4333 case CSSValueCurrentcolor: 4330 return m_style->color();4334 return state.style->color(); 4331 4335 default: 4332 4336 return colorForCSSValue(ident); … … 4662 4666 void StyleResolver::loadPendingSVGDocuments() 4663 4667 { 4664 if (!m_style->hasFilter() || m_pendingSVGDocuments.isEmpty()) 4665 return; 4666 4667 CachedResourceLoader* cachedResourceLoader = m_element->document()->cachedResourceLoader(); 4668 Vector<RefPtr<FilterOperation> >& filterOperations = m_style->mutableFilter().operations(); 4668 State& state = m_state; 4669 if (!state.style->hasFilter() || state.pendingSVGDocuments.isEmpty()) 4670 return; 4671 4672 CachedResourceLoader* cachedResourceLoader = state.element->document()->cachedResourceLoader(); 4673 Vector<RefPtr<FilterOperation> >& filterOperations = state.style->mutableFilter().operations(); 4669 4674 for (unsigned i = 0; i < filterOperations.size(); ++i) { 4670 4675 RefPtr<FilterOperation> filterOperation = filterOperations.at(i); … … 4672 4677 ReferenceFilterOperation* referenceFilter = static_cast<ReferenceFilterOperation*>(filterOperation.get()); 4673 4678 4674 WebKitCSSSVGDocumentValue* value = m_pendingSVGDocuments.get(referenceFilter).get();4679 WebKitCSSSVGDocumentValue* value = state.pendingSVGDocuments.get(referenceFilter).get(); 4675 4680 if (!value) 4676 4681 continue; … … 4683 4688 } 4684 4689 } 4685 m_pendingSVGDocuments.clear();4690 state.pendingSVGDocuments.clear(); 4686 4691 } 4687 4692 #endif … … 4699 4704 StyleShader* shader = value->cachedOrPendingShader(); 4700 4705 if (shader && shader->isPendingShader()) 4701 m_ hasPendingShaders = true;4706 m_state.hasPendingShaders = true; 4702 4707 return shader; 4703 4708 } … … 4705 4710 void StyleResolver::loadPendingShaders() 4706 4711 { 4707 if (!m_st yle->hasFilter() || !m_hasPendingShaders)4708 return; 4709 4710 CachedResourceLoader* cachedResourceLoader = m_ element->document()->cachedResourceLoader();4711 4712 Vector<RefPtr<FilterOperation> >& filterOperations = m_st yle->mutableFilter().operations();4712 if (!m_state.style->hasFilter() || !m_state.hasPendingShaders) 4713 return; 4714 4715 CachedResourceLoader* cachedResourceLoader = m_state.element->document()->cachedResourceLoader(); 4716 4717 Vector<RefPtr<FilterOperation> >& filterOperations = m_state.style->mutableFilter().operations(); 4713 4718 for (unsigned i = 0; i < filterOperations.size(); ++i) { 4714 4719 RefPtr<FilterOperation> filterOperation = filterOperations.at(i); … … 4727 4732 } 4728 4733 } 4729 m_ hasPendingShaders = false;4734 m_state.hasPendingShaders = false; 4730 4735 } 4731 4736 … … 4769 4774 RefPtr<CustomFilterTransformParameter> transformParameter = CustomFilterTransformParameter::create(name); 4770 4775 TransformOperations operations; 4771 createTransformOperations(values, style(), m_rootElementStyle, operations);4776 createTransformOperations(values, m_state.style.get(), m_state.rootElementStyle, operations); 4772 4777 transformParameter->setOperations(operations); 4773 4778 return transformParameter.release(); … … 5019 5024 5020 5025 WebKitCSSSVGDocumentValue* svgDocumentValue = static_cast<WebKitCSSSVGDocumentValue*>(argument); 5021 KURL url = m_ element->document()->completeURL(svgDocumentValue->url());5026 KURL url = m_state.element->document()->completeURL(svgDocumentValue->url()); 5022 5027 5023 5028 RefPtr<ReferenceFilterOperation> operation = ReferenceFilterOperation::create(svgDocumentValue->url(), url.fragmentIdentifier(), operationType); 5024 if (SVGURIReference::isExternalURIReference(svgDocumentValue->url(), m_ element->document())) {5029 if (SVGURIReference::isExternalURIReference(svgDocumentValue->url(), m_state.element->document())) { 5025 5030 if (!svgDocumentValue->loadRequested()) 5026 m_ pendingSVGDocuments.set(operation.get(), svgDocumentValue);5031 m_state.pendingSVGDocuments.set(operation.get(), svgDocumentValue); 5027 5032 else if (svgDocumentValue->cachedSVGDocument()) 5028 5033 operation->setCachedSVGDocumentReference(adoptPtr(new CachedSVGDocumentReference(svgDocumentValue->cachedSVGDocument()))); … … 5128 5133 PassRefPtr<StyleImage> StyleResolver::loadPendingImage(StylePendingImage* pendingImage) 5129 5134 { 5130 CachedResourceLoader* cachedResourceLoader = m_ element->document()->cachedResourceLoader();5135 CachedResourceLoader* cachedResourceLoader = m_state.element->document()->cachedResourceLoader(); 5131 5136 5132 5137 if (pendingImage->cssImageValue()) { … … 5158 5163 void StyleResolver::loadPendingImages() 5159 5164 { 5160 if (m_ pendingImageProperties.isEmpty())5161 return; 5162 5163 PendingImagePropertyMap::const_iterator::Keys end = m_ pendingImageProperties.end().keys();5164 for (PendingImagePropertyMap::const_iterator::Keys it = m_ pendingImageProperties.begin().keys(); it != end; ++it) {5165 if (m_state.pendingImageProperties.isEmpty()) 5166 return; 5167 5168 PendingImagePropertyMap::const_iterator::Keys end = m_state.pendingImageProperties.end().keys(); 5169 for (PendingImagePropertyMap::const_iterator::Keys it = m_state.pendingImageProperties.begin().keys(); it != end; ++it) { 5165 5170 CSSPropertyID currentProperty = *it; 5166 5171 5167 5172 switch (currentProperty) { 5168 5173 case CSSPropertyBackgroundImage: { 5169 for (FillLayer* backgroundLayer = m_st yle->accessBackgroundLayers(); backgroundLayer; backgroundLayer = backgroundLayer->next()) {5174 for (FillLayer* backgroundLayer = m_state.style->accessBackgroundLayers(); backgroundLayer; backgroundLayer = backgroundLayer->next()) { 5170 5175 if (backgroundLayer->image() && backgroundLayer->image()->isPendingImage()) 5171 5176 backgroundLayer->setImage(loadPendingImage(static_cast<StylePendingImage*>(backgroundLayer->image()))); … … 5174 5179 } 5175 5180 case CSSPropertyContent: { 5176 for (ContentData* contentData = const_cast<ContentData*>(m_st yle->contentData()); contentData; contentData = contentData->next()) {5181 for (ContentData* contentData = const_cast<ContentData*>(m_state.style->contentData()); contentData; contentData = contentData->next()) { 5177 5182 if (contentData->isImage()) { 5178 5183 StyleImage* image = static_cast<ImageContentData*>(contentData)->image(); … … 5187 5192 } 5188 5193 case CSSPropertyCursor: { 5189 if (CursorList* cursorList = m_st yle->cursors()) {5194 if (CursorList* cursorList = m_state.style->cursors()) { 5190 5195 for (size_t i = 0; i < cursorList->size(); ++i) { 5191 5196 CursorData& currentCursor = cursorList->at(i); … … 5199 5204 } 5200 5205 case CSSPropertyListStyleImage: { 5201 if (m_st yle->listStyleImage() && m_style->listStyleImage()->isPendingImage())5202 m_st yle->setListStyleImage(loadPendingImage(static_cast<StylePendingImage*>(m_style->listStyleImage())));5206 if (m_state.style->listStyleImage() && m_state.style->listStyleImage()->isPendingImage()) 5207 m_state.style->setListStyleImage(loadPendingImage(static_cast<StylePendingImage*>(m_state.style->listStyleImage()))); 5203 5208 break; 5204 5209 } 5205 5210 case CSSPropertyBorderImageSource: { 5206 if (m_st yle->borderImageSource() && m_style->borderImageSource()->isPendingImage())5207 m_st yle->setBorderImageSource(loadPendingImage(static_cast<StylePendingImage*>(m_style->borderImageSource())));5211 if (m_state.style->borderImageSource() && m_state.style->borderImageSource()->isPendingImage()) 5212 m_state.style->setBorderImageSource(loadPendingImage(static_cast<StylePendingImage*>(m_state.style->borderImageSource()))); 5208 5213 break; 5209 5214 } 5210 5215 case CSSPropertyWebkitBoxReflect: { 5211 if (StyleReflection* reflection = m_st yle->boxReflect()) {5216 if (StyleReflection* reflection = m_state.style->boxReflect()) { 5212 5217 const NinePieceImage& maskImage = reflection->mask(); 5213 5218 if (maskImage.image() && maskImage.image()->isPendingImage()) { … … 5219 5224 } 5220 5225 case CSSPropertyWebkitMaskBoxImageSource: { 5221 if (m_st yle->maskBoxImageSource() && m_style->maskBoxImageSource()->isPendingImage())5222 m_st yle->setMaskBoxImageSource(loadPendingImage(static_cast<StylePendingImage*>(m_style->maskBoxImageSource())));5226 if (m_state.style->maskBoxImageSource() && m_state.style->maskBoxImageSource()->isPendingImage()) 5227 m_state.style->setMaskBoxImageSource(loadPendingImage(static_cast<StylePendingImage*>(m_state.style->maskBoxImageSource()))); 5223 5228 break; 5224 5229 } 5225 5230 case CSSPropertyWebkitMaskImage: { 5226 for (FillLayer* maskLayer = m_st yle->accessMaskLayers(); maskLayer; maskLayer = maskLayer->next()) {5231 for (FillLayer* maskLayer = m_state.style->accessMaskLayers(); maskLayer; maskLayer = maskLayer->next()) { 5227 5232 if (maskLayer->image() && maskLayer->image()->isPendingImage()) 5228 5233 maskLayer->setImage(loadPendingImage(static_cast<StylePendingImage*>(maskLayer->image()))); … … 5235 5240 } 5236 5241 5237 m_ pendingImageProperties.clear();5242 m_state.pendingImageProperties.clear(); 5238 5243 } 5239 5244 … … 5298 5303 { 5299 5304 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); 5300 info.addMember(m_style, "style");5301 5305 info.addMember(m_authorStyle, "authorStyle"); 5302 5306 info.addMember(m_userStyle, "userStyle"); … … 5307 5311 info.addMember(m_matchedPropertiesCache, "matchedPropertiesCache"); 5308 5312 info.addMember(m_matchedPropertiesCacheSweepTimer, "matchedPropertiesCacheSweepTimer"); 5309 info.addMember(m_matchedRules, "matchedRules"); 5310 5311 info.addMember(m_ruleList, "ruleList"); 5312 info.addMember(m_pendingImageProperties, "pendingImageProperties"); 5313 5313 5314 info.addMember(m_medium, "medium"); 5314 5315 info.addMember(m_rootDefaultStyle, "rootDefaultStyle"); 5315 5316 info.addMember(m_document, "document"); 5316 5317 5317 // FIXME: pointer to RenderStyle could point to an already deleted object.5318 info.ignoreMember(m_parentStyle);5319 info.ignoreMember(m_rootElementStyle);5320 5321 info.addMember(m_element, "element");5322 info.addMember(m_styledElement, "styledElement");5323 info.addMember(m_regionForStyling, "regionForStyling");5324 info.addMember(m_parentNode, "parentNode");5325 info.addMember(m_lineHeightValue, "lineHeightValue");5326 5318 info.addMember(m_fontSelector, "fontSelector"); 5327 5319 info.addMember(m_viewportDependentMediaQueryResults, "viewportDependentMediaQueryResults"); 5328 5320 info.ignoreMember(m_styleBuilder); 5329 5321 info.addMember(m_inspectorCSSOMWrappers); 5330 #if ENABLE(CSS_FILTERS) && ENABLE(SVG)5331 info.addMember(m_pendingSVGDocuments, "pendingSVGDocuments");5332 #endif5333 5322 info.addMember(m_scopeResolver, "scopeResolver"); 5323 5324 info.addMember(m_state, "state"); 5334 5325 5335 5326 // FIXME: move this to a place where it would be called only once? -
trunk/Source/WebCore/css/StyleResolver.h
r141480 r141742 24 24 25 25 #include "CSSRule.h" 26 #include "CSSRuleList.h" 26 27 #include "CSSToStyleMap.h" 27 28 #include "CSSValueList.h" … … 37 38 #include "StyleScopeResolver.h" 38 39 #include "ViewportStyleResolver.h" 40 #if ENABLE(CSS_FILTERS) && ENABLE(SVG) 41 #include "WebKitCSSSVGDocumentValue.h" 42 #endif 39 43 #include <wtf/HashMap.h> 40 44 #include <wtf/HashSet.h> … … 183 187 static PassRefPtr<RenderStyle> styleForDocument(Document*, CSSFontSelector* = 0); 184 188 185 RenderStyle* style() const { return m_st yle.get(); }186 RenderStyle* parentStyle() const { return m_ parentStyle; }187 RenderStyle* rootElementStyle() const { return m_ rootElementStyle; }188 Element* element() const { return m_ element; }189 RenderStyle* style() const { return m_state.style.get(); } 190 RenderStyle* parentStyle() const { return m_state.parentStyle; } 191 RenderStyle* rootElementStyle() const { return m_state.rootElementStyle; } 192 Element* element() const { return m_state.element; } 189 193 Document* document() const { return m_document; } 190 194 const FontDescription& fontDescription() { return style()->fontDescription(); } 191 195 const FontDescription& parentFontDescription() { return parentStyle()->fontDescription(); } 192 void setFontDescription(const FontDescription& fontDescription) { m_ fontDirty |= style()->setFontDescription(fontDescription); }193 void setZoom(float f) { m_ fontDirty |= style()->setZoom(f); }194 void setEffectiveZoom(float f) { m_ fontDirty |= style()->setEffectiveZoom(f); }195 void setTextSizeAdjust(bool b) { m_ fontDirty |= style()->setTextSizeAdjust(b); }196 void setWritingMode(WritingMode writingMode) { m_ fontDirty |= style()->setWritingMode(writingMode); }197 void setTextOrientation(TextOrientation textOrientation) { m_ fontDirty |= style()->setTextOrientation(textOrientation); }198 bool hasParentNode() const { return m_ parentNode; }196 void setFontDescription(const FontDescription& fontDescription) { m_state.fontDirty |= style()->setFontDescription(fontDescription); } 197 void setZoom(float f) { m_state.fontDirty |= style()->setZoom(f); } 198 void setEffectiveZoom(float f) { m_state.fontDirty |= style()->setEffectiveZoom(f); } 199 void setTextSizeAdjust(bool b) { m_state.fontDirty |= style()->setTextSizeAdjust(b); } 200 void setWritingMode(WritingMode writingMode) { m_state.fontDirty |= style()->setWritingMode(writingMode); } 201 void setTextOrientation(TextOrientation textOrientation) { m_state.fontDirty |= style()->setTextOrientation(textOrientation); } 202 bool hasParentNode() const { return m_state.parentNode; } 199 203 200 204 void resetAuthorStyle(); … … 328 332 void adjustRenderStyle(RenderStyle* styleToAdjust, RenderStyle* parentStyle, Element*); 329 333 330 void addMatchedRule(const RuleData* rule) { m_ matchedRules.append(rule); }334 void addMatchedRule(const RuleData* rule) { m_state.matchedRules.append(rule); } 331 335 332 336 struct RuleRange { … … 438 442 OwnPtr<RuleSet> m_uncommonAttributeRuleSet; 439 443 440 bool m_hasUAAppearance;441 BorderData m_borderData;442 FillLayer m_backgroundData;443 Color m_backgroundColor;444 445 444 typedef HashMap<AtomicStringImpl*, RefPtr<StyleRuleKeyframes> > KeyframesRuleMap; 446 445 KeyframesRuleMap m_keyframesRuleMap; 447 446 448 447 public: 448 typedef HashMap<CSSPropertyID, RefPtr<CSSValue> > PendingImagePropertyMap; 449 #if ENABLE(CSS_FILTERS) && ENABLE(SVG) 450 typedef HashMap<FilterOperation*, RefPtr<WebKitCSSSVGDocumentValue> > PendingSVGDocumentMap; 451 #endif 452 453 class State { 454 WTF_MAKE_NONCOPYABLE(State); 455 public: 456 State() 457 : element(0) 458 , styledElement(0) 459 , parentNode(0) 460 , parentStyle(0) 461 , rootElementStyle(0) 462 , regionForStyling(0) 463 , sameOriginOnly(false) 464 , pseudoStyle(NOPSEUDO) 465 , elementLinkState(NotInsideLink) 466 , distributedToInsertionPoint(false) 467 , elementAffectedByClassRules(false) 468 , applyPropertyToRegularStyle(true) 469 , applyPropertyToVisitedLinkStyle(false) 470 #if ENABLE(CSS_SHADERS) 471 , hasPendingShaders(false) 472 #endif 473 , lineHeightValue(0) 474 , fontDirty(false) 475 , hasUAAppearance(false) 476 , backgroundData(BackgroundFillLayer) { } 477 478 public: 479 // FIXME(bug 108563): to make it easier to review, these member 480 // variables are public. However we should add methods to access 481 // these variables. 482 Element* element; 483 RefPtr<RenderStyle> style; 484 StyledElement* styledElement; 485 ContainerNode* parentNode; 486 RenderStyle* parentStyle; 487 RenderStyle* rootElementStyle; 488 489 RenderRegion* regionForStyling; 490 bool sameOriginOnly; 491 PseudoId pseudoStyle; 492 493 EInsideLink elementLinkState; 494 495 bool distributedToInsertionPoint; 496 497 bool elementAffectedByClassRules; 498 499 PseudoId dynamicPseudo; 500 501 // A buffer used to hold the set of matched rules for an element, 502 // and a temporary buffer used for merge sorting. 503 Vector<const RuleData*, 32> matchedRules; 504 RefPtr<StaticCSSRuleList> ruleList; 505 506 bool applyPropertyToRegularStyle; 507 bool applyPropertyToVisitedLinkStyle; 508 509 PendingImagePropertyMap pendingImageProperties; 510 #if ENABLE(CSS_SHADERS) 511 bool hasPendingShaders; 512 #endif 513 #if ENABLE(CSS_FILTERS) && ENABLE(SVG) 514 PendingSVGDocumentMap pendingSVGDocuments; 515 #endif 516 CSSValue* lineHeightValue; 517 bool fontDirty; 518 519 bool hasUAAppearance; 520 BorderData borderData; 521 FillLayer backgroundData; 522 Color backgroundColor; 523 }; 524 449 525 static RenderStyle* styleNotYetAvailable() { return s_styleNotYetAvailable; } 450 526 … … 457 533 PassRefPtr<StyleImage> cursorOrPendingFromValue(CSSPropertyID, CSSCursorImageValue*); 458 534 459 bool applyPropertyToRegularStyle() const { return m_ applyPropertyToRegularStyle; }460 bool applyPropertyToVisitedLinkStyle() const { return m_ applyPropertyToVisitedLinkStyle; }535 bool applyPropertyToRegularStyle() const { return m_state.applyPropertyToRegularStyle; } 536 bool applyPropertyToVisitedLinkStyle() const { return m_state.applyPropertyToVisitedLinkStyle; } 461 537 462 538 static Length convertToIntLength(CSSPrimitiveValue*, RenderStyle*, RenderStyle* rootStyle, double multiplier = 1); … … 512 588 Timer<StyleResolver> m_matchedPropertiesCacheSweepTimer; 513 589 514 // A buffer used to hold the set of matched rules for an element, and a temporary buffer used for515 // merge sorting.516 Vector<const RuleData*, 32> m_matchedRules;517 518 RefPtr<StaticCSSRuleList> m_ruleList;519 520 typedef HashMap<CSSPropertyID, RefPtr<CSSValue> > PendingImagePropertyMap;521 PendingImagePropertyMap m_pendingImageProperties;522 523 590 OwnPtr<MediaQueryEvaluator> m_medium; 524 591 RefPtr<RenderStyle> m_rootDefaultStyle; 525 592 526 PseudoId m_dynamicPseudo;527 PseudoId m_pseudoStyle;528 529 593 Document* m_document; 594 // FIXME: Make SelectorChecker an on-stack object and 595 // move selectorChecker.mode() to State. 596 // selectorChecker.stringParsing() can be replaced with 597 // !document.inQuirksMode(). 530 598 SelectorChecker m_selectorChecker; 531 599 SelectorFilter m_selectorFilter; 532 600 533 RefPtr<RenderStyle> m_style;534 RenderStyle* m_parentStyle;535 RenderStyle* m_rootElementStyle;536 Element* m_element;537 StyledElement* m_styledElement;538 RenderRegion* m_regionForStyling;539 EInsideLink m_elementLinkState;540 bool m_elementAffectedByClassRules;541 ContainerNode* m_parentNode;542 CSSValue* m_lineHeightValue;543 bool m_fontDirty;544 601 bool m_matchAuthorAndUserStyles; 545 bool m_sameOriginOnly;546 bool m_distributedToInsertionPoint;547 602 548 603 RefPtr<CSSFontSelector> m_fontSelector; … … 553 608 #endif 554 609 555 bool m_applyPropertyToRegularStyle;556 bool m_applyPropertyToVisitedLinkStyle;557 610 const StyleBuilder& m_styleBuilder; 558 559 #if ENABLE(CSS_SHADERS)560 bool m_hasPendingShaders;561 #endif562 563 #if ENABLE(CSS_FILTERS) && ENABLE(SVG)564 HashMap<FilterOperation*, RefPtr<WebKitCSSSVGDocumentValue> > m_pendingSVGDocuments;565 #endif566 611 567 612 OwnPtr<StyleScopeResolver> m_scopeResolver; 568 613 CSSToStyleMap m_styleMap; 569 614 InspectorCSSOMWrappers m_inspectorCSSOMWrappers; 615 616 State m_state; 570 617 571 618 friend class StyleBuilder;
Note: See TracChangeset
for help on using the changeset viewer.