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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutObjectChildList.cpp

Issue 2400863005: Reformat comments in core/layout up until LayoutTableRow (Closed)
Patch Set: Created 4 years, 2 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2009, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 3 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 18 matching lines...) Expand all
29 #include "core/dom/AXObjectCache.h" 29 #include "core/dom/AXObjectCache.h"
30 #include "core/layout/LayoutCounter.h" 30 #include "core/layout/LayoutCounter.h"
31 #include "core/layout/LayoutObject.h" 31 #include "core/layout/LayoutObject.h"
32 #include "core/layout/LayoutView.h" 32 #include "core/layout/LayoutView.h"
33 #include "core/paint/ObjectPaintInvalidator.h" 33 #include "core/paint/ObjectPaintInvalidator.h"
34 34
35 namespace blink { 35 namespace blink {
36 36
37 void LayoutObjectChildList::destroyLeftoverChildren() { 37 void LayoutObjectChildList::destroyLeftoverChildren() {
38 while (firstChild()) { 38 while (firstChild()) {
39 // List markers are owned by their enclosing list and so don't get destroyed by this container. 39 // List markers are owned by their enclosing list and so don't get destroyed
40 // by this container.
40 if (firstChild()->isListMarker()) { 41 if (firstChild()->isListMarker()) {
41 firstChild()->remove(); 42 firstChild()->remove();
42 continue; 43 continue;
43 } 44 }
44 45
45 // Destroy any anonymous children remaining in the layout tree, as well as i mplicit (shadow) DOM elements like those used in the engine-based text fields. 46 // Destroy any anonymous children remaining in the layout tree, as well as
47 // implicit (shadow) DOM elements like those used in the engine-based text
48 // fields.
46 if (firstChild()->node()) 49 if (firstChild()->node())
47 firstChild()->node()->setLayoutObject(nullptr); 50 firstChild()->node()->setLayoutObject(nullptr);
48 firstChild()->destroy(); 51 firstChild()->destroy();
49 } 52 }
50 } 53 }
51 54
52 LayoutObject* LayoutObjectChildList::removeChildNode(LayoutObject* owner, 55 LayoutObject* LayoutObjectChildList::removeChildNode(LayoutObject* owner,
53 LayoutObject* oldChild, 56 LayoutObject* oldChild,
54 bool notifyLayoutObject) { 57 bool notifyLayoutObject) {
55 ASSERT(oldChild->parent() == owner); 58 ASSERT(oldChild->parent() == owner);
56 ASSERT(this == owner->virtualChildren()); 59 ASSERT(this == owner->virtualChildren());
57 60
58 if (oldChild->isFloatingOrOutOfFlowPositioned()) 61 if (oldChild->isFloatingOrOutOfFlowPositioned())
59 toLayoutBox(oldChild)->removeFloatingOrPositionedChildFromBlockLists(); 62 toLayoutBox(oldChild)->removeFloatingOrPositionedChildFromBlockLists();
60 63
61 if (!owner->documentBeingDestroyed()) { 64 if (!owner->documentBeingDestroyed()) {
62 // So that we'll get the appropriate dirty bit set (either that a normal flo w child got yanked or 65 // So that we'll get the appropriate dirty bit set (either that a normal
63 // that a positioned child got yanked). We also issue paint invalidations, s o that the area exposed when the child 66 // flow child got yanked or that a positioned child got yanked). We also
67 // issue paint invalidations, so that the area exposed when the child
64 // disappears gets paint invalidated properly. 68 // disappears gets paint invalidated properly.
65 if (notifyLayoutObject && oldChild->everHadLayout()) 69 if (notifyLayoutObject && oldChild->everHadLayout())
66 oldChild->setNeedsLayoutAndPrefWidthsRecalc( 70 oldChild->setNeedsLayoutAndPrefWidthsRecalc(
67 LayoutInvalidationReason::RemovedFromLayout); 71 LayoutInvalidationReason::RemovedFromLayout);
68 invalidatePaintOnRemoval(*oldChild); 72 invalidatePaintOnRemoval(*oldChild);
69 } 73 }
70 74
71 // If we have a line box wrapper, delete it. 75 // If we have a line box wrapper, delete it.
72 if (oldChild->isBox()) 76 if (oldChild->isBox())
73 toLayoutBox(oldChild)->deleteLineBoxWrapper(); 77 toLayoutBox(oldChild)->deleteLineBoxWrapper();
74 78
75 if (!owner->documentBeingDestroyed()) { 79 if (!owner->documentBeingDestroyed()) {
76 // If oldChild is the start or end of the selection, then clear the selectio n to 80 // If oldChild is the start or end of the selection, then clear the
77 // avoid problems of invalid pointers. 81 // selection to avoid problems of invalid pointers.
78 // FIXME: The FrameSelection should be responsible for this when it 82 // FIXME: The FrameSelection should be responsible for this when it
79 // is notified of DOM mutations. 83 // is notified of DOM mutations.
80 if (oldChild->isSelectionBorder()) 84 if (oldChild->isSelectionBorder())
81 owner->view()->clearSelection(); 85 owner->view()->clearSelection();
82 86
83 owner->notifyOfSubtreeChange(); 87 owner->notifyOfSubtreeChange();
84 88
85 if (notifyLayoutObject) { 89 if (notifyLayoutObject) {
86 LayoutCounter::layoutObjectSubtreeWillBeDetached(oldChild); 90 LayoutCounter::layoutObjectSubtreeWillBeDetached(oldChild);
87 oldChild->willBeRemovedFromTree(); 91 oldChild->willBeRemovedFromTree();
88 } else if (oldChild->isBox() && 92 } else if (oldChild->isBox() &&
89 toLayoutBox(oldChild)->isOrthogonalWritingModeRoot()) { 93 toLayoutBox(oldChild)->isOrthogonalWritingModeRoot()) {
90 toLayoutBox(oldChild)->unmarkOrthogonalWritingModeRoot(); 94 toLayoutBox(oldChild)->unmarkOrthogonalWritingModeRoot();
91 } 95 }
92 } 96 }
93 97
94 // WARNING: There should be no code running between willBeRemovedFromTree and the actual removal below. 98 // WARNING: There should be no code running between willBeRemovedFromTree and
95 // This is needed to avoid race conditions where willBeRemovedFromTree would d irty the tree's structure 99 // the actual removal below.
96 // and the code running here would force an untimely rebuilding, leaving |oldC hild| dangling. 100 // This is needed to avoid race conditions where willBeRemovedFromTree would
101 // dirty the tree's structure and the code running here would force an
102 // untimely rebuilding, leaving |oldChild| dangling.
97 103
98 if (oldChild->previousSibling()) 104 if (oldChild->previousSibling())
99 oldChild->previousSibling()->setNextSibling(oldChild->nextSibling()); 105 oldChild->previousSibling()->setNextSibling(oldChild->nextSibling());
100 if (oldChild->nextSibling()) 106 if (oldChild->nextSibling())
101 oldChild->nextSibling()->setPreviousSibling(oldChild->previousSibling()); 107 oldChild->nextSibling()->setPreviousSibling(oldChild->previousSibling());
102 108
103 if (firstChild() == oldChild) 109 if (firstChild() == oldChild)
104 m_firstChild = oldChild->nextSibling(); 110 m_firstChild = oldChild->nextSibling();
105 if (lastChild() == oldChild) 111 if (lastChild() == oldChild)
106 m_lastChild = oldChild->previousSibling(); 112 m_lastChild = oldChild->previousSibling();
(...skipping 19 matching lines...) Expand all
126 ASSERT(!newChild->parent()); 132 ASSERT(!newChild->parent());
127 ASSERT(this == owner->virtualChildren()); 133 ASSERT(this == owner->virtualChildren());
128 ASSERT(!owner->isLayoutBlockFlow() || 134 ASSERT(!owner->isLayoutBlockFlow() ||
129 (!newChild->isTableSection() && !newChild->isTableRow() && 135 (!newChild->isTableSection() && !newChild->isTableRow() &&
130 !newChild->isTableCell())); 136 !newChild->isTableCell()));
131 137
132 while (beforeChild && beforeChild->parent() && beforeChild->parent() != owner) 138 while (beforeChild && beforeChild->parent() && beforeChild->parent() != owner)
133 beforeChild = beforeChild->parent(); 139 beforeChild = beforeChild->parent();
134 140
135 // This should never happen, but if it does prevent layout tree corruption 141 // This should never happen, but if it does prevent layout tree corruption
136 // where child->parent() ends up being owner but child->nextSibling()->parent( ) 142 // where child->parent() ends up being owner but
137 // is not owner. 143 // child->nextSibling()->parent() is not owner.
138 if (beforeChild && beforeChild->parent() != owner) { 144 if (beforeChild && beforeChild->parent() != owner) {
139 ASSERT_NOT_REACHED(); 145 ASSERT_NOT_REACHED();
140 return; 146 return;
141 } 147 }
142 148
143 newChild->setParent(owner); 149 newChild->setParent(owner);
144 150
145 if (firstChild() == beforeChild) 151 if (firstChild() == beforeChild)
146 m_firstChild = newChild; 152 m_firstChild = newChild;
147 153
(...skipping 24 matching lines...) Expand all
172 // If the inserted node is currently marked as needing to notify children then 178 // If the inserted node is currently marked as needing to notify children then
173 // we have to propagate that mark up the tree. 179 // we have to propagate that mark up the tree.
174 if (newChild->wasNotifiedOfSubtreeChange()) 180 if (newChild->wasNotifiedOfSubtreeChange())
175 owner->notifyAncestorsOfSubtreeChange(); 181 owner->notifyAncestorsOfSubtreeChange();
176 182
177 newChild->setNeedsLayoutAndPrefWidthsRecalc( 183 newChild->setNeedsLayoutAndPrefWidthsRecalc(
178 LayoutInvalidationReason::AddedToLayout); 184 LayoutInvalidationReason::AddedToLayout);
179 newChild->setShouldDoFullPaintInvalidation( 185 newChild->setShouldDoFullPaintInvalidation(
180 PaintInvalidationLayoutObjectInsertion); 186 PaintInvalidationLayoutObjectInsertion);
181 if (!owner->normalChildNeedsLayout()) 187 if (!owner->normalChildNeedsLayout())
182 owner 188 owner->setChildNeedsLayout(); // We may supply the static position for an
183 ->setChildNeedsLayout(); // We may supply the static position for an ab solute positioned child. 189 // absolute positioned child.
184 190
185 if (!owner->documentBeingDestroyed()) 191 if (!owner->documentBeingDestroyed())
186 owner->notifyOfSubtreeChange(); 192 owner->notifyOfSubtreeChange();
187 193
188 if (AXObjectCache* cache = owner->document().axObjectCache()) 194 if (AXObjectCache* cache = owner->document().axObjectCache())
189 cache->childrenChanged(owner); 195 cache->childrenChanged(owner);
190 } 196 }
191 197
192 void LayoutObjectChildList::invalidatePaintOnRemoval(LayoutObject& oldChild) { 198 void LayoutObjectChildList::invalidatePaintOnRemoval(LayoutObject& oldChild) {
193 if (!oldChild.isRooted()) 199 if (!oldChild.isRooted())
194 return; 200 return;
195 if (oldChild.isBody()) 201 if (oldChild.isBody())
196 oldChild.view()->setShouldDoFullPaintInvalidation(); 202 oldChild.view()->setShouldDoFullPaintInvalidation();
197 ObjectPaintInvalidator paintInvalidator(oldChild); 203 ObjectPaintInvalidator paintInvalidator(oldChild);
198 paintInvalidator.slowSetPaintingLayerNeedsRepaint(); 204 paintInvalidator.slowSetPaintingLayerNeedsRepaint();
199 paintInvalidator.invalidatePaintOfPreviousPaintInvalidationRect( 205 paintInvalidator.invalidatePaintOfPreviousPaintInvalidationRect(
200 oldChild.containerForPaintInvalidation(), 206 oldChild.containerForPaintInvalidation(),
201 PaintInvalidationLayoutObjectRemoval); 207 PaintInvalidationLayoutObjectRemoval);
202 } 208 }
203 209
204 } // namespace blink 210 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698