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

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

Issue 766223004: Blocks should be aligned by style of parents (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: consider ltr in rtl Created 6 years 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 2091 matching lines...) Expand 10 before | Expand all | Expand 10 after
2102 2102
2103 // CSS 2.1: "If there is exactly one value specified as 'auto', its used val ue follows from the equality." 2103 // CSS 2.1: "If there is exactly one value specified as 'auto', its used val ue follows from the equality."
2104 if (marginEndLength.isAuto() && marginBoxWidth < availableWidth) { 2104 if (marginEndLength.isAuto() && marginBoxWidth < availableWidth) {
2105 marginStart = marginStartWidth; 2105 marginStart = marginStartWidth;
2106 marginEnd = availableWidth - childWidth - marginStart; 2106 marginEnd = availableWidth - childWidth - marginStart;
2107 return; 2107 return;
2108 } 2108 }
2109 2109
2110 bool pushToEndFromTextAlign = !marginEndLength.isAuto() && ((!containingBloc kStyle->isLeftToRightDirection() && containingBlockStyle->textAlign() == WEBKIT_ LEFT) 2110 bool pushToEndFromTextAlign = !marginEndLength.isAuto() && ((!containingBloc kStyle->isLeftToRightDirection() && containingBlockStyle->textAlign() == WEBKIT_ LEFT)
2111 || (containingBlockStyle->isLeftToRightDirection() && containingBlockSty le->textAlign() == WEBKIT_RIGHT)); 2111 || (containingBlockStyle->isLeftToRightDirection() && containingBlockSty le->textAlign() == WEBKIT_RIGHT));
2112 if ((marginStartLength.isAuto() && marginBoxWidth < availableWidth) || pushT oEndFromTextAlign) { 2112 if ((marginStartLength.isAuto() && marginBoxWidth < availableWidth) || pushT oEndFromTextAlign) {
mstensho (USE GERRIT) 2014/12/08 10:01:21 Now handling of regular auto margins will be broke
Kyungtae Kim 2014/12/09 04:53:08 I included autoMargin cases in a new test case
2113 marginEnd = marginEndWidth; 2113 if (containingBlockStyle->isLeftToRightDirection() != style()->isLeftToR ightDirection()) {
2114 marginStart = availableWidth - childWidth - marginEnd; 2114 marginStart = marginStartWidth;
2115 marginEnd = availableWidth - childWidth - marginStart;
2116 } else {
2117 marginEnd = marginEndWidth;
2118 marginStart = availableWidth - childWidth - marginEnd;
2119 }
2115 return; 2120 return;
2116 } 2121 }
2117 2122
2118 // Either no auto margins, or our margin box width is >= the container width , auto margins will just turn into 0. 2123 // Either no auto margins, or our margin box width is >= the container width , auto margins will just turn into 0.
2119 marginStart = marginStartWidth; 2124 marginStart = marginStartWidth;
2120 marginEnd = marginEndWidth; 2125 marginEnd = marginEndWidth;
2121 } 2126 }
2122 2127
2123 void RenderBox::updateLogicalHeight() 2128 void RenderBox::updateLogicalHeight()
2124 { 2129 {
(...skipping 2304 matching lines...) Expand 10 before | Expand all | Expand 10 after
4429 computedValues.m_margins.m_end = marginEnd(); 4434 computedValues.m_margins.m_end = marginEnd();
4430 4435
4431 setLogicalTop(oldLogicalTop); 4436 setLogicalTop(oldLogicalTop);
4432 setLogicalWidth(oldLogicalWidth); 4437 setLogicalWidth(oldLogicalWidth);
4433 setLogicalLeft(oldLogicalLeft); 4438 setLogicalLeft(oldLogicalLeft);
4434 setMarginLeft(oldMarginLeft); 4439 setMarginLeft(oldMarginLeft);
4435 setMarginRight(oldMarginRight); 4440 setMarginRight(oldMarginRight);
4436 } 4441 }
4437 4442
4438 } // namespace blink 4443 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698