| OLD | NEW |
| 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 } | 193 } |
| 194 | 194 |
| 195 void HTMLSlotElement::DetachLayoutTree(const AttachContext& context) { | 195 void HTMLSlotElement::DetachLayoutTree(const AttachContext& context) { |
| 196 if (SupportsDistribution()) { | 196 if (SupportsDistribution()) { |
| 197 for (auto& node : distributed_nodes_) | 197 for (auto& node : distributed_nodes_) |
| 198 node->LazyReattachIfAttached(); | 198 node->LazyReattachIfAttached(); |
| 199 } | 199 } |
| 200 HTMLElement::DetachLayoutTree(context); | 200 HTMLElement::DetachLayoutTree(context); |
| 201 } | 201 } |
| 202 | 202 |
| 203 void HTMLSlotElement::RebuildDistributedChildrenLayoutTrees() { |
| 204 if (!SupportsDistribution()) |
| 205 return; |
| 206 Text* next_text_sibling = nullptr; |
| 207 // This loop traverses the nodes from right to left for the same reason as the |
| 208 // one described in ContainerNode::RebuildChildrenLayoutTrees(). |
| 209 for (auto it = distributed_nodes_.rbegin(); it != distributed_nodes_.rend(); |
| 210 ++it) { |
| 211 RebuildLayoutTreeForChild(*it, next_text_sibling); |
| 212 } |
| 213 } |
| 214 |
| 203 void HTMLSlotElement::AttributeChanged( | 215 void HTMLSlotElement::AttributeChanged( |
| 204 const AttributeModificationParams& params) { | 216 const AttributeModificationParams& params) { |
| 205 if (params.name == nameAttr) { | 217 if (params.name == nameAttr) { |
| 206 if (ShadowRoot* root = ContainingShadowRoot()) { | 218 if (ShadowRoot* root = ContainingShadowRoot()) { |
| 207 if (root->IsV1() && params.old_value != params.new_value) { | 219 if (root->IsV1() && params.old_value != params.new_value) { |
| 208 root->GetSlotAssignment().SlotRenamed( | 220 root->GetSlotAssignment().SlotRenamed( |
| 209 NormalizeSlotName(params.old_value), *this); | 221 NormalizeSlotName(params.old_value), *this); |
| 210 } | 222 } |
| 211 } | 223 } |
| 212 } | 224 } |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 | 376 |
| 365 DEFINE_TRACE(HTMLSlotElement) { | 377 DEFINE_TRACE(HTMLSlotElement) { |
| 366 visitor->Trace(assigned_nodes_); | 378 visitor->Trace(assigned_nodes_); |
| 367 visitor->Trace(distributed_nodes_); | 379 visitor->Trace(distributed_nodes_); |
| 368 visitor->Trace(old_distributed_nodes_); | 380 visitor->Trace(old_distributed_nodes_); |
| 369 visitor->Trace(distributed_indices_); | 381 visitor->Trace(distributed_indices_); |
| 370 HTMLElement::Trace(visitor); | 382 HTMLElement::Trace(visitor); |
| 371 } | 383 } |
| 372 | 384 |
| 373 } // namespace blink | 385 } // namespace blink |
| OLD | NEW |