Fix some baseline flexbox alignment
authortony@chromium.org <tony@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 22 Oct 2012 17:45:33 +0000 (17:45 +0000)
committertony@chromium.org <tony@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 22 Oct 2012 17:45:33 +0000 (17:45 +0000)
commitfbce07b19ddfd1f216b3c4155fdc1440f14bccce
tree551ba2711e9cb5cda656389cdc3d1407909e3941
parent6ff9b445a8fe6dd24133d9bf0741c4f09d2d4ac8
Fix some baseline flexbox alignment
https://bugs.webkit.org/show_bug.cgi?id=99879

Reviewed by Ojan Vafai.

Source/WebCore:

Fix a bug where we weren't handling margin properly on inline-flexbox.
Fix a bug where we weren't getting the edge of the content box properly when synthesizing
a baseline.

Test: css3/flexbox/flexbox-baseline-margins.html

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::baselinePosition):
(WebCore::RenderBlock::inlineBlockBaseline): Add a new method that is used when calculating an inline-block's
baseline. Previously we would use lastLineBoxBaseline.
(WebCore::RenderBlock::lastLineBoxBaseline): Pass in direction and when searching children, use inlineBlockBaseline.
* rendering/RenderBlock.h:
(RenderBlock): Make lastLineBoxBaseline non-virtual.
* rendering/RenderBox.h:
(WebCore::RenderBox::inlineBlockBaseline): Replace lastLineBoxBaseline with inlineBlockBaseline.
* rendering/RenderFlexibleBox.cpp:
(WebCore::synthesizedBaselineFromContentBox): Helper method for getting the baseline from the content box.
(WebCore::RenderFlexibleBox::baselinePosition): Always include the margin. This fixes the inline-flexbox case.
(WebCore::RenderFlexibleBox::firstLineBoxBaseline): Fix a case where we didn't synthesize a baseline.  Returning -1 means there is no baseline, but we can
synthesize a baseline if we have a flexitem without text.
(WebCore::RenderFlexibleBox::inlineBlockBaseline):
* rendering/RenderFlexibleBox.h:
* rendering/RenderTable.cpp: Replace lastLineBoxBaseline with inlineBlockBaseline.
(WebCore::RenderTable::inlineBlockBaseline): Try to make comment more direct.
* rendering/RenderTable.h:
(RenderTable): Replace lastLineBoxBaseline with inlineBlockBaseline.

LayoutTests:

Additional test cases for baseline aligning flexbox.

* css3/flexbox/flexbox-baseline-margins.html: Added.
* css3/flexbox/resources/flexbox.css:
(.flex-one): New cross browser value.
* platform/chromium-linux/css3/flexbox/flexbox-baseline-margins-expected.png: Added.
* platform/chromium-linux/css3/flexbox/flexbox-baseline-margins-expected.txt: Added.
* platform/chromium/TestExpectations:
* platform/efl/TestExpectations:
* platform/gtk/TestExpectations:
* platform/mac/TestExpectations:
* platform/qt/TestExpectations:
* platform/win/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@132104 268f45cc-cd09-0410-ab3c-d52691b4dbfc
19 files changed:
LayoutTests/ChangeLog
LayoutTests/css3/flexbox/flexbox-baseline-margins.html [new file with mode: 0644]
LayoutTests/css3/flexbox/resources/flexbox.css
LayoutTests/platform/chromium-linux/css3/flexbox/flexbox-baseline-margins-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-linux/css3/flexbox/flexbox-baseline-margins-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium/TestExpectations
LayoutTests/platform/efl/TestExpectations
LayoutTests/platform/gtk/TestExpectations
LayoutTests/platform/mac/TestExpectations
LayoutTests/platform/qt/TestExpectations
LayoutTests/platform/win/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderBlock.h
Source/WebCore/rendering/RenderBox.h
Source/WebCore/rendering/RenderFlexibleBox.cpp
Source/WebCore/rendering/RenderFlexibleBox.h
Source/WebCore/rendering/RenderTable.cpp
Source/WebCore/rendering/RenderTable.h