From 4af9f58602556a280bafd74778c543f06b19f7cb Mon Sep 17 00:00:00 2001 From: "bjonesbe@adobe.com" Date: Thu, 19 Sep 2013 01:31:11 +0000 Subject: [PATCH] REGRESSION (r155854 - r155967) block with margin-left adjacent to floated block causes text of subsequent blocks to overlap the floated block. https://bugs.webkit.org/show_bug.cgi?id=121532 Reviewed by Andreas Kling. Source/WebCore: When refactoring the code, I ended up adding the margin in instead of subtracting it in the case of an intruding float. This patch fixes that so that the margin is properly handled. Test: fast/block/float/intruding-float-sibling-with-margin.html * rendering/RenderBlock.cpp: (WebCore::RenderBlock::addIntrudingFloats): LayoutTests: * fast/block/float/intruding-float-sibling-with-margin-expected.html: Added. * fast/block/float/intruding-float-sibling-with-margin.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@156075 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- LayoutTests/ChangeLog | 10 ++++++++ ...truding-float-sibling-with-margin-expected.html | 25 +++++++++++++++++++ .../float/intruding-float-sibling-with-margin.html | 28 ++++++++++++++++++++++ Source/WebCore/ChangeLog | 16 +++++++++++++ Source/WebCore/rendering/RenderBlock.cpp | 4 ++-- 5 files changed, 81 insertions(+), 2 deletions(-) create mode 100644 LayoutTests/fast/block/float/intruding-float-sibling-with-margin-expected.html create mode 100644 LayoutTests/fast/block/float/intruding-float-sibling-with-margin.html diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index 82d722e..4cf5f0f 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,3 +1,13 @@ +2013-09-18 Bem Jones-Bey + + REGRESSION (r155854 - r155967) block with margin-left adjacent to floated block causes text of subsequent blocks to overlap the floated block. + https://bugs.webkit.org/show_bug.cgi?id=121532 + + Reviewed by Andreas Kling. + + * fast/block/float/intruding-float-sibling-with-margin-expected.html: Added. + * fast/block/float/intruding-float-sibling-with-margin.html: Added. + 2013-09-18 Ryosuke Niwa Merge HTMLBodyElement::didNotifySubtreeInsertions into HTMLBodyElement::insertedInto diff --git a/LayoutTests/fast/block/float/intruding-float-sibling-with-margin-expected.html b/LayoutTests/fast/block/float/intruding-float-sibling-with-margin-expected.html new file mode 100644 index 0000000..48746ff --- /dev/null +++ b/LayoutTests/fast/block/float/intruding-float-sibling-with-margin-expected.html @@ -0,0 +1,25 @@ + + + +

You should see a single green square. You should not see any red.

+
+
+
X
+
X
+
+ diff --git a/LayoutTests/fast/block/float/intruding-float-sibling-with-margin.html b/LayoutTests/fast/block/float/intruding-float-sibling-with-margin.html new file mode 100644 index 0000000..dbf8227 --- /dev/null +++ b/LayoutTests/fast/block/float/intruding-float-sibling-with-margin.html @@ -0,0 +1,28 @@ + + + +

You should see a single green square. You should not see any red.

+
+
+
X
+
X
+
+ diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 0544050..1febb31 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,19 @@ +2013-09-18 Bem Jones-Bey + + REGRESSION (r155854 - r155967) block with margin-left adjacent to floated block causes text of subsequent blocks to overlap the floated block. + https://bugs.webkit.org/show_bug.cgi?id=121532 + + Reviewed by Andreas Kling. + + When refactoring the code, I ended up adding the margin in instead of + subtracting it in the case of an intruding float. This patch fixes + that so that the margin is properly handled. + + Test: fast/block/float/intruding-float-sibling-with-margin.html + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::addIntrudingFloats): + 2013-09-18 Ryosuke Niwa Merge HTMLBodyElement::didNotifySubtreeInsertions into HTMLBodyElement::insertedInto diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp index 4b41a1e..194d77f 100644 --- a/Source/WebCore/rendering/RenderBlock.cpp +++ b/Source/WebCore/rendering/RenderBlock.cpp @@ -3887,8 +3887,8 @@ void RenderBlock::addIntrudingFloats(RenderBlock* prev, LayoutUnit logicalLeftOf // into account. Only apply this code if prev is the parent, since otherwise the left margin // will get applied twice. LayoutSize offset = isHorizontalWritingMode() - ? LayoutSize(logicalLeftOffset + (prev != parent() ? prev->marginLeft() : LayoutUnit()), logicalTopOffset) - : LayoutSize(logicalTopOffset, logicalLeftOffset + (prev != parent() ? prev->marginTop() : LayoutUnit())); + ? LayoutSize(logicalLeftOffset - (prev != parent() ? prev->marginLeft() : LayoutUnit()), logicalTopOffset) + : LayoutSize(logicalTopOffset, logicalLeftOffset - (prev != parent() ? prev->marginTop() : LayoutUnit())); m_floatingObjects->add(r->copyToNewContainer(offset)); } -- 1.8.3.1