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

Unified Diff: Source/core/rendering/RenderButton.cpp

Issue 278603002: Centering text inside a button set to display flex with justify-content: center is impossible (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixup for Mac Layout tests Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/repaint/button-spurious-layout-hint-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderButton.cpp
diff --git a/Source/core/rendering/RenderButton.cpp b/Source/core/rendering/RenderButton.cpp
index 4a58833036388f69ba2117ec3f5f007b366bb000..bf1bac58cda037c5ed8c9065e00320e02cb8c660 100644
--- a/Source/core/rendering/RenderButton.cpp
+++ b/Source/core/rendering/RenderButton.cpp
@@ -89,13 +89,20 @@ void RenderButton::styleDidChange(StyleDifference diff, const RenderStyle* oldSt
void RenderButton::setupInnerStyle(RenderStyle* innerStyle)
{
ASSERT(innerStyle->refCount() == 1);
- // RenderBlock::createAnonymousBlock creates a new RenderStyle, so this is
cbiesinger 2014/05/13 07:58:27 You need to keep this comment.
harpreet.sk 2014/05/13 09:30:44 I will keep this comment in next patch.
- // safe to modify.
- innerStyle->setFlexGrow(1.0f);
cbiesinger 2014/05/13 07:58:27 Why remove this line?
harpreet.sk 2014/05/13 09:30:44 Actually i removed this line as this line will dis
// Use margin:auto instead of align-items:center to get safe centering, i.e.
// when the content overflows, treat it the same as align-items: flex-start.
innerStyle->setMarginTop(Length());
innerStyle->setMarginBottom(Length());
+
+ if (innerStyle->textAlign() == LEFT || innerStyle->textAlign() == WEBKIT_LEFT) {
+ innerStyle->setMarginRight(Length());
+ } else if (innerStyle->textAlign() == RIGHT || innerStyle->textAlign() == WEBKIT_RIGHT) {
+ innerStyle->setMarginLeft(Length());
+ } else {
+ innerStyle->setMarginLeft(Length());
+ innerStyle->setMarginRight(Length());
+ }
+
innerStyle->setFlexDirection(style()->flexDirection());
}
« no previous file with comments | « LayoutTests/fast/repaint/button-spurious-layout-hint-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698