OLD | NEW |
1 /** | 1 /** |
2 * Copyright (C) 2005 Apple Computer, Inc. | 2 * Copyright (C) 2005 Apple Computer, Inc. |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 m_inner = createAnonymousBlock(style()->display()); | 53 m_inner = createAnonymousBlock(style()->display()); |
54 setupInnerStyle(m_inner->style()); | 54 setupInnerStyle(m_inner->style()); |
55 RenderDeprecatedFlexibleBox::addChild(m_inner); | 55 RenderDeprecatedFlexibleBox::addChild(m_inner); |
56 } | 56 } |
57 | 57 |
58 m_inner->addChild(newChild, beforeChild); | 58 m_inner->addChild(newChild, beforeChild); |
59 } | 59 } |
60 | 60 |
61 void RenderButton::removeChild(RenderObject* oldChild) | 61 void RenderButton::removeChild(RenderObject* oldChild) |
62 { | 62 { |
63 if (oldChild == m_inner || !m_inner) { | 63 // m_inner should be the only child, but checking for direct children who |
| 64 // are not m_inner prevents security problems when that assumption is |
| 65 // violated. |
| 66 if (oldChild == m_inner || !m_inner || oldChild->parent() == this) { |
| 67 ASSERT(oldChild == m_inner || !m_inner); |
64 RenderDeprecatedFlexibleBox::removeChild(oldChild); | 68 RenderDeprecatedFlexibleBox::removeChild(oldChild); |
65 m_inner = 0; | 69 m_inner = 0; |
66 } else | 70 } else |
67 m_inner->removeChild(oldChild); | 71 m_inner->removeChild(oldChild); |
68 } | 72 } |
69 | 73 |
70 void RenderButton::styleWillChange(StyleDifference diff, const RenderStyle* newS
tyle) | 74 void RenderButton::styleWillChange(StyleDifference diff, const RenderStyle* newS
tyle) |
71 { | 75 { |
72 if (m_inner) { | 76 if (m_inner) { |
73 // RenderBlock::setStyle is going to apply a new style to the inner bloc
k, which | 77 // RenderBlock::setStyle is going to apply a new style to the inner bloc
k, which |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 // enters the page cache. But we currently have no way of being notified | 173 // enters the page cache. But we currently have no way of being notified |
170 // when that happens, so we'll just ignore the timer firing as long as | 174 // when that happens, so we'll just ignore the timer firing as long as |
171 // we're in the cache. | 175 // we're in the cache. |
172 if (document()->inPageCache()) | 176 if (document()->inPageCache()) |
173 return; | 177 return; |
174 | 178 |
175 repaint(); | 179 repaint(); |
176 } | 180 } |
177 | 181 |
178 } // namespace WebCore | 182 } // namespace WebCore |
OLD | NEW |