[CSS Grid Layout] Wrap some specific grid code under compilation flag
authorrego@igalia.com <rego@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Apr 2014 08:23:00 +0000 (08:23 +0000)
committerrego@igalia.com <rego@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Apr 2014 08:23:00 +0000 (08:23 +0000)
https://bugs.webkit.org/show_bug.cgi?id=132341

Reviewed by Benjamin Poulain.

Some static variables in RenderBox are only used for CSS Grid Layout code. Wrap them and the related methods
under ENABLE_CSS_GRID_LAYOUT compilation flag.

* rendering/RenderBox.cpp:
(WebCore::RenderBox::willBeDestroyed):
(WebCore::RenderBox::containingBlockLogicalWidthForContent):
(WebCore::RenderBox::containingBlockLogicalHeightForContent):
(WebCore::RenderBox::perpendicularContainingBlockLogicalHeight):
(WebCore::RenderBox::computePercentageLogicalHeight):
* rendering/RenderBox.h:

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

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

index af05e7a..26a21e3 100644 (file)
@@ -1,3 +1,21 @@
+2014-04-30  Manuel Rego Casasnovas  <rego@igalia.com>
+
+        [CSS Grid Layout] Wrap some specific grid code under compilation flag
+        https://bugs.webkit.org/show_bug.cgi?id=132341
+
+        Reviewed by Benjamin Poulain.
+
+        Some static variables in RenderBox are only used for CSS Grid Layout code. Wrap them and the related methods
+        under ENABLE_CSS_GRID_LAYOUT compilation flag.
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::willBeDestroyed):
+        (WebCore::RenderBox::containingBlockLogicalWidthForContent):
+        (WebCore::RenderBox::containingBlockLogicalHeightForContent):
+        (WebCore::RenderBox::perpendicularContainingBlockLogicalHeight):
+        (WebCore::RenderBox::computePercentageLogicalHeight):
+        * rendering/RenderBox.h:
+
 2014-04-29  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r167962 and r167975.
index c7606c6..5dea106 100644 (file)
@@ -74,10 +74,11 @@ typedef WTF::HashMap<const RenderBox*, LayoutUnit> OverrideSizeMap;
 static OverrideSizeMap* gOverrideHeightMap = 0;
 static OverrideSizeMap* gOverrideWidthMap = 0;
 
+#if ENABLE(CSS_GRID_LAYOUT)
 // Used by grid elements to properly size their grid items.
-static OverrideSizeMap* gOverrideContainingBlockLogicalHeightMap = 0;
-static OverrideSizeMap* gOverrideContainingBlockLogicalWidthMap = 0;
-
+static OverrideSizeMap* gOverrideContainingBlockLogicalHeightMap = nullptr;
+static OverrideSizeMap* gOverrideContainingBlockLogicalWidthMap = nullptr;
+#endif
 
 // Size of border belt for autoscroll. When mouse pointer in border belt,
 // autoscroll is started.
@@ -216,7 +217,9 @@ void RenderBox::willBeDestroyed()
         frame().eventHandler().stopAutoscrollTimer(true);
 
     clearOverrideSize();
+#if ENABLE(CSS_GRID_LAYOUT)
     clearContainingBlockOverrideSize();
+#endif
 
     RenderBlock::removePercentHeightDescendantIfNeeded(*this);
 
@@ -1030,6 +1033,7 @@ LayoutUnit RenderBox::overrideLogicalContentHeight() const
     return gOverrideHeightMap->get(this);
 }
 
+#if ENABLE(CSS_GRID_LAYOUT)
 LayoutUnit RenderBox::overrideContainingBlockContentLogicalWidth() const
 {
     ASSERT(hasOverrideContainingBlockLogicalWidth());
@@ -1078,6 +1082,7 @@ void RenderBox::clearOverrideContainingBlockContentLogicalHeight()
     if (gOverrideContainingBlockLogicalHeightMap)
         gOverrideContainingBlockLogicalHeightMap->remove(this);
 }
+#endif // ENABLE(CSS_GRID_LAYOUT)
 
 LayoutUnit RenderBox::adjustBorderBoxLogicalWidthForBoxSizing(LayoutUnit width) const
 {
@@ -1772,8 +1777,10 @@ LayoutUnit RenderBox::shrinkLogicalWidthToAvoidFloats(LayoutUnit childMarginStar
 
 LayoutUnit RenderBox::containingBlockLogicalWidthForContent() const
 {
+#if ENABLE(CSS_GRID_LAYOUT)
     if (hasOverrideContainingBlockLogicalWidth())
         return overrideContainingBlockContentLogicalWidth();
+#endif
 
     RenderBlock* cb = containingBlock();
     return cb->availableLogicalWidth();
@@ -1781,8 +1788,10 @@ LayoutUnit RenderBox::containingBlockLogicalWidthForContent() const
 
 LayoutUnit RenderBox::containingBlockLogicalHeightForContent(AvailableLogicalHeightType heightType) const
 {
+#if ENABLE(CSS_GRID_LAYOUT)
     if (hasOverrideContainingBlockLogicalHeight())
         return overrideContainingBlockContentLogicalHeight();
+#endif
 
     RenderBlock* cb = containingBlock();
     return cb->availableLogicalHeight(heightType);
@@ -1819,8 +1828,10 @@ LayoutUnit RenderBox::containingBlockAvailableLineWidthInRegion(RenderRegion* re
 
 LayoutUnit RenderBox::perpendicularContainingBlockLogicalHeight() const
 {
+#if ENABLE(CSS_GRID_LAYOUT)
     if (hasOverrideContainingBlockLogicalHeight())
         return overrideContainingBlockContentLogicalHeight();
+#endif
 
     RenderBlock* cb = containingBlock();
     if (cb->hasOverrideHeight())
@@ -2758,8 +2769,10 @@ LayoutUnit RenderBox::computePercentageLogicalHeight(const Length& height) const
 
     if (isHorizontal != cb->isHorizontalWritingMode())
         availableHeight = containingBlockChild->containingBlockLogicalWidthForContent();
+#if ENABLE(CSS_GRID_LAYOUT)
     else if (hasOverrideContainingBlockLogicalHeight())
         availableHeight = overrideContainingBlockContentLogicalHeight();
+#endif
     else if (cb->isTableCell()) {
         if (!skippedAutoHeightContainingBlock) {
             // Table cells violate what the CSS spec says to do with heights. Basically we
index 298d091..8813a41 100644 (file)
@@ -329,6 +329,7 @@ public:
     void clearOverrideLogicalContentHeight();
     void clearOverrideLogicalContentWidth();
 
+#if ENABLE(CSS_GRID_LAYOUT)
     LayoutUnit overrideContainingBlockContentLogicalWidth() const;
     LayoutUnit overrideContainingBlockContentLogicalHeight() const;
     bool hasOverrideContainingBlockLogicalWidth() const;
@@ -337,6 +338,7 @@ public:
     void setOverrideContainingBlockContentLogicalHeight(LayoutUnit);
     void clearContainingBlockOverrideSize();
     void clearOverrideContainingBlockContentLogicalHeight();
+#endif
 
     virtual LayoutSize offsetFromContainer(RenderObject*, const LayoutPoint&, bool* offsetDependsOnPoint = 0) const override;