Bug 109956 - -webkit-margin-collapse: separate doesn't work correctly for before margins
Summary: -webkit-margin-collapse: separate doesn't work correctly for before margins
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Andrei Bucur
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-15 11:16 PST by Andrei Bucur
Modified: 2013-02-21 09:43 PST (History)
4 users (show)

See Also:


Attachments
Patch (6.52 KB, patch)
2013-02-21 06:52 PST, Andrei Bucur
no flags Details | Formatted Diff | Diff
Patch for landing (6.46 KB, patch)
2013-02-21 09:06 PST, Andrei Bucur
webkit.review.bot: commit-queue-
Details | Formatted Diff | Diff
Patch for landing v2 (6.47 KB, patch)
2013-02-21 09:26 PST, Andrei Bucur
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrei Bucur 2013-02-15 11:16:07 PST
Specifying -webkit-margin-collapse doesn't work correctly in the case of child-container adjoining margins. At the before side of the block, the child is positioned at the sum of the margins if it specifies separate. This is wrong: the block and the child should be placed at their own margin values inside their containers.
Comment 1 Andrei Bucur 2013-02-21 06:52:48 PST
Created attachment 189523 [details]
Patch
Comment 2 Dave Hyatt 2013-02-21 08:51:41 PST
Comment on attachment 189523 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=189523&action=review

r=me

> Source/WebCore/rendering/RenderBlock.cpp:2079
> +            if (marginInfo.canCollapseWithMarginBefore())
> +                setLogicalHeight(logicalHeight() + marginBeforeForChild(child));
> +            else
> +                setLogicalHeight(logicalHeight() + marginInfo.margin() + marginBeforeForChild(child));

I think this would a bit better as:

LayoutUnit separateMargin = !marginInfo.canCollapseWithMarginBefore() ? marginInfo.margin() : 0;
setLogicalHeight(logicalHeight() + marginBeforeForChild(child) + separateMargin);
Comment 3 Andrei Bucur 2013-02-21 09:06:17 PST
Created attachment 189543 [details]
Patch for landing
Comment 4 WebKit Review Bot 2013-02-21 09:12:33 PST
Comment on attachment 189543 [details]
Patch for landing

Rejecting attachment 189543 [details] from commit-queue.

Failed to run "['/mnt/git/webkit-commit-queue/Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '--bot-id=gce-cq-04', 'build', '--no-clean', '--no-update', '--build-style=release', '--port=chromium-xvfb']" exit_code: 2 cwd: /mnt/git/webkit-commit-queue

Last 500 characters of output:
y-inlines-hidden -Wsign-compare  -c ../../Source/WebCore/rendering/RenderBlock.cpp -o obj/Source/WebCore/rendering/webcore_rendering.RenderBlock.o
../../Source/WebCore/rendering/RenderBlock.cpp: In member function 'WebCore::LayoutUnit WebCore::RenderBlock::collapseMargins(WebCore::RenderBox*, WebCore::RenderBlock::MarginInfo&)':
../../Source/WebCore/rendering/RenderBlock.cpp:2084: error: operands to ?: have different types 'WebCore::LayoutUnit' and 'int'
ninja: build stopped: subcommand failed.

Full output: http://queues.webkit.org/results/16701044
Comment 5 Andrei Bucur 2013-02-21 09:26:16 PST
Created attachment 189546 [details]
Patch for landing v2

Fix the build error.
Comment 6 WebKit Review Bot 2013-02-21 09:43:53 PST
Comment on attachment 189546 [details]
Patch for landing v2

Clearing flags on attachment: 189546

Committed r143617: <http://trac.webkit.org/changeset/143617>
Comment 7 WebKit Review Bot 2013-02-21 09:43:56 PST
All reviewed patches have been landed.  Closing bug.