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

Side by Side Diff: third_party/WebKit/WebCore/rendering/RenderSVGContainer.cpp

Issue 20076: WebKit merge 40500:40539 [WebKit side] (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2 Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 2004, 2005, 2007, 2008 Rob Buis <buis@kde.org> 3 2004, 2005, 2007, 2008 Rob Buis <buis@kde.org>
4 2007 Eric Seidel <eric@webkit.org> 4 2007 Eric Seidel <eric@webkit.org>
5 5
6 This file is part of the KDE project 6 This file is part of the KDE project
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 , m_drawsContents(true) 44 , m_drawsContents(true)
45 { 45 {
46 } 46 }
47 47
48 RenderSVGContainer::~RenderSVGContainer() 48 RenderSVGContainer::~RenderSVGContainer()
49 { 49 {
50 } 50 }
51 51
52 void RenderSVGContainer::addChild(RenderObject* newChild, RenderObject* beforeCh ild) 52 void RenderSVGContainer::addChild(RenderObject* newChild, RenderObject* beforeCh ild)
53 { 53 {
54 insertChildNode(newChild, beforeChild); 54 children()->insertChildNode(this, newChild, beforeChild);
55 } 55 }
56 56
57 void RenderSVGContainer::removeChild(RenderObject* oldChild) 57 void RenderSVGContainer::removeChild(RenderObject* oldChild)
58 { 58 {
59 // We do this here instead of in removeChildNode, since the only extremely l ow-level uses of remove/appendChildNode 59 // We do this here instead of in removeChildNode, since the only extremely l ow-level uses of remove/appendChildNode
60 // cannot affect the positioned object list, and the floating object list is irrelevant (since the list gets cleared on 60 // cannot affect the positioned object list, and the floating object list is irrelevant (since the list gets cleared on
61 // layout anyway). 61 // layout anyway).
62 oldChild->removeFromObjectLists(); 62 oldChild->removeFromObjectLists();
63 63
64 removeChildNode(oldChild); 64 children()->removeChildNode(this, oldChild);
65 } 65 }
66 66
67 void RenderSVGContainer::destroy() 67 void RenderSVGContainer::destroy()
68 { 68 {
69 children()->destroyLeftoverChildren(); 69 children()->destroyLeftoverChildren();
70 RenderObject::destroy(); 70 RenderObject::destroy();
71 } 71 }
72 72
73 RenderObject* RenderSVGContainer::removeChildNode(RenderObject* oldChild, bool f ullRemove)
74 {
75 ASSERT(oldChild->parent() == this);
76
77 // So that we'll get the appropriate dirty bit set (either that a normal flo w child got yanked or
78 // that a positioned child got yanked). We also repaint, so that the area e xposed when the child
79 // disappears gets repainted properly.
80 if (!documentBeingDestroyed() && fullRemove) {
81 oldChild->setNeedsLayoutAndPrefWidthsRecalc();
82 oldChild->repaint();
83 }
84
85 // If we have a line box wrapper, delete it.
86 oldChild->deleteLineBoxWrapper();
87
88 if (!documentBeingDestroyed() && fullRemove) {
89 // If oldChild is the start or end of the selection, then clear the sele ction to
90 // avoid problems of invalid pointers.
91 // FIXME: The SelectionController should be responsible for this when it
92 // is notified of DOM mutations.
93 if (oldChild->isSelectionBorder())
94 view()->clearSelection();
95 }
96
97 // remove the child
98 if (oldChild->previousSibling())
99 oldChild->previousSibling()->setNextSibling(oldChild->nextSibling());
100 if (oldChild->nextSibling())
101 oldChild->nextSibling()->setPreviousSibling(oldChild->previousSibling()) ;
102
103 if (children()->firstChild() == oldChild)
104 children()->setFirstChild(oldChild->nextSibling());
105 if (children()->lastChild() == oldChild)
106 children()->setLastChild(oldChild->previousSibling());
107
108 oldChild->setPreviousSibling(0);
109 oldChild->setNextSibling(0);
110 oldChild->setParent(0);
111
112 if (AXObjectCache::accessibilityEnabled())
113 document()->axObjectCache()->childrenChanged(this);
114
115 return oldChild;
116 }
117
118 void RenderSVGContainer::appendChildNode(RenderObject* newChild, bool)
119 {
120 ASSERT(!newChild->parent());
121 ASSERT(newChild->element()->isSVGElement());
122
123 newChild->setParent(this);
124 RenderObject* lChild = children()->lastChild();
125
126 if (lChild) {
127 newChild->setPreviousSibling(lChild);
128 lChild->setNextSibling(newChild);
129 } else
130 children()->setFirstChild(newChild);
131
132 children()->setLastChild(newChild);
133
134 newChild->setNeedsLayoutAndPrefWidthsRecalc(); // Goes up the containing blo ck hierarchy.
135 if (!normalChildNeedsLayout())
136 setChildNeedsLayout(true); // We may supply the static position for an a bsolute positioned child.
137
138 if (AXObjectCache::accessibilityEnabled())
139 document()->axObjectCache()->childrenChanged(this);
140 }
141
142 void RenderSVGContainer::insertChildNode(RenderObject* child, RenderObject* befo reChild, bool)
143 {
144 if (!beforeChild) {
145 appendChildNode(child);
146 return;
147 }
148
149 ASSERT(!child->parent());
150 ASSERT(beforeChild->parent() == this);
151 ASSERT(child->element()->isSVGElement());
152
153 if (beforeChild == children()->firstChild())
154 children()->setFirstChild(child);
155
156 RenderObject* prev = beforeChild->previousSibling();
157 child->setNextSibling(beforeChild);
158 beforeChild->setPreviousSibling(child);
159 if (prev)
160 prev->setNextSibling(child);
161 child->setPreviousSibling(prev);
162
163 child->setParent(this);
164
165 child->setNeedsLayoutAndPrefWidthsRecalc();
166 if (!normalChildNeedsLayout())
167 setChildNeedsLayout(true); // We may supply the static position for an a bsolute positioned child.
168
169 if (AXObjectCache::accessibilityEnabled())
170 document()->axObjectCache()->childrenChanged(this);
171 }
172
173 bool RenderSVGContainer::drawsContents() const 73 bool RenderSVGContainer::drawsContents() const
174 { 74 {
175 return m_drawsContents; 75 return m_drawsContents;
176 } 76 }
177 77
178 void RenderSVGContainer::setDrawsContents(bool drawsContents) 78 void RenderSVGContainer::setDrawsContents(bool drawsContents)
179 { 79 {
180 m_drawsContents = drawsContents; 80 m_drawsContents = drawsContents;
181 } 81 }
182 82
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 IntRect result = m_absoluteBounds; 307 IntRect result = m_absoluteBounds;
408 adjustRectForOutlineAndShadow(result); 308 adjustRectForOutlineAndShadow(result);
409 return result; 309 return result;
410 } 310 }
411 311
412 } 312 }
413 313
414 #endif // ENABLE(SVG) 314 #endif // ENABLE(SVG)
415 315
416 // vim:ts=4:noet 316 // vim:ts=4:noet
OLDNEW
« no previous file with comments | « third_party/WebKit/WebCore/rendering/RenderSVGContainer.h ('k') | third_party/WebKit/WebCore/rendering/RenderTable.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698