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 17 matching lines...) Expand all Loading... |
28 RenderButton::RenderButton(Element* element) | 28 RenderButton::RenderButton(Element* element) |
29 : RenderFlexibleBox(element) | 29 : RenderFlexibleBox(element) |
30 , m_inner(0) | 30 , m_inner(0) |
31 { | 31 { |
32 } | 32 } |
33 | 33 |
34 RenderButton::~RenderButton() | 34 RenderButton::~RenderButton() |
35 { | 35 { |
36 } | 36 } |
37 | 37 |
38 void RenderButton::addChild(RenderObject* newChild, RenderObject* beforeChild) | 38 void RenderButton::addChild(LayoutObject* newChild, LayoutObject* beforeChild) |
39 { | 39 { |
40 if (!m_inner) { | 40 if (!m_inner) { |
41 // Create an anonymous block. | 41 // Create an anonymous block. |
42 ASSERT(!firstChild()); | 42 ASSERT(!firstChild()); |
43 m_inner = createAnonymousBlock(style()->display()); | 43 m_inner = createAnonymousBlock(style()->display()); |
44 RenderFlexibleBox::addChild(m_inner); | 44 RenderFlexibleBox::addChild(m_inner); |
45 } | 45 } |
46 | 46 |
47 m_inner->addChild(newChild, beforeChild); | 47 m_inner->addChild(newChild, beforeChild); |
48 } | 48 } |
49 | 49 |
50 void RenderButton::removeChild(RenderObject* oldChild) | 50 void RenderButton::removeChild(LayoutObject* oldChild) |
51 { | 51 { |
52 // m_inner should be the only child, but checking for direct children who | 52 // m_inner should be the only child, but checking for direct children who |
53 // are not m_inner prevents security problems when that assumption is | 53 // are not m_inner prevents security problems when that assumption is |
54 // violated. | 54 // violated. |
55 if (oldChild == m_inner || !m_inner || oldChild->parent() == this) { | 55 if (oldChild == m_inner || !m_inner || oldChild->parent() == this) { |
56 ASSERT(oldChild == m_inner || !m_inner); | 56 ASSERT(oldChild == m_inner || !m_inner); |
57 RenderFlexibleBox::removeChild(oldChild); | 57 RenderFlexibleBox::removeChild(oldChild); |
58 m_inner = 0; | 58 m_inner = 0; |
59 } else | 59 } else |
60 m_inner->removeChild(oldChild); | 60 m_inner->removeChild(oldChild); |
61 } | 61 } |
62 | 62 |
63 void RenderButton::updateAnonymousChildStyle(const RenderObject* child, RenderSt
yle* childStyle) const | 63 void RenderButton::updateAnonymousChildStyle(const LayoutObject* child, RenderSt
yle* childStyle) const |
64 { | 64 { |
65 ASSERT(!m_inner || child == m_inner); | 65 ASSERT(!m_inner || child == m_inner); |
66 | 66 |
67 childStyle->setFlexGrow(1.0f); | 67 childStyle->setFlexGrow(1.0f); |
68 // Use margin:auto instead of align-items:center to get safe centering, i.e. | 68 // Use margin:auto instead of align-items:center to get safe centering, i.e. |
69 // when the content overflows, treat it the same as align-items: flex-start. | 69 // when the content overflows, treat it the same as align-items: flex-start. |
70 childStyle->setMarginTop(Length()); | 70 childStyle->setMarginTop(Length()); |
71 childStyle->setMarginBottom(Length()); | 71 childStyle->setMarginBottom(Length()); |
72 childStyle->setFlexDirection(style()->flexDirection()); | 72 childStyle->setFlexDirection(style()->flexDirection()); |
73 childStyle->setJustifyContent(style()->justifyContent()); | 73 childStyle->setJustifyContent(style()->justifyContent()); |
(...skipping 30 matching lines...) Expand all Loading... |
104 // baseline for the empty case manually here. | 104 // baseline for the empty case manually here. |
105 if (direction == HorizontalLine) { | 105 if (direction == HorizontalLine) { |
106 return marginTop() + size().height() - borderBottom() - paddingBotto
m() - horizontalScrollbarHeight(); | 106 return marginTop() + size().height() - borderBottom() - paddingBotto
m() - horizontalScrollbarHeight(); |
107 } | 107 } |
108 return marginRight() + size().width() - borderLeft() - paddingLeft() - v
erticalScrollbarWidth(); | 108 return marginRight() + size().width() - borderLeft() - paddingLeft() - v
erticalScrollbarWidth(); |
109 } | 109 } |
110 return RenderFlexibleBox::baselinePosition(baseline, firstLine, direction, l
inePositionMode); | 110 return RenderFlexibleBox::baselinePosition(baseline, firstLine, direction, l
inePositionMode); |
111 } | 111 } |
112 | 112 |
113 } // namespace blink | 113 } // namespace blink |
OLD | NEW |