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

Side by Side Diff: Source/core/rendering/RenderButton.cpp

Issue 217563003: Turn styleWillChange |newStyle| into a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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) 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 // are not m_inner prevents security problems when that assumption is 56 // are not m_inner prevents security problems when that assumption is
57 // violated. 57 // violated.
58 if (oldChild == m_inner || !m_inner || oldChild->parent() == this) { 58 if (oldChild == m_inner || !m_inner || oldChild->parent() == this) {
59 ASSERT(oldChild == m_inner || !m_inner); 59 ASSERT(oldChild == m_inner || !m_inner);
60 RenderFlexibleBox::removeChild(oldChild); 60 RenderFlexibleBox::removeChild(oldChild);
61 m_inner = 0; 61 m_inner = 0;
62 } else 62 } else
63 m_inner->removeChild(oldChild); 63 m_inner->removeChild(oldChild);
64 } 64 }
65 65
66 void RenderButton::styleWillChange(StyleDifference diff, const RenderStyle* newS tyle) 66 void RenderButton::styleWillChange(StyleDifference diff, const RenderStyle& newS tyle)
67 { 67 {
68 if (m_inner) { 68 if (m_inner) {
69 // RenderBlock::setStyle is going to apply a new style to the inner bloc k, which 69 // RenderBlock::setStyle is going to apply a new style to the inner bloc k, which
70 // will have the initial flex value, 0. The current value is 1, because we set 70 // will have the initial flex value, 0. The current value is 1, because we set
71 // it right below. Here we change it back to 0 to avoid getting a spurio us layout hint 71 // it right below. Here we change it back to 0 to avoid getting a spurio us layout hint
72 // because of the difference. Same goes for the other properties. 72 // because of the difference. Same goes for the other properties.
73 // FIXME: Make this hack unnecessary. 73 // FIXME: Make this hack unnecessary.
74 m_inner->style()->setFlexGrow(newStyle->initialFlexGrow()); 74 m_inner->style()->setFlexGrow(newStyle.initialFlexGrow());
75 m_inner->style()->setMarginTop(newStyle->initialMargin()); 75 m_inner->style()->setMarginTop(newStyle.initialMargin());
76 m_inner->style()->setMarginBottom(newStyle->initialMargin()); 76 m_inner->style()->setMarginBottom(newStyle.initialMargin());
77 } 77 }
78 RenderBlock::styleWillChange(diff, newStyle); 78 RenderBlock::styleWillChange(diff, newStyle);
79 } 79 }
80 80
81 void RenderButton::styleDidChange(StyleDifference diff, const RenderStyle* oldSt yle) 81 void RenderButton::styleDidChange(StyleDifference diff, const RenderStyle* oldSt yle)
82 { 82 {
83 RenderBlock::styleDidChange(diff, oldStyle); 83 RenderBlock::styleDidChange(diff, oldStyle);
84 84
85 if (m_inner) // RenderBlock handled updating the anonymous block's style. 85 if (m_inner) // RenderBlock handled updating the anonymous block's style.
86 setupInnerStyle(m_inner->style()); 86 setupInnerStyle(m_inner->style());
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // baseline for the empty case manually here. 125 // baseline for the empty case manually here.
126 if (direction == HorizontalLine) 126 if (direction == HorizontalLine)
127 return marginTop() + borderTop() + paddingTop() + contentHeight(); 127 return marginTop() + borderTop() + paddingTop() + contentHeight();
128 128
129 return marginRight() + borderRight() + paddingRight() + contentWidth(); 129 return marginRight() + borderRight() + paddingRight() + contentWidth();
130 } 130 }
131 return RenderFlexibleBox::baselinePosition(baseline, firstLine, direction, l inePositionMode); 131 return RenderFlexibleBox::baselinePosition(baseline, firstLine, direction, l inePositionMode);
132 } 132 }
133 133
134 } // namespace WebCore 134 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698