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()); |
} |