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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutButton.cpp

Issue 2177563003: Button experiment Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 | « third_party/WebKit/Source/core/layout/LayoutButton.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/LayoutButton.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutButton.cpp b/third_party/WebKit/Source/core/layout/LayoutButton.cpp
index ab90e891c6fab34fe7215f8654920e8a1a4e1699..0f9b2cc8935b0df61871b0d87a932307f4396ce7 100644
--- a/third_party/WebKit/Source/core/layout/LayoutButton.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutButton.cpp
@@ -25,7 +25,7 @@ namespace blink {
using namespace HTMLNames;
LayoutButton::LayoutButton(Element* element)
- : LayoutFlexibleBox(element)
+ : LayoutBlockFlow(element)
, m_inner(nullptr)
{
}
@@ -40,7 +40,7 @@ void LayoutButton::addChild(LayoutObject* newChild, LayoutObject* beforeChild)
// Create an anonymous block.
ASSERT(!firstChild());
m_inner = createAnonymousBlock(style()->display());
- LayoutFlexibleBox::addChild(m_inner);
+ LayoutBlockFlow::addChild(m_inner);
}
m_inner->addChild(newChild, beforeChild);
@@ -49,13 +49,13 @@ void LayoutButton::addChild(LayoutObject* newChild, LayoutObject* beforeChild)
void LayoutButton::removeChild(LayoutObject* oldChild)
{
if (oldChild == m_inner || !m_inner) {
- LayoutFlexibleBox::removeChild(oldChild);
+ LayoutBlockFlow::removeChild(oldChild);
m_inner = 0;
} else if (oldChild->parent() == this) {
// We aren't the inner node, but we're getting removed from the button, this
// can happen with things like scrollable area resizer's.
- LayoutFlexibleBox::removeChild(oldChild);
+ LayoutBlockFlow::removeChild(oldChild);
} else {
m_inner->removeChild(oldChild);
@@ -67,6 +67,7 @@ void LayoutButton::updateAnonymousChildStyle(const LayoutObject& child, Computed
ASSERT(!m_inner || &child == m_inner);
childStyle.setFlexGrow(1.0f);
+ childStyle.setHeight(Length(0, FillAvailable));
// min-width: 0; is needed for correct shrinking.
childStyle.setMinWidth(Length(0, Fixed));
// Use margin:auto instead of align-items:center to get safe centering, i.e.
@@ -92,9 +93,9 @@ int LayoutButton::baselinePosition(FontBaseline baseline, bool firstLine, LineDi
{
ASSERT(linePositionMode == PositionOnContainingLine);
// We want to call the LayoutBlock version of firstLineBoxBaseline to
- // avoid LayoutFlexibleBox synthesizing a baseline that we don't want.
+ // avoid LayoutBlockFlow synthesizing a baseline that we don't want.
// We use this check as a proxy for "are there any line boxes in this button"
- if (!hasLineIfEmpty() && LayoutBlock::firstLineBoxBaseline() == -1) {
+ if (!hasLineIfEmpty() && (!firstChild() || LayoutBlock::firstLineBoxBaseline() == -1)) {
// To ensure that we have a consistent baseline when we have no children,
// even when we have the anonymous LayoutBlock child, we calculate the
// baseline for the empty case manually here.
@@ -103,7 +104,7 @@ int LayoutButton::baselinePosition(FontBaseline baseline, bool firstLine, LineDi
}
return marginRight() + size().width() - borderLeft() - paddingLeft() - verticalScrollbarWidth();
}
- return LayoutFlexibleBox::baselinePosition(baseline, firstLine, direction, linePositionMode);
+ return LayoutBlockFlow::baselinePosition(baseline, firstLine, direction, linePositionMode);
}
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutButton.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698