Title: [124671] trunk
- Revision
- 124671
- Author
- [email protected]
- Date
- 2012-08-03 16:36:05 -0700 (Fri, 03 Aug 2012)
Log Message
Implement computePreferredLogicalWidths on RenderGrid
https://bugs.webkit.org/show_bug.cgi?id=92908
Reviewed by Ojan Vafai.
Source/WebCore:
This functions implements a primitive computePreferredLogicalWidths
so that we properly handle vertical writing modes.
Covered by fast/css-grid-layout/place-cell-by-index.html.
* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::computePreferredLogicalWidths):
* rendering/RenderGrid.h:
Added computePreferredLogicalWidths.
LayoutTests:
* fast/css-grid-layout/place-cell-by-index-expected.txt:
Updated the expected file (everything passes now).
* fast/css-grid-layout/place-cell-by-index.html:
Removed some FIXMEs and added one about the expected offsets making
a wrong assumption. It's fine to keep this testing until we support
this part of the spec.
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (124670 => 124671)
--- trunk/LayoutTests/ChangeLog 2012-08-03 23:20:14 UTC (rev 124670)
+++ trunk/LayoutTests/ChangeLog 2012-08-03 23:36:05 UTC (rev 124671)
@@ -1,3 +1,17 @@
+2012-08-03 Julien Chaffraix <[email protected]>
+
+ Implement computePreferredLogicalWidths on RenderGrid
+ https://bugs.webkit.org/show_bug.cgi?id=92908
+
+ Reviewed by Ojan Vafai.
+
+ * fast/css-grid-layout/place-cell-by-index-expected.txt:
+ Updated the expected file (everything passes now).
+ * fast/css-grid-layout/place-cell-by-index.html:
+ Removed some FIXMEs and added one about the expected offsets making
+ a wrong assumption. It's fine to keep this testing until we support
+ this part of the spec.
+
2012-08-03 Arnaud Renevier <[email protected]>
Update TypedArrays to throw RangeError or similar instead of INDEX_SIZE_ERR
Modified: trunk/LayoutTests/fast/css-grid-layout/place-cell-by-index-expected.txt (124670 => 124671)
--- trunk/LayoutTests/fast/css-grid-layout/place-cell-by-index-expected.txt 2012-08-03 23:20:14 UTC (rev 124670)
+++ trunk/LayoutTests/fast/css-grid-layout/place-cell-by-index-expected.txt 2012-08-03 23:36:05 UTC (rev 124671)
@@ -2,21 +2,5 @@
PASS
PASS
-FAIL:
-Expected 110 for height, but got 15.
-
-<div class="grid" style="-webkit-writing-mode: vertical-rl; margin-bottom: 60px;" data-expected-width="50" data-expected-height="110">
- <div id="a" data-offset-x="40" data-offset-y="0"></div>
- <div id="b" data-offset-x="40" data-offset-y="50"></div>
- <div id="c" data-offset-x="20" data-offset-y="0"></div>
- <div id="d" data-offset-x="20" data-offset-y="50"></div>
-</div>
-FAIL:
-Expected 110 for height, but got 15.
-
-<div class="grid" style="-webkit-writing-mode: vertical-lr; margin-bottom: 60px;" data-expected-width="50" data-expected-height="110">
- <div id="a" data-offset-x="0" data-offset-y="0"></div>
- <div id="b" data-offset-x="0" data-offset-y="50"></div>
- <div id="c" data-offset-x="20" data-offset-y="0"></div>
- <div id="d" data-offset-x="20" data-offset-y="50"></div>
-</div>
+PASS
+PASS
Modified: trunk/LayoutTests/fast/css-grid-layout/place-cell-by-index.html (124670 => 124671)
--- trunk/LayoutTests/fast/css-grid-layout/place-cell-by-index.html 2012-08-03 23:20:14 UTC (rev 124670)
+++ trunk/LayoutTests/fast/css-grid-layout/place-cell-by-index.html 2012-08-03 23:36:05 UTC (rev 124671)
@@ -49,6 +49,8 @@
<p>Test some simple grid layouts by positioning grid items by index.</p>
+<!-- FIXME: The offsets assumes that grid-{column|row}-align are set to 'start', not 'stretch' (the default). Fix
+ them once we properly implement stretching / alignment. -->
<div style="position: relative">
<div class="grid" data-expected-width="110" data-expected-height="50">
<div id="a" data-offset-x="0" data-offset-y="0"></div>
@@ -68,7 +70,6 @@
</div>
<div style="position: relative">
-<!-- FIXME: The height of the grid is wrong because we need to implement computePreferredLogicalWidths(). -->
<div class="grid" style="-webkit-writing-mode: vertical-rl; margin-bottom: 60px;" data-expected-width="50" data-expected-height="110">
<div id="a" data-offset-x="40" data-offset-y="0"></div>
<div id="b" data-offset-x="40" data-offset-y="50"></div>
@@ -78,7 +79,6 @@
</div>
<div style="position: relative">
-<!-- FIXME: The height of the grid is wrong because we need to implement computePreferredLogicalWidths(). -->
<div class="grid" style="-webkit-writing-mode: vertical-lr; margin-bottom: 60px;" data-expected-width="50" data-expected-height="110">
<div id="a" data-offset-x="0" data-offset-y="0"></div>
<div id="b" data-offset-x="0" data-offset-y="50"></div>
Modified: trunk/Source/WebCore/ChangeLog (124670 => 124671)
--- trunk/Source/WebCore/ChangeLog 2012-08-03 23:20:14 UTC (rev 124670)
+++ trunk/Source/WebCore/ChangeLog 2012-08-03 23:36:05 UTC (rev 124671)
@@ -1,3 +1,20 @@
+2012-08-03 Julien Chaffraix <[email protected]>
+
+ Implement computePreferredLogicalWidths on RenderGrid
+ https://bugs.webkit.org/show_bug.cgi?id=92908
+
+ Reviewed by Ojan Vafai.
+
+ This functions implements a primitive computePreferredLogicalWidths
+ so that we properly handle vertical writing modes.
+
+ Covered by fast/css-grid-layout/place-cell-by-index.html.
+
+ * rendering/RenderGrid.cpp:
+ (WebCore::RenderGrid::computePreferredLogicalWidths):
+ * rendering/RenderGrid.h:
+ Added computePreferredLogicalWidths.
+
2012-08-03 Arnaud Renevier <[email protected]>
Update TypedArrays to throw RangeError or similar instead of INDEX_SIZE_ERR
Modified: trunk/Source/WebCore/rendering/RenderGrid.cpp (124670 => 124671)
--- trunk/Source/WebCore/rendering/RenderGrid.cpp 2012-08-03 23:20:14 UTC (rev 124670)
+++ trunk/Source/WebCore/rendering/RenderGrid.cpp 2012-08-03 23:36:05 UTC (rev 124671)
@@ -107,6 +107,35 @@
setNeedsLayout(false);
}
+void RenderGrid::computePreferredLogicalWidths()
+{
+ ASSERT(preferredLogicalWidthsDirty());
+
+ m_minPreferredLogicalWidth = 0;
+ m_maxPreferredLogicalWidth = 0;
+
+ // FIXME: We don't take our own logical width into account.
+
+ const Vector<Length>& trackStyles = style()->gridColumns();
+
+ for (size_t i = 0; i < trackStyles.size(); ++i) {
+ Length trackLength = trackStyles[i];
+ if (!trackLength.isFixed()) {
+ notImplemented();
+ continue;
+ }
+
+ m_minPreferredLogicalWidth += trackLength.intValue();
+ m_maxPreferredLogicalWidth += trackLength.intValue();
+ }
+
+ // FIXME: We should account for min / max logical width.
+
+ // FIXME: Include borders and paddings in inline direction.
+
+ setPreferredLogicalWidthsDirty(false);
+}
+
void RenderGrid::computedUsedBreadthOfGridTracks(TrackSizingDirection direction, Vector<GridTrack>& tracks)
{
const Vector<Length>& trackStyles = (direction == ForColumns) ? style()->gridColumns() : style()->gridRows();
Modified: trunk/Source/WebCore/rendering/RenderGrid.h (124670 => 124671)
--- trunk/Source/WebCore/rendering/RenderGrid.h 2012-08-03 23:20:14 UTC (rev 124670)
+++ trunk/Source/WebCore/rendering/RenderGrid.h 2012-08-03 23:36:05 UTC (rev 124671)
@@ -38,6 +38,7 @@
virtual const char* renderName() const OVERRIDE;
virtual void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) OVERRIDE;
+ virtual void computePreferredLogicalWidths() OVERRIDE;
virtual bool avoidsFloats() const OVERRIDE { return true; }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes