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

Unified Diff: third_party/WebKit/Source/core/paint/FieldsetPainter.cpp

Issue 2396813002: Support margin-top for legend in fieldset. (Closed)
Patch Set: Rebased to master. Created 4 years, 2 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/LayoutFieldset.cpp ('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/paint/FieldsetPainter.cpp
diff --git a/third_party/WebKit/Source/core/paint/FieldsetPainter.cpp b/third_party/WebKit/Source/core/paint/FieldsetPainter.cpp
index f79bfb0465f27105de816db4273be2a7503ae097..26162b3839fb48c4f6394b71c141a806ac254871 100644
--- a/third_party/WebKit/Source/core/paint/FieldsetPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/FieldsetPainter.cpp
@@ -31,16 +31,18 @@ void FieldsetPainter::paintBoxDecorationBackground(
// https://bugs.webkit.org/show_bug.cgi?id=47236
if (m_layoutFieldset.style()->isHorizontalWritingMode()) {
LayoutUnit yOff =
- (legend->location().y() > 0)
- ? LayoutUnit()
- : (legend->size().height() - m_layoutFieldset.borderTop()) / 2;
+ (legend->location().y() +
+ (legend->size().height() - m_layoutFieldset.borderTop()) / 2)
+ .clampNegativeToZero();
+
paintRect.setHeight(paintRect.height() - yOff);
paintRect.setY(paintRect.y() + yOff);
} else {
LayoutUnit xOff =
- (legend->location().x() > 0)
- ? LayoutUnit()
- : (legend->size().width() - m_layoutFieldset.borderLeft()) / 2;
+ (legend->location().x() +
+ (legend->size().width() - m_layoutFieldset.borderLeft()) / 2)
+ .clampNegativeToZero();
+
paintRect.setWidth(paintRect.width() - xOff);
paintRect.setX(paintRect.x() + xOff);
}
@@ -111,16 +113,18 @@ void FieldsetPainter::paintMask(const PaintInfo& paintInfo,
// https://bugs.webkit.org/show_bug.cgi?id=47236
if (m_layoutFieldset.style()->isHorizontalWritingMode()) {
LayoutUnit yOff =
- (legend->location().y() > LayoutUnit())
- ? LayoutUnit()
- : (legend->size().height() - m_layoutFieldset.borderTop()) / 2;
+ (legend->location().y() +
+ (legend->size().height() - m_layoutFieldset.borderTop()) / 2)
+ .clampNegativeToZero();
+
paintRect.expand(LayoutUnit(), -yOff);
paintRect.move(LayoutUnit(), yOff);
} else {
LayoutUnit xOff =
- (legend->location().x() > LayoutUnit())
- ? LayoutUnit()
- : (legend->size().width() - m_layoutFieldset.borderLeft()) / 2;
+ (legend->location().x() +
+ (legend->size().width() - m_layoutFieldset.borderLeft()) / 2)
+ .clampNegativeToZero();
+
paintRect.expand(-xOff, LayoutUnit());
paintRect.move(xOff, LayoutUnit());
}
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutFieldset.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698