WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-66898-20110824150031.patch (text/plain), 7.29 KB, created by
Tony Chang
on 2011-08-24 15:01:30 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Tony Chang
Created:
2011-08-24 15:01:30 PDT
Size:
7.29 KB
patch
obsolete
>Subversion Revision: 93708 >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index a8654439cb9da77151d34c29a1afd6106d50124c..7d8f01b03c9c29512372c3087e9d12b98a9614e1 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,13 @@ >+2011-08-24 Tony Chang <tony@chromium.org> >+ >+ Implement -webkit-flex-pack for horizontal flexboxen >+ https://bugs.webkit.org/show_bug.cgi?id=66898 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * css3/flexbox/004-expected.txt: Added. >+ * css3/flexbox/004.html: Added. >+ > 2011-08-24 Alexandru Chiculita <achicu@adobe.com> > > https://bugs.webkit.org/show_bug.cgi?id=66799 >diff --git a/LayoutTests/css3/flexbox/004-expected.txt b/LayoutTests/css3/flexbox/004-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..824a023b00ae1339e4eceec89b947043bcc477c5 >--- /dev/null >+++ b/LayoutTests/css3/flexbox/004-expected.txt >@@ -0,0 +1,8 @@ >+PASS >+PASS >+PASS >+PASS >+PASS >+PASS >+PASS >+ >diff --git a/LayoutTests/css3/flexbox/004.html b/LayoutTests/css3/flexbox/004.html >new file mode 100644 >index 0000000000000000000000000000000000000000..dda1b666f44cb2f5a7f996b8834a08888d7a8551 >--- /dev/null >+++ b/LayoutTests/css3/flexbox/004.html >@@ -0,0 +1,78 @@ >+<!DOCTYPE html> >+<html> >+<style> >+body { >+ margin: 0; >+} >+.horizontal-box { >+ width: 600px; >+ display: -webkit-flexbox; >+ background-color: #aaa; >+ position: relative; >+} >+.horizontal-box div { >+ height: 20px; >+ border: 0; >+} >+ >+.horizontal-box :nth-child(1) { >+ background-color: blue; >+} >+.horizontal-box :nth-child(2) { >+ background-color: green; >+} >+.horizontal-box :nth-child(3) { >+ background-color: red; >+} >+</style> >+<script> >+if (window.layoutTestController) >+ layoutTestController.dumpAsText(); >+</script> >+<script src="resources/flexbox.js"></script> >+<body onload="checkHorizontalBoxen()"> >+<div class="horizontal-box"> >+ <div data-expected-width="100" data-offset-x="0" style="width: -webkit-flex(1 0 0); max-width: 100px;"></div> >+ <div data-expected-width="100" data-offset-x="100" style="width: 100px;"></div> >+ <div data-expected-width="100" data-offset-x="200" style="width: 100px;"></div> >+</div> >+ >+<div class="horizontal-box" style="-webkit-flex-pack: end"> >+ <div data-expected-width="100" data-offset-x="300" style="width: -webkit-flex(0 0 100px);"></div> >+ <div data-expected-width="100" data-offset-x="400" style="width: 100px;"></div> >+ <div data-expected-width="100" data-offset-x="500" style="width: 100px;"></div> >+</div> >+ >+<div class="horizontal-box" style="-webkit-flex-pack: center"> >+ <div data-expected-width="100" data-offset-x="150" style="width: -webkit-flex(1 0 0); max-width: 100px;"></div> >+ <div data-expected-width="100" data-offset-x="250" style="width: 100px;"></div> >+ <div data-expected-width="100" data-offset-x="350" style="width: 100px;"></div> >+</div> >+ >+<div class="horizontal-box" style="-webkit-flex-pack: justify"> >+ <div data-expected-width="100" data-offset-x="0" style="width: -webkit-flex(1 0 0); max-width: 100px;"></div> >+ <div data-expected-width="100" data-offset-x="250" style="width: 100px;"></div> >+ <div data-expected-width="100" data-offset-x="500" style="width: 100px;"></div> >+</div> >+ >+<!-- If there's only one child, we pack start. --> >+<div class="horizontal-box" style="-webkit-flex-pack: justify"> >+ <div data-expected-width="100" data-offset-x="0" style="width: -webkit-flex(1 0 0); max-width: 100px;"></div> >+</div> >+ >+<!-- The flex-pack does nothing here because the margin:auto eats all the available space. --> >+<div class="horizontal-box" style="-webkit-flex-pack: end"> >+ <div data-expected-width="100" data-offset-x="0" style="width: 100px;"></div> >+ <div data-expected-width="100" data-offset-x="100" style="width: 100px; margin-right: auto"></div> >+ <div data-expected-width="100" data-offset-x="500" style="width: 100px;"></div> >+</div> >+ >+<!-- The flex-pack does nothing here because we are shrinking. --> >+<div class="horizontal-box" style="-webkit-flex-pack: end"> >+ <div data-expected-width="200" data-offset-x="0" style="width: -webkit-flex(0 1 300px);"></div> >+ <div data-expected-width="200" data-offset-x="200" style="width: 200px;"></div> >+ <div data-expected-width="200" data-offset-x="400" style="width: 200px;"></div> >+</div> >+ >+</body> >+</html> >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 34f93e84c6e308738ee714596239fb5d1fa84304..d229ed88e30ef66f3d7c25a966b30b9bec94c3a6 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,17 @@ >+2011-08-24 Tony Chang <tony@chromium.org> >+ >+ Implement -webkit-flex-pack for horizontal flexboxen >+ https://bugs.webkit.org/show_bug.cgi?id=66898 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Test: css3/flexbox/004.html >+ >+ * rendering/RenderFlexibleBox.cpp: >+ (WebCore::RenderFlexibleBox::layoutHorizontalBlock): >+ (WebCore::hasPackingSpace): >+ (WebCore::RenderFlexibleBox::runFreeSpaceAllocationAlgorithmHorizontal): >+ > 2011-08-24 Alexandru Chiculita <achicu@adobe.com> > > https://bugs.webkit.org/show_bug.cgi?id=66799 >diff --git a/Source/WebCore/rendering/RenderFlexibleBox.cpp b/Source/WebCore/rendering/RenderFlexibleBox.cpp >index 284e8adb9f30ffc48b770fbff944391482686f71..f8f7ea6d0398b9fd3b866dd9b8fca521f5f039c8 100644 >--- a/Source/WebCore/rendering/RenderFlexibleBox.cpp >+++ b/Source/WebCore/rendering/RenderFlexibleBox.cpp >@@ -138,7 +138,6 @@ void RenderFlexibleBox::layoutHorizontalBlock(bool relayoutChildren) > ASSERT(inflexibleItems.size() > 0); > } > >- // FIXME: Distribute leftover space to the packing space (second distribution round). > // FIXME: Handle distribution of vertical space (third distribution round). > } > >@@ -181,6 +180,11 @@ void RenderFlexibleBox::computePreferredSizeHorizontal(bool relayoutChildren, Fl > } > } > >+static bool hasPackingSpace(LayoutUnit availableFreeSpace, float totalPositiveFlexibility) >+{ >+ return availableFreeSpace > 0 && !totalPositiveFlexibility; >+} >+ > // Returns true if we successfully ran the algorithm and sized the flex items. > bool RenderFlexibleBox::runFreeSpaceAllocationAlgorithmHorizontal(LayoutUnit& availableFreeSpace, float& totalPositiveFlexibility, float& totalNegativeFlexibility, InflexibleFlexItemSize& inflexibleItems) > { >@@ -226,6 +230,14 @@ bool RenderFlexibleBox::runFreeSpaceAllocationAlgorithmHorizontal(LayoutUnit& av > > // Now that we know the sizes, layout and position the flex items. > LayoutUnit xOffset = borderLeft() + paddingLeft(); >+ >+ if (hasPackingSpace(availableFreeSpace, totalPositiveFlexibility)) { >+ if (style()->flexPack() == PackEnd) >+ xOffset += availableFreeSpace; >+ else if (style()->flexPack() == PackCenter) >+ xOffset += availableFreeSpace / 2; >+ } >+ > LayoutUnit yOffset = borderTop() + paddingTop(); > setHeight(0); > size_t i = 0; >@@ -247,6 +259,9 @@ bool RenderFlexibleBox::runFreeSpaceAllocationAlgorithmHorizontal(LayoutUnit& av > xOffset += child->marginLeft(); > child->setLocation(IntPoint(xOffset, yOffset)); > xOffset += child->width() + child->marginRight(); >+ >+ if (hasPackingSpace(availableFreeSpace, totalPositiveFlexibility) && style()->flexPack() == PackJustify && childSizes.size() > 1) >+ xOffset += availableFreeSpace / (childSizes.size() - 1); > } > return true; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
ojan
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 66898
: 105078