Implement RenderGrid::computeIntrinsicLogicalWidths
authorojan@chromium.org <ojan@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Feb 2013 21:18:20 +0000 (21:18 +0000)
committerojan@chromium.org <ojan@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Feb 2013 21:18:20 +0000 (21:18 +0000)
https://bugs.webkit.org/show_bug.cgi?id=109881

Reviewed by Tony Chang.

For now this is not observable due to the FIXMEs for unimplemented bits
of computePreferredLogicalWidths. But, soon, I'll be removing the computePreferredLogicalWidths
override entirely and instead use RenderBlock's, which will also address the
RenderGrid FIXMEs.

* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::computeIntrinsicLogicalWidths):
const_cast the usages of m_grid. Alternately, we could stack allocate it, but there's disagreement on
whether that's the right choice. See https://bugs.webkit.org/show_bug.cgi?id=109880.

(WebCore::RenderGrid::computePreferredLogicalWidths):
* rendering/RenderGrid.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@143043 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderGrid.cpp
Source/WebCore/rendering/RenderGrid.h

index ded7140247b3da1fa534bf4e602afa4498fc14c9..b16449b736743b6043e71bd0c2ae867665209fbc 100644 (file)
@@ -1,3 +1,24 @@
+2013-02-14  Ojan Vafai  <ojan@chromium.org>
+
+        Implement RenderGrid::computeIntrinsicLogicalWidths
+        https://bugs.webkit.org/show_bug.cgi?id=109881
+
+        Reviewed by Tony Chang.
+
+        For now this is not observable due to the FIXMEs for unimplemented bits
+        of computePreferredLogicalWidths. But, soon, I'll be removing the computePreferredLogicalWidths
+        override entirely and instead use RenderBlock's, which will also address the
+        RenderGrid FIXMEs.
+
+        * rendering/RenderGrid.cpp:
+        (WebCore::RenderGrid::computeIntrinsicLogicalWidths):
+        const_cast the usages of m_grid. Alternately, we could stack allocate it, but there's disagreement on
+        whether that's the right choice. See https://bugs.webkit.org/show_bug.cgi?id=109880.
+
+        (WebCore::RenderGrid::computePreferredLogicalWidths):
+        * rendering/RenderGrid.h:
+
+
 2013-02-15  Xueqing Huang  <huangxueqing@baidu.com>
 
         Flexbox should ignore firstLine pseudo element.
 2013-02-15  Xueqing Huang  <huangxueqing@baidu.com>
 
         Flexbox should ignore firstLine pseudo element.
index 13efad999f24e472f125360cf6c9cc28722c19e3..af8e8cb0b3f8a1a29dd673996a373bb674f566b5 100644 (file)
@@ -168,30 +168,34 @@ void RenderGrid::layoutBlock(bool relayoutChildren, LayoutUnit)
     setNeedsLayout(false);
 }
 
     setNeedsLayout(false);
 }
 
-void RenderGrid::computePreferredLogicalWidths()
+void RenderGrid::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const
 {
 {
-    ASSERT(preferredLogicalWidthsDirty());
-
-    placeItemsOnGrid();
-
-    m_minPreferredLogicalWidth = 0;
-    m_maxPreferredLogicalWidth = 0;
-
-    // FIXME: We don't take our own logical width into account.
+    const_cast<RenderGrid*>(this)->placeItemsOnGrid();
 
     const Vector<GridTrackSize>& trackStyles = style()->gridColumns();
 
     const Vector<GridTrackSize>& trackStyles = style()->gridColumns();
-
     for (size_t i = 0; i < trackStyles.size(); ++i) {
         LayoutUnit minTrackBreadth = computePreferredTrackWidth(trackStyles[i].minTrackBreadth(), i);
         LayoutUnit maxTrackBreadth = computePreferredTrackWidth(trackStyles[i].maxTrackBreadth(), i);
         maxTrackBreadth = std::max(maxTrackBreadth, minTrackBreadth);
 
     for (size_t i = 0; i < trackStyles.size(); ++i) {
         LayoutUnit minTrackBreadth = computePreferredTrackWidth(trackStyles[i].minTrackBreadth(), i);
         LayoutUnit maxTrackBreadth = computePreferredTrackWidth(trackStyles[i].maxTrackBreadth(), i);
         maxTrackBreadth = std::max(maxTrackBreadth, minTrackBreadth);
 
-        m_minPreferredLogicalWidth += minTrackBreadth;
-        m_maxPreferredLogicalWidth += maxTrackBreadth;
+        minLogicalWidth += minTrackBreadth;
+        maxLogicalWidth += maxTrackBreadth;
 
         // FIXME: This should add in the scrollbarWidth (e.g. see RenderFlexibleBox).
     }
 
 
         // FIXME: This should add in the scrollbarWidth (e.g. see RenderFlexibleBox).
     }
 
+    const_cast<RenderGrid*>(this)->m_grid.clear();
+}
+
+void RenderGrid::computePreferredLogicalWidths()
+{
+    ASSERT(preferredLogicalWidthsDirty());
+
+    m_minPreferredLogicalWidth = 0;
+    m_maxPreferredLogicalWidth = 0;
+
+    // FIXME: We don't take our own logical width into account.
+    computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferredLogicalWidth);
     // FIXME: We should account for min / max logical width.
 
     LayoutUnit borderAndPaddingInInlineDirection = borderAndPaddingLogicalWidth();
     // FIXME: We should account for min / max logical width.
 
     LayoutUnit borderAndPaddingInInlineDirection = borderAndPaddingLogicalWidth();
@@ -199,7 +203,6 @@ void RenderGrid::computePreferredLogicalWidths()
     m_maxPreferredLogicalWidth += borderAndPaddingInInlineDirection;
 
     setPreferredLogicalWidthsDirty(false);
     m_maxPreferredLogicalWidth += borderAndPaddingInInlineDirection;
 
     setPreferredLogicalWidthsDirty(false);
-    m_grid.clear();
 }
 
 LayoutUnit RenderGrid::computePreferredTrackWidth(const Length& length, size_t trackIndex) const
 }
 
 LayoutUnit RenderGrid::computePreferredTrackWidth(const Length& length, size_t trackIndex) const
index d3c6bb190acefdb8350d52052891cbc7cb726a87..726fb1441a9fa419e78dfd90d2b229aaaef44982 100644 (file)
@@ -46,6 +46,7 @@ public:
 
 private:
     virtual bool isRenderGrid() const OVERRIDE { return true; }
 
 private:
     virtual bool isRenderGrid() const OVERRIDE { return true; }
+    virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const OVERRIDE;
     virtual void computePreferredLogicalWidths() OVERRIDE;
 
     LayoutUnit computePreferredTrackWidth(const Length&, size_t) const;
     virtual void computePreferredLogicalWidths() OVERRIDE;
 
     LayoutUnit computePreferredTrackWidth(const Length&, size_t) const;