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

Unified Diff: third_party/WebKit/Source/core/dom/shadow/SlotAssignment.cpp

Issue 1763993002: Refactoring: Have isDefaultSlotName function (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rename 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/shadow/SlotAssignment.cpp
diff --git a/third_party/WebKit/Source/core/dom/shadow/SlotAssignment.cpp b/third_party/WebKit/Source/core/dom/shadow/SlotAssignment.cpp
index 3e43b8906d23964d9cdad9f145e7bdffaaf6aec2..cd9b1d96fd92766b977daf0c6a414b1e9d798b7f 100644
--- a/third_party/WebKit/Source/core/dom/shadow/SlotAssignment.cpp
+++ b/third_party/WebKit/Source/core/dom/shadow/SlotAssignment.cpp
@@ -25,6 +25,11 @@ static void detachNotAssignedNode(Node& node)
node.lazyReattachIfAttached();
}
+inline static bool isDefaultSlotName(const AtomicString& name)
+{
+ return name.isNull() || name.isEmpty();
+}
+
void SlotAssignment::resolveAssignment(ShadowRoot& shadowRoot)
{
m_assignment.clear();
@@ -38,7 +43,7 @@ void SlotAssignment::resolveAssignment(ShadowRoot& shadowRoot)
for (RefPtrWillBeMember<HTMLSlotElement> slot : slots) {
slot->clearDistribution();
AtomicString name = slot->fastGetAttribute(HTMLNames::nameAttr);
- if (name.isNull() || name.isEmpty()) {
+ if (isDefaultSlotName(name)) {
if (!defaultSlot)
defaultSlot = slot.get();
} else {
@@ -54,7 +59,7 @@ void SlotAssignment::resolveAssignment(ShadowRoot& shadowRoot)
continue;
}
AtomicString slotName = toElement(child).fastGetAttribute(HTMLNames::slotAttr);
- if (slotName.isNull() || slotName.isEmpty()) {
+ if (isDefaultSlotName(slotName)) {
if (defaultSlot)
assign(child, *defaultSlot);
else
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698