Changeset 94887 in webkit
- Timestamp:
- Sep 9, 2011 4:22:49 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r94884 r94887 1 2011-09-09 Kulanthaivel Palanichamy <kulanthaivel@codeaurora.org> 2 3 CSS rules not being applied when a hidden field is inserted between an input[type=checkbox] and a label 4 https://bugs.webkit.org/show_bug.cgi?id=66887 5 6 Reviewed by David Hyatt. 7 8 * fast/css/adjacent-sibling-selector-expected.txt: Added. 9 * fast/css/adjacent-sibling-selector.html: Added. 10 1 11 2011-09-09 Tom Sepez <tsepez@chromium.org> 2 12 -
trunk/Source/WebCore/ChangeLog
r94886 r94887 1 2011-09-09 Kulanthaivel Palanichamy <kulanthaivel@codeaurora.org> 2 3 CSS rules not being applied when a hidden field is inserted between an input[type=checkbox] and a label 4 https://bugs.webkit.org/show_bug.cgi?id=66887 5 6 Reviewed by David Hyatt. 7 8 Test: fast/css/adjacent-sibling-selector.html 9 10 This patch addresses the problem of elements not getting their style recomputed 11 when they are affected by direct adjacent sibling rules and one of their sibling in 12 their corresponding rules is modified dynamically. 13 14 * css/CSSStyleSelector.cpp: 15 (WebCore::CSSStyleSelector::canShareStyleWithElement): 16 (WebCore::parentStylePreventsSharing): 17 * css/SelectorChecker.cpp: 18 (WebCore::SelectorChecker::checkSelector): 19 * dom/Element.cpp: 20 (WebCore::Element::recalcStyle): 21 (WebCore::checkForSiblingStyleChanges): 22 * rendering/style/RenderStyle.cpp: 23 (WebCore::RenderStyle::RenderStyle): 24 * rendering/style/RenderStyle.h: 25 (WebCore::InheritedFlags::affectedByDirectAdjacentRules): 26 (WebCore::InheritedFlags::setAffectedByDirectAdjacentRules): 27 1 28 2011-09-09 Rafael Antognolli <antognolli@profusion.mobi> 2 29 -
trunk/Source/WebCore/css/CSSStyleSelector.cpp
r94710 r94887 949 949 return false; 950 950 951 if (style->affectedByDirectAdjacentRules()) 952 return false; 953 951 954 #if USE(ACCELERATED_COMPOSITING) 952 955 // Turn off style sharing for elements that can gain layers for reasons outside of the style system. … … 988 991 return parentStyle->childrenAffectedByPositionalRules() 989 992 || parentStyle->childrenAffectedByFirstChildRules() 990 || parentStyle->childrenAffectedByLastChildRules() 991 || parentStyle->childrenAffectedByDirectAdjacentRules(); 993 || parentStyle->childrenAffectedByLastChildRules(); 992 994 } 993 995 -
trunk/Source/WebCore/css/SelectorChecker.cpp
r94657 r94887 342 342 case CSSSelector::DirectAdjacent: 343 343 { 344 if (!m_isCollectingRulesOnly && e->parentNode() && e->parentNode()->isElementNode()) {345 RenderStyle* parentStyle = elementStyle ? elementParentStyle : e->parentNode()->renderStyle();346 if ( parentStyle)347 parentStyle->setChildrenAffectedByDirectAdjacentRules();344 if (!m_isCollectingRulesOnly) { 345 RenderStyle* currentStyle = elementStyle ? elementStyle : e->renderStyle(); 346 if (currentStyle) 347 currentStyle->setAffectedByDirectAdjacentRules(); 348 348 } 349 349 Node* n = e->previousSibling(); -
trunk/Source/WebCore/dom/Element.cpp
r94869 r94887 1070 1070 RefPtr<RenderStyle> currentStyle(renderStyle()); 1071 1071 bool hasParentStyle = parentNodeForRenderingAndStyle() ? static_cast<bool>(parentNodeForRenderingAndStyle()->renderStyle()) : false; 1072 bool hasDirectAdjacentRules = currentStyle && currentStyle->childrenAffectedByDirectAdjacentRules();1073 1072 bool hasIndirectAdjacentRules = currentStyle && currentStyle->childrenAffectedByForwardPositionalRules(); 1074 1073 … … 1112 1111 if (currentStyle->childrenAffectedByLastChildRules()) 1113 1112 newStyle->setChildrenAffectedByLastChildRules(); 1114 if (currentStyle-> childrenAffectedByDirectAdjacentRules())1115 newStyle->set ChildrenAffectedByDirectAdjacentRules();1113 if (currentStyle->affectedByDirectAdjacentRules()) 1114 newStyle->setAffectedByDirectAdjacentRules(); 1116 1115 } 1117 1116 … … 1143 1142 // For now we will just worry about the common case, since it's a lot trickier to get the second case right 1144 1143 // without doing way too much re-resolution. 1145 bool forceCheckOfNextElementSibling= false;1144 bool previousSiblingHadDirectAdjacentRules = false; 1146 1145 bool forceCheckOfAnyElementSibling = false; 1147 1146 for (Node *n = firstChild(); n; n = n->nextSibling()) { … … 1155 1154 Element* element = static_cast<Element*>(n); 1156 1155 bool childRulesChanged = element->needsStyleRecalc() && element->styleChangeType() == FullStyleChange; 1157 if ((forceCheckOfNextElementSibling || forceCheckOfAnyElementSibling)) 1156 bool childAffectedByDirectAdjacentRules = element->renderStyle() ? element->renderStyle()->affectedByDirectAdjacentRules() : previousSiblingHadDirectAdjacentRules; 1157 if (childAffectedByDirectAdjacentRules || forceCheckOfAnyElementSibling) 1158 1158 element->setNeedsStyleRecalc(); 1159 1159 if (change >= Inherit || element->childNeedsStyleRecalc() || element->needsStyleRecalc()) { … … 1161 1161 element->recalcStyle(change); 1162 1162 } 1163 forceCheckOfNextElementSibling = childRulesChanged && hasDirectAdjacentRules;1163 previousSiblingHadDirectAdjacentRules = childAffectedByDirectAdjacentRules; 1164 1164 forceCheckOfAnyElementSibling = forceCheckOfAnyElementSibling || (childRulesChanged && hasIndirectAdjacentRules); 1165 1165 } … … 1348 1348 } 1349 1349 1350 // The + selector. We need to invalidate the first element following the insertion point. It is the only possible element1351 // that could be affected by this DOM change.1352 if (style->childrenAffectedByDirectAdjacentRules() && afterChange) {1353 Node* firstElementAfterInsertion = 0;1354 for (firstElementAfterInsertion = afterChange;1355 firstElementAfterInsertion && !firstElementAfterInsertion->isElementNode();1356 firstElementAfterInsertion = firstElementAfterInsertion->nextSibling()) {};1357 if (firstElementAfterInsertion && firstElementAfterInsertion->attached())1358 firstElementAfterInsertion->setNeedsStyleRecalc();1359 }1360 1361 1350 // Forward positional selectors include the ~ selector, nth-child, nth-of-type, first-of-type and only-of-type. 1362 1351 // Backward positional selectors include nth-last-child, nth-last-of-type, last-of-type and only-of-type. -
trunk/Source/WebCore/rendering/style/RenderStyle.cpp
r92871 r94887 78 78 , m_childrenAffectedByFirstChildRules(false) 79 79 , m_childrenAffectedByLastChildRules(false) 80 , m_childrenAffectedByDirectAdjacentRules(false)81 80 , m_childrenAffectedByForwardPositionalRules(false) 82 81 , m_childrenAffectedByBackwardPositionalRules(false) 83 82 , m_firstChildState(false) 84 83 , m_lastChildState(false) 84 , m_affectedByDirectAdjacentRules(false) 85 85 , m_childIndex(0) 86 86 , m_box(defaultStyle()->m_box) … … 105 105 , m_childrenAffectedByFirstChildRules(false) 106 106 , m_childrenAffectedByLastChildRules(false) 107 , m_childrenAffectedByDirectAdjacentRules(false)108 107 , m_childrenAffectedByForwardPositionalRules(false) 109 108 , m_childrenAffectedByBackwardPositionalRules(false) 110 109 , m_firstChildState(false) 111 110 , m_lastChildState(false) 111 , m_affectedByDirectAdjacentRules(false) 112 112 , m_childIndex(0) 113 113 { … … 142 142 , m_childrenAffectedByFirstChildRules(false) 143 143 , m_childrenAffectedByLastChildRules(false) 144 , m_childrenAffectedByDirectAdjacentRules(false)145 144 , m_childrenAffectedByForwardPositionalRules(false) 146 145 , m_childrenAffectedByBackwardPositionalRules(false) 147 146 , m_firstChildState(false) 148 147 , m_lastChildState(false) 148 , m_affectedByDirectAdjacentRules(false) 149 149 , m_childIndex(0) 150 150 , m_box(o.m_box) -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r94710 r94887 133 133 bool m_childrenAffectedByFirstChildRules : 1; 134 134 bool m_childrenAffectedByLastChildRules : 1; 135 bool m_childrenAffectedByDirectAdjacentRules : 1;136 135 bool m_childrenAffectedByForwardPositionalRules : 1; 137 136 bool m_childrenAffectedByBackwardPositionalRules : 1; 138 137 bool m_firstChildState : 1; 139 138 bool m_lastChildState : 1; 139 bool m_affectedByDirectAdjacentRules : 1; 140 140 unsigned m_childIndex : 21; // Plenty of bits to cache an index. 141 141 … … 1263 1263 void setAffectedByAttributeSelectors() { m_affectedByAttributeSelectors = true; } 1264 1264 1265 bool affectedByDirectAdjacentRules() const { return m_affectedByDirectAdjacentRules; } 1266 void setAffectedByDirectAdjacentRules() { m_affectedByDirectAdjacentRules = true; } 1267 1265 1268 bool unique() const { return m_unique; } 1266 1269 void setUnique() { m_unique = true; } … … 1275 1278 bool childrenAffectedByLastChildRules() const { return m_childrenAffectedByLastChildRules; } 1276 1279 void setChildrenAffectedByLastChildRules() { m_childrenAffectedByLastChildRules = true; } 1277 bool childrenAffectedByDirectAdjacentRules() const { return m_childrenAffectedByDirectAdjacentRules; }1278 void setChildrenAffectedByDirectAdjacentRules() { m_childrenAffectedByDirectAdjacentRules = true; }1279 1280 bool childrenAffectedByForwardPositionalRules() const { return m_childrenAffectedByForwardPositionalRules; } 1280 1281 void setChildrenAffectedByForwardPositionalRules() { m_childrenAffectedByForwardPositionalRules = true; }
Note: See TracChangeset
for help on using the changeset viewer.