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

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

Issue 547673002: Move resolveAlignment logic to RenderStyle (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 3 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 | « no previous file | Source/core/rendering/RenderGrid.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderFlexibleBox.cpp
diff --git a/Source/core/rendering/RenderFlexibleBox.cpp b/Source/core/rendering/RenderFlexibleBox.cpp
index 101947da171ad711430ed55206bb94312d9ccae2..6b940a9b40a5ac69d0d1fad9982395414318b65e 100644
--- a/Source/core/rendering/RenderFlexibleBox.cpp
+++ b/Source/core/rendering/RenderFlexibleBox.cpp
@@ -36,6 +36,7 @@
#include "core/rendering/RenderLayer.h"
#include "core/rendering/RenderView.h"
#include "core/rendering/TextAutosizer.h"
+#include "core/rendering/style/RenderStyle.h"
#include "platform/LengthFunctions.h"
#include "wtf/MathExtras.h"
#include <limits>
@@ -193,14 +194,6 @@ int RenderFlexibleBox::inlineBlockBaseline(LineDirectionMode direction) const
return synthesizedBaselineFromContentBox(*this, direction) + marginAscent;
}
-static ItemPosition resolveAlignment(const RenderStyle* parentStyle, const RenderStyle* childStyle)
-{
- ItemPosition align = childStyle->alignSelf();
- if (align == ItemPositionAuto)
- align = (parentStyle->alignItems() == ItemPositionAuto) ? ItemPositionStretch : parentStyle->alignItems();
- return align;
-}
-
void RenderFlexibleBox::removeChild(RenderObject* child)
{
RenderBlock::removeChild(child);
@@ -215,8 +208,8 @@ void RenderFlexibleBox::styleDidChange(StyleDifference diff, const RenderStyle*
// Flex items that were previously stretching need to be relayed out so we can compute new available cross axis space.
// This is only necessary for stretching since other alignment values don't change the size of the box.
for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
- ItemPosition previousAlignment = resolveAlignment(oldStyle, child->style());
- if (previousAlignment == ItemPositionStretch && previousAlignment != resolveAlignment(style(), child->style()))
+ ItemPosition previousAlignment = RenderStyle::resolveAlignment(oldStyle, child->style());
+ if (previousAlignment == ItemPositionStretch && previousAlignment != RenderStyle::resolveAlignment(style(), child->style()))
child->setChildNeedsLayout(MarkOnlyThis);
}
}
@@ -1011,7 +1004,7 @@ void RenderFlexibleBox::prepareChildForPositionedLayout(RenderBox& child, Layout
ItemPosition RenderFlexibleBox::alignmentForChild(RenderBox& child) const
{
- ItemPosition align = resolveAlignment(style(), child.style());
+ ItemPosition align = RenderStyle::resolveAlignment(style(), child.style());
if (align == ItemPositionBaseline && hasOrthogonalFlow(child))
align = ItemPositionFlexStart;
« no previous file with comments | « no previous file | Source/core/rendering/RenderGrid.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698