Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLSlotElement.cpp

Issue 1708213002: Propagate inherited properties into slotted elements on recalc. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed non-oilpan build Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLSlotElement.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2015 Google Inc. All rights reserved. 2 * Copyright (C) 2015 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 27 matching lines...) Expand all
38 #include "core/events/Event.h" 38 #include "core/events/Event.h"
39 #include "core/html/AssignedNodesOptions.h" 39 #include "core/html/AssignedNodesOptions.h"
40 40
41 namespace blink { 41 namespace blink {
42 42
43 using namespace HTMLNames; 43 using namespace HTMLNames;
44 44
45 inline HTMLSlotElement::HTMLSlotElement(Document& document) 45 inline HTMLSlotElement::HTMLSlotElement(Document& document)
46 : HTMLElement(slotTag, document) 46 : HTMLElement(slotTag, document)
47 { 47 {
48 setHasCustomStyleCallbacks();
48 } 49 }
49 50
50 DEFINE_NODE_FACTORY(HTMLSlotElement); 51 DEFINE_NODE_FACTORY(HTMLSlotElement);
51 52
52 const WillBeHeapVector<RefPtrWillBeMember<Node>> HTMLSlotElement::getAssignedNod esForBinding(const AssignedNodesOptions& options) 53 const WillBeHeapVector<RefPtrWillBeMember<Node>> HTMLSlotElement::getAssignedNod esForBinding(const AssignedNodesOptions& options)
53 { 54 {
54 updateDistribution(); 55 updateDistribution();
55 if (options.hasFlatten() && options.flatten()) 56 if (options.hasFlatten() && options.flatten())
56 return getDistributedNodes(); 57 return getDistributedNodes();
57 return m_assignedNodes; 58 return m_assignedNodes;
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 208
208 // Since this insertion point is no longer visible from the shadow subtree, it need to clean itself up. 209 // Since this insertion point is no longer visible from the shadow subtree, it need to clean itself up.
209 clearDistribution(); 210 clearDistribution();
210 211
211 if (root == insertionPoint->treeScope().rootNode()) 212 if (root == insertionPoint->treeScope().rootNode())
212 root->didRemoveSlot(); 213 root->didRemoveSlot();
213 214
214 HTMLElement::removedFrom(insertionPoint); 215 HTMLElement::removedFrom(insertionPoint);
215 } 216 }
216 217
218 void HTMLSlotElement::willRecalcStyle(StyleRecalcChange change)
219 {
220 if (change < Inherit && styleChangeType() < SubtreeStyleChange)
221 return;
222
223 for (auto& node : m_distributedNodes)
224 node->setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing: :create(StyleChangeReason::PropagateInheritChangeToDistributedNodes));
225 }
226
217 void HTMLSlotElement::updateDistributedNodesWithFallback() 227 void HTMLSlotElement::updateDistributedNodesWithFallback()
218 { 228 {
219 if (!m_distributedNodes.isEmpty()) 229 if (!m_distributedNodes.isEmpty())
220 return; 230 return;
221 for (auto& child : NodeTraversal::childrenOf(*this)) { 231 for (auto& child : NodeTraversal::childrenOf(*this)) {
222 if (!child.isSlotAssignable()) 232 if (!child.isSlotAssignable())
223 continue; 233 continue;
224 // Insertion points are not supported as slots fallback 234 // Insertion points are not supported as slots fallback
225 if (isActiveInsertionPoint(child)) 235 if (isActiveInsertionPoint(child))
226 continue; 236 continue;
(...skipping 18 matching lines...) Expand all
245 #if ENABLE(OILPAN) 255 #if ENABLE(OILPAN)
246 visitor->trace(m_assignedNodes); 256 visitor->trace(m_assignedNodes);
247 visitor->trace(m_distributedNodes); 257 visitor->trace(m_distributedNodes);
248 visitor->trace(m_distributedIndices); 258 visitor->trace(m_distributedIndices);
249 visitor->trace(m_oldDistributedNodes); 259 visitor->trace(m_oldDistributedNodes);
250 #endif 260 #endif
251 HTMLElement::trace(visitor); 261 HTMLElement::trace(visitor);
252 } 262 }
253 263
254 } // namespace blink 264 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLSlotElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698