Changeset 201075 in webkit
- Timestamp:
- May 18, 2016, 7:21:37 AM (9 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r201074 r201075 1 2016-05-18 Antti Koivisto <antti@apple.com> 2 3 Resolve !important properties from different shadow trees in a single pass. 4 https://bugs.webkit.org/show_bug.cgi?id=157836 5 6 Reviewed by Andreas Kling. 7 8 * css/StyleResolver.cpp: 9 (WebCore::StyleResolver::CascadedProperties::addImportantMatches): 10 11 Instead of doing multiple passes over increasing tree context ordinals collect matches with 12 non-zero ordinals to a vector and sort it to ascending order. 13 1 14 2016-05-18 Csaba Osztrogonác <ossy@webkit.org> 2 15 -
trunk/Source/WebCore/css/StyleResolver.cpp
r201073 r201075 2419 2419 return; 2420 2420 2421 unsigned highestTreeContextOrdinal = 0; 2422 for (unsigned treeContextPass = 0; treeContextPass <= highestTreeContextOrdinal; ++treeContextPass) { 2423 for (int i = startIndex; i <= endIndex; ++i) { 2424 const MatchedProperties& matchedProperties = matchResult.matchedProperties()[i]; 2425 2426 if (!hasImportantProperties(*matchedProperties.properties)) 2427 continue; 2428 2429 // For !important properties a later shadow tree wins. Do multiple passes to apply in correct order if needed. 2430 // Matched properties are sorted in reverse tree context order so this is not needed for normal properties. 2431 if (matchedProperties.treeContextOrdinal != treeContextPass) { 2432 highestTreeContextOrdinal = std::max(matchedProperties.treeContextOrdinal, highestTreeContextOrdinal); 2433 continue; 2434 } 2435 2436 addMatch(matchResult, i, true, inheritedOnly); 2437 } 2438 } 2421 struct IndexAndOrdinal { 2422 int index; 2423 unsigned ordinal; 2424 }; 2425 Vector<IndexAndOrdinal> shadowTreeMatches; 2426 2427 for (int i = startIndex; i <= endIndex; ++i) { 2428 const MatchedProperties& matchedProperties = matchResult.matchedProperties()[i]; 2429 2430 if (!hasImportantProperties(*matchedProperties.properties)) 2431 continue; 2432 2433 if (matchedProperties.treeContextOrdinal) { 2434 shadowTreeMatches.append({ i, matchedProperties.treeContextOrdinal }); 2435 continue; 2436 } 2437 2438 addMatch(matchResult, i, true, inheritedOnly); 2439 } 2440 2441 if (shadowTreeMatches.isEmpty()) 2442 return; 2443 2444 // For !important properties a later shadow tree wins. 2445 // Match results are sorted in reverse tree context order so this is not needed for normal properties. 2446 std::stable_sort(shadowTreeMatches.begin(), shadowTreeMatches.end(), [] (const IndexAndOrdinal& a, const IndexAndOrdinal& b) { 2447 return a.ordinal < b.ordinal; 2448 }); 2449 2450 for (auto& match : shadowTreeMatches) 2451 addMatch(matchResult, match.index, true, inheritedOnly); 2439 2452 } 2440 2453
Note:
See TracChangeset
for help on using the changeset viewer.