Title: [98929] trunk/Source/WebCore
Revision
98929
Author
[email protected]
Date
2011-10-31 18:01:57 -0700 (Mon, 31 Oct 2011)

Log Message

Amend missing uses of LayoutUnits in RenderApplet, Button, and DeprecatedFlexibleBox
https://bugs.webkit.org/show_bug.cgi?id=71243

Reviewed by Eric Seidel.

Replacing remaining integer uses with LayoutUnits in the aforementioned classes.

No new tests -- no change in behavior.

* rendering/RenderApplet.cpp:
(WebCore::RenderApplet::intrinsicSize):
(WebCore::RenderApplet::createWidgetIfNecessary):
* rendering/RenderApplet.h:
* rendering/RenderButton.cpp:
(WebCore::RenderButton::controlClipRect):
* rendering/RenderButton.h:
* rendering/RenderDeprecatedFlexibleBox.cpp:
(WebCore::marginWidthForChild):
(WebCore::RenderDeprecatedFlexibleBox::computePreferredLogicalWidths):
(WebCore::RenderDeprecatedFlexibleBox::layoutBlock):
(WebCore::RenderDeprecatedFlexibleBox::layoutHorizontalBox):
(WebCore::RenderDeprecatedFlexibleBox::applyLineClamp):
* rendering/RenderDeprecatedFlexibleBox.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (98928 => 98929)


--- trunk/Source/WebCore/ChangeLog	2011-11-01 00:59:34 UTC (rev 98928)
+++ trunk/Source/WebCore/ChangeLog	2011-11-01 01:01:57 UTC (rev 98929)
@@ -1,3 +1,29 @@
+2011-10-31  Levi Weintraub  <[email protected]>
+
+        Amend missing uses of LayoutUnits in RenderApplet, Button, and DeprecatedFlexibleBox
+        https://bugs.webkit.org/show_bug.cgi?id=71243
+
+        Reviewed by Eric Seidel.
+
+        Replacing remaining integer uses with LayoutUnits in the aforementioned classes.
+
+        No new tests -- no change in behavior.
+
+        * rendering/RenderApplet.cpp:
+        (WebCore::RenderApplet::intrinsicSize):
+        (WebCore::RenderApplet::createWidgetIfNecessary):
+        * rendering/RenderApplet.h:
+        * rendering/RenderButton.cpp:
+        (WebCore::RenderButton::controlClipRect):
+        * rendering/RenderButton.h:
+        * rendering/RenderDeprecatedFlexibleBox.cpp:
+        (WebCore::marginWidthForChild):
+        (WebCore::RenderDeprecatedFlexibleBox::computePreferredLogicalWidths):
+        (WebCore::RenderDeprecatedFlexibleBox::layoutBlock):
+        (WebCore::RenderDeprecatedFlexibleBox::layoutHorizontalBox):
+        (WebCore::RenderDeprecatedFlexibleBox::applyLineClamp):
+        * rendering/RenderDeprecatedFlexibleBox.h:
+
 2011-10-31  Tommy Widenflycht  <[email protected]>
 
         [Chromium] Media Stream API: add the Chromium WebKit interfaces

Modified: trunk/Source/WebCore/rendering/RenderApplet.cpp (98928 => 98929)


--- trunk/Source/WebCore/rendering/RenderApplet.cpp	2011-11-01 00:59:34 UTC (rev 98928)
+++ trunk/Source/WebCore/rendering/RenderApplet.cpp	2011-11-01 01:01:57 UTC (rev 98929)
@@ -44,13 +44,13 @@
 {
 }
 
-IntSize RenderApplet::intrinsicSize() const
+LayoutSize RenderApplet::intrinsicSize() const
 {
     // FIXME: This doesn't make sense. We can't just start returning
     // a different size once we've created the widget and expect
     // layout and sizing to be correct. We should remove this and
     // pass the appropriate intrinsic size in the constructor.
-    return widget() ? IntSize(50, 50) : IntSize(150, 150);
+    return widget() ? LayoutSize(50, 50) : LayoutSize(150, 150);
 }
 
 void RenderApplet::createWidgetIfNecessary()
@@ -63,9 +63,9 @@
     // In order to work around this problem and have a correct size from the start, we will
     // use fixed widths/heights from the style system when we can, since the widget might
     // not have an accurate m_width/m_height.
-    int contentWidth = style()->width().isFixed() ? style()->width().value() : 
+    LayoutUnit contentWidth = style()->width().isFixed() ? LayoutUnit(style()->width().value()) : 
         width() - borderAndPaddingWidth();
-    int contentHeight = style()->height().isFixed() ? style()->height().value() :
+    LayoutUnit contentHeight = style()->height().isFixed() ? LayoutUnit(style()->height().value()) :
         height() - borderAndPaddingHeight();
     for (Node* child = element->firstChild(); child; child = child->nextSibling()) {
         if (child->hasTagName(paramTag)) {
@@ -77,7 +77,7 @@
 
     Frame* frame = this->frame();
     ASSERT(frame);
-    setWidget(frame->loader()->subframeLoader()->createJavaAppletWidget(IntSize(contentWidth, contentHeight), element, m_args));
+    setWidget(frame->loader()->subframeLoader()->createJavaAppletWidget(LayoutSize(contentWidth, contentHeight), element, m_args));
 }
 
 void RenderApplet::layout()

Modified: trunk/Source/WebCore/rendering/RenderApplet.h (98928 => 98929)


--- trunk/Source/WebCore/rendering/RenderApplet.h	2011-11-01 00:59:34 UTC (rev 98928)
+++ trunk/Source/WebCore/rendering/RenderApplet.h	2011-11-01 01:01:57 UTC (rev 98929)
@@ -46,7 +46,7 @@
     virtual bool isApplet() const { return true; }
 
     virtual void layout();
-    virtual IntSize intrinsicSize() const;
+    virtual LayoutSize intrinsicSize() const;
 
 #if USE(ACCELERATED_COMPOSITING)
     virtual bool requiresLayer() const;

Modified: trunk/Source/WebCore/rendering/RenderButton.cpp (98928 => 98929)


--- trunk/Source/WebCore/rendering/RenderButton.cpp	2011-11-01 00:59:34 UTC (rev 98928)
+++ trunk/Source/WebCore/rendering/RenderButton.cpp	2011-11-01 01:01:57 UTC (rev 98929)
@@ -157,10 +157,10 @@
         children()->updateBeforeAfterContent(this, type);
 }
 
-IntRect RenderButton::controlClipRect(const IntPoint& additionalOffset) const
+LayoutRect RenderButton::controlClipRect(const LayoutPoint& additionalOffset) const
 {
     // Clip to the padding box to at least give content the extra padding space.
-    return IntRect(additionalOffset.x() + borderLeft(), additionalOffset.y() + borderTop(), width() - borderLeft() - borderRight(), height() - borderTop() - borderBottom());
+    return LayoutRect(additionalOffset.x() + borderLeft(), additionalOffset.y() + borderTop(), width() - borderLeft() - borderRight(), height() - borderTop() - borderBottom());
 }
 
 void RenderButton::timerFired(Timer<RenderButton>*)

Modified: trunk/Source/WebCore/rendering/RenderButton.h (98928 => 98929)


--- trunk/Source/WebCore/rendering/RenderButton.h	2011-11-01 00:59:34 UTC (rev 98928)
+++ trunk/Source/WebCore/rendering/RenderButton.h	2011-11-01 01:01:57 UTC (rev 98929)
@@ -51,7 +51,7 @@
     virtual void updateBeforeAfterContent(PseudoId);
 
     virtual bool hasControlClip() const { return true; }
-    virtual LayoutRect controlClipRect(const IntPoint&) const;
+    virtual LayoutRect controlClipRect(const LayoutPoint&) const;
 
     void setText(const String&);
     String text() const;

Modified: trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp (98928 => 98929)


--- trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp	2011-11-01 00:59:34 UTC (rev 98928)
+++ trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp	2011-11-01 01:01:57 UTC (rev 98929)
@@ -129,14 +129,14 @@
 {
 }
 
-static int marginWidthForChild(RenderBox* child)
+static LayoutUnit marginWidthForChild(RenderBox* child)
 {
     // A margin basically has three types: fixed, percentage, and auto (variable).
     // Auto and percentage margins simply become 0 when computing min/max width.
     // Fixed margins can be added in as is.
     Length marginLeft = child->style()->marginLeft();
     Length marginRight = child->style()->marginRight();
-    int margin = 0;
+    LayoutUnit margin = 0;
     if (marginLeft.isFixed())
         margin += marginLeft.value();
     if (marginRight.isFixed())
@@ -196,7 +196,7 @@
 
     if (hasOverflowClip() && style()->overflowY() == OSCROLL) {
         layer()->setHasVerticalScrollbar(true);
-        int scrollbarWidth = verticalScrollbarWidth();
+        LayoutUnit scrollbarWidth = verticalScrollbarWidth();
         m_maxPreferredLogicalWidth += scrollbarWidth;
         m_minPreferredLogicalWidth += scrollbarWidth;
     }
@@ -218,7 +218,7 @@
     setPreferredLogicalWidthsDirty(false);
 }
 
-void RenderDeprecatedFlexibleBox::layoutBlock(bool relayoutChildren, int pageLogicalHeight, BlockLayoutPass layoutPass)
+void RenderDeprecatedFlexibleBox::layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight, BlockLayoutPass layoutPass)
 {
     ASSERT(needsLayout());
 
@@ -226,7 +226,7 @@
         return;
 
     LayoutRepainter repainter(*this, checkForRepaintDuringLayout());
-    LayoutStateMaintainer statePusher(view(), this, IntSize(x(), y()), hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMode());
+    LayoutStateMaintainer statePusher(view(), this, LayoutSize(x(), y()), hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMode());
 
     LayoutSize previousSize = size();
 
@@ -275,8 +275,8 @@
         // bottom margin max values to 0.  This way we don't factor in the values
         // twice when we collapse with our previous vertically adjacent and
         // following vertically adjacent blocks.
-        int pos = maxPositiveMarginBefore();
-        int neg = maxNegativeMarginBefore();
+        LayoutUnit pos = maxPositiveMarginBefore();
+        LayoutUnit neg = maxNegativeMarginBefore();
         if (maxPositiveMarginAfter() > pos)
             pos = maxPositiveMarginAfter();
         if (maxNegativeMarginAfter() > neg)
@@ -455,7 +455,7 @@
                     childY += child->marginTop() + max<LayoutUnit>(0, (contentHeight() - (child->height() + child->marginTop() + child->marginBottom())) / 2);
                     break;
                 case BBASELINE: {
-                    int ascent = child->firstLineBoxBaseline();
+                    LayoutUnit ascent = child->firstLineBoxBaseline();
                     if (ascent == -1)
                         ascent = child->height() + child->marginBottom();
                     ascent += child->marginTop();
@@ -470,7 +470,7 @@
                     break;
             }
 
-            placeChild(child, IntPoint(xPos, childY));
+            placeChild(child, LayoutPoint(xPos, childY));
 
             xPos += child->width() + child->marginRight();
         }
@@ -509,7 +509,7 @@
                     for (RenderBox* child = iterator.first(); child; child = iterator.next()) {
                         LayoutUnit allowedFlex = allowedChildFlex(child, expanding, i);
                         if (allowedFlex) {
-                            LayoutUnit projectedFlex = (allowedFlex == numeric_limits<LayoutUnit>::max()) ? allowedFlex : static_cast<LayoutUnit>(allowedFlex * (totalFlex / child->style()->boxFlex()));
+                            LayoutUnit projectedFlex = (allowedFlex == numeric_limits<LayoutUnit>::max()) ? allowedFlex : LayoutUnit(allowedFlex * (totalFlex / child->style()->boxFlex()));
                             spaceAvailableThisPass = expanding ? min(spaceAvailableThisPass, projectedFlex) : max(spaceAvailableThisPass, projectedFlex);
                         }
                     }
@@ -527,7 +527,7 @@
                             continue;
 
                         if (allowedChildFlex(child, expanding, i)) {
-                            LayoutUnit spaceAdd = static_cast<LayoutUnit>(spaceAvailableThisPass * (child->style()->boxFlex() / totalFlex));
+                            LayoutUnit spaceAdd = LayoutUnit(spaceAvailableThisPass * (child->style()->boxFlex() / totalFlex));
                             if (spaceAdd) {
                                 child->setOverrideWidth(child->overrideWidth() + spaceAdd);
                                 m_flexingChildren = true;
@@ -906,7 +906,7 @@
         if (lineCount <= numVisibleLines)
             continue;
 
-        int newHeight = blockChild->heightForLineCount(numVisibleLines);
+        LayoutUnit newHeight = blockChild->heightForLineCount(numVisibleLines);
         if (newHeight == child->height())
             continue;
 
@@ -936,7 +936,7 @@
         const Font& font = style(numVisibleLines == 1)->font();
 
         // Get ellipsis width, and if the last child is an anchor, it will go after the ellipsis, so add in a space and the anchor width too
-        int totalWidth;
+        LayoutUnit totalWidth;
         InlineBox* anchorBox = lastLine->lastChild();
         if (anchorBox && anchorBox->renderer()->style()->isLink())
             totalWidth = anchorBox->logicalWidth() + font.width(constructTextRun(this, font, ellipsisAndSpace, 2, style()));
@@ -957,10 +957,10 @@
         if (!leftToRight)
             continue;
 
-        int blockRightEdge = destBlock->logicalRightOffsetForLine(lastVisibleLine->y(), false);
-        int blockLeftEdge = destBlock->logicalLeftOffsetForLine(lastVisibleLine->y(), false);
+        LayoutUnit blockRightEdge = destBlock->logicalRightOffsetForLine(lastVisibleLine->y(), false);
+        LayoutUnit blockLeftEdge = destBlock->logicalLeftOffsetForLine(lastVisibleLine->y(), false);
 
-        int blockEdge = leftToRight ? blockRightEdge : blockLeftEdge;
+        LayoutUnit blockEdge = leftToRight ? blockRightEdge : blockLeftEdge;
         if (!lastVisibleLine->lineCanAccommodateEllipsis(leftToRight, blockEdge, lastVisibleLine->x() + lastVisibleLine->logicalWidth(), totalWidth))
             continue;
 

Modified: trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.h (98928 => 98929)


--- trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.h	2011-11-01 00:59:34 UTC (rev 98928)
+++ trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.h	2011-11-01 01:01:57 UTC (rev 98929)
@@ -40,7 +40,7 @@
     void calcHorizontalPrefWidths();
     void calcVerticalPrefWidths();
 
-    virtual void layoutBlock(bool relayoutChildren, int pageHeight = 0, BlockLayoutPass = NormalLayoutPass);
+    virtual void layoutBlock(bool relayoutChildren, LayoutUnit pageHeight = 0, BlockLayoutPass = NormalLayoutPass);
     void layoutHorizontalBox(bool relayoutChildren);
     void layoutVerticalBox(bool relayoutChildren);
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to