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

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

Issue 2554813004: Revert "Do not remove floating legend from inner block as it gets destroyed somewhere else." (Closed)
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | 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/LayoutFieldset.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutFieldset.cpp b/third_party/WebKit/Source/core/layout/LayoutFieldset.cpp
index d8d619291bde421939b83de0e325d5538753a3e4..f0eb1cb0bb31fa10c48ff27296ab5c51a2b96c4b 100644
--- a/third_party/WebKit/Source/core/layout/LayoutFieldset.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutFieldset.cpp
@@ -260,16 +260,17 @@ void LayoutFieldset::addChild(LayoutObject* newChild,
createInnerBlock();
if (isHTMLLegendElement(newChild->node())) {
- // Flexbox forces the floating legend to be non-floating => add the floating
- // legend to the inner block.
+ // Let legend block to be the 2nd for correct layout positioning.
+ newChild->mutableStyle()->setOrder(2);
+
+ // LayoutFlexibleBox::addChild will create an anonymous block if legend is
+ // float. Use the existing fieldset's anonymous block here instead.
if (newChild->isFloatingOrOutOfFlowPositioned()) {
- // Always add the legend first, i.e. before m_innerBlock->firstChild()
- m_innerBlock->addChild(newChild, m_innerBlock->firstChild());
+ m_innerBlock->addChild(newChild);
} else {
- // Let legend block to be the 2nd for correct layout positioning.
- newChild->mutableStyle()->setOrder(2);
LayoutFlexibleBox::addChild(newChild, m_innerBlock);
}
+
} else {
if (beforeChild && isHTMLLegendElement(beforeChild->node())) {
m_innerBlock->addChild(newChild);
@@ -292,12 +293,17 @@ void LayoutFieldset::createInnerBlock() {
void LayoutFieldset::removeChild(LayoutObject* oldChild) {
if (isHTMLLegendElement(oldChild->node())) {
- LayoutFlexibleBox::removeChild(oldChild);
- if (m_innerBlock) {
- resetInnerBlockPadding(isHorizontalWritingMode(), m_innerBlock);
- m_innerBlock->setNeedsLayout(LayoutInvalidationReason::FieldsetChanged,
- MarkOnlyThis);
+ if (oldChild->isFloatingOrOutOfFlowPositioned()) {
+ m_innerBlock->removeChild(oldChild);
+ } else {
+ LayoutFlexibleBox::removeChild(oldChild);
+ if (m_innerBlock) {
+ resetInnerBlockPadding(isHorizontalWritingMode(), m_innerBlock);
+ m_innerBlock->setNeedsLayout(LayoutInvalidationReason::FieldsetChanged,
+ MarkOnlyThis);
+ }
}
+
setShouldDoFullPaintInvalidation();
} else if (oldChild == m_innerBlock) {
LayoutFlexibleBox::removeChild(oldChild);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698