Changeset 98929 in webkit
- Timestamp:
- Oct 31, 2011 6:01:57 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r98926 r98929 1 2011-10-31 Levi Weintraub <leviw@chromium.org> 2 3 Amend missing uses of LayoutUnits in RenderApplet, Button, and DeprecatedFlexibleBox 4 https://bugs.webkit.org/show_bug.cgi?id=71243 5 6 Reviewed by Eric Seidel. 7 8 Replacing remaining integer uses with LayoutUnits in the aforementioned classes. 9 10 No new tests -- no change in behavior. 11 12 * rendering/RenderApplet.cpp: 13 (WebCore::RenderApplet::intrinsicSize): 14 (WebCore::RenderApplet::createWidgetIfNecessary): 15 * rendering/RenderApplet.h: 16 * rendering/RenderButton.cpp: 17 (WebCore::RenderButton::controlClipRect): 18 * rendering/RenderButton.h: 19 * rendering/RenderDeprecatedFlexibleBox.cpp: 20 (WebCore::marginWidthForChild): 21 (WebCore::RenderDeprecatedFlexibleBox::computePreferredLogicalWidths): 22 (WebCore::RenderDeprecatedFlexibleBox::layoutBlock): 23 (WebCore::RenderDeprecatedFlexibleBox::layoutHorizontalBox): 24 (WebCore::RenderDeprecatedFlexibleBox::applyLineClamp): 25 * rendering/RenderDeprecatedFlexibleBox.h: 26 1 27 2011-10-31 Tommy Widenflycht <tommyw@google.com> 2 28 -
trunk/Source/WebCore/rendering/RenderApplet.cpp
r71536 r98929 45 45 } 46 46 47 IntSize RenderApplet::intrinsicSize() const47 LayoutSize RenderApplet::intrinsicSize() const 48 48 { 49 49 // FIXME: This doesn't make sense. We can't just start returning … … 51 51 // layout and sizing to be correct. We should remove this and 52 52 // pass the appropriate intrinsic size in the constructor. 53 return widget() ? IntSize(50, 50) : IntSize(150, 150);53 return widget() ? LayoutSize(50, 50) : LayoutSize(150, 150); 54 54 } 55 55 … … 64 64 // use fixed widths/heights from the style system when we can, since the widget might 65 65 // not have an accurate m_width/m_height. 66 int contentWidth = style()->width().isFixed() ? style()->width().value() :66 LayoutUnit contentWidth = style()->width().isFixed() ? LayoutUnit(style()->width().value()) : 67 67 width() - borderAndPaddingWidth(); 68 int contentHeight = style()->height().isFixed() ? style()->height().value() :68 LayoutUnit contentHeight = style()->height().isFixed() ? LayoutUnit(style()->height().value()) : 69 69 height() - borderAndPaddingHeight(); 70 70 for (Node* child = element->firstChild(); child; child = child->nextSibling()) { … … 78 78 Frame* frame = this->frame(); 79 79 ASSERT(frame); 80 setWidget(frame->loader()->subframeLoader()->createJavaAppletWidget( IntSize(contentWidth, contentHeight), element, m_args));80 setWidget(frame->loader()->subframeLoader()->createJavaAppletWidget(LayoutSize(contentWidth, contentHeight), element, m_args)); 81 81 } 82 82 -
trunk/Source/WebCore/rendering/RenderApplet.h
r71536 r98929 47 47 48 48 virtual void layout(); 49 virtual IntSize intrinsicSize() const;49 virtual LayoutSize intrinsicSize() const; 50 50 51 51 #if USE(ACCELERATED_COMPOSITING) -
trunk/Source/WebCore/rendering/RenderButton.cpp
r93820 r98929 158 158 } 159 159 160 IntRect RenderButton::controlClipRect(const IntPoint& additionalOffset) const160 LayoutRect RenderButton::controlClipRect(const LayoutPoint& additionalOffset) const 161 161 { 162 162 // Clip to the padding box to at least give content the extra padding space. 163 return IntRect(additionalOffset.x() + borderLeft(), additionalOffset.y() + borderTop(), width() - borderLeft() - borderRight(), height() - borderTop() - borderBottom());163 return LayoutRect(additionalOffset.x() + borderLeft(), additionalOffset.y() + borderTop(), width() - borderLeft() - borderRight(), height() - borderTop() - borderBottom()); 164 164 } 165 165 -
trunk/Source/WebCore/rendering/RenderButton.h
r98883 r98929 52 52 53 53 virtual bool hasControlClip() const { return true; } 54 virtual LayoutRect controlClipRect(const IntPoint&) const;54 virtual LayoutRect controlClipRect(const LayoutPoint&) const; 55 55 56 56 void setText(const String&); -
trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp
r98033 r98929 130 130 } 131 131 132 static int marginWidthForChild(RenderBox* child)132 static LayoutUnit marginWidthForChild(RenderBox* child) 133 133 { 134 134 // A margin basically has three types: fixed, percentage, and auto (variable). … … 137 137 Length marginLeft = child->style()->marginLeft(); 138 138 Length marginRight = child->style()->marginRight(); 139 int margin = 0;139 LayoutUnit margin = 0; 140 140 if (marginLeft.isFixed()) 141 141 margin += marginLeft.value(); … … 197 197 if (hasOverflowClip() && style()->overflowY() == OSCROLL) { 198 198 layer()->setHasVerticalScrollbar(true); 199 int scrollbarWidth = verticalScrollbarWidth();199 LayoutUnit scrollbarWidth = verticalScrollbarWidth(); 200 200 m_maxPreferredLogicalWidth += scrollbarWidth; 201 201 m_minPreferredLogicalWidth += scrollbarWidth; … … 219 219 } 220 220 221 void RenderDeprecatedFlexibleBox::layoutBlock(bool relayoutChildren, int pageLogicalHeight, BlockLayoutPass layoutPass)221 void RenderDeprecatedFlexibleBox::layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight, BlockLayoutPass layoutPass) 222 222 { 223 223 ASSERT(needsLayout()); … … 227 227 228 228 LayoutRepainter repainter(*this, checkForRepaintDuringLayout()); 229 LayoutStateMaintainer statePusher(view(), this, IntSize(x(), y()), hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMode());229 LayoutStateMaintainer statePusher(view(), this, LayoutSize(x(), y()), hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMode()); 230 230 231 231 LayoutSize previousSize = size(); … … 276 276 // twice when we collapse with our previous vertically adjacent and 277 277 // following vertically adjacent blocks. 278 int pos = maxPositiveMarginBefore();279 int neg = maxNegativeMarginBefore();278 LayoutUnit pos = maxPositiveMarginBefore(); 279 LayoutUnit neg = maxNegativeMarginBefore(); 280 280 if (maxPositiveMarginAfter() > pos) 281 281 pos = maxPositiveMarginAfter(); … … 456 456 break; 457 457 case BBASELINE: { 458 int ascent = child->firstLineBoxBaseline();458 LayoutUnit ascent = child->firstLineBoxBaseline(); 459 459 if (ascent == -1) 460 460 ascent = child->height() + child->marginBottom(); … … 471 471 } 472 472 473 placeChild(child, IntPoint(xPos, childY));473 placeChild(child, LayoutPoint(xPos, childY)); 474 474 475 475 xPos += child->width() + child->marginRight(); … … 510 510 LayoutUnit allowedFlex = allowedChildFlex(child, expanding, i); 511 511 if (allowedFlex) { 512 LayoutUnit projectedFlex = (allowedFlex == numeric_limits<LayoutUnit>::max()) ? allowedFlex : static_cast<LayoutUnit>(allowedFlex * (totalFlex / child->style()->boxFlex()));512 LayoutUnit projectedFlex = (allowedFlex == numeric_limits<LayoutUnit>::max()) ? allowedFlex : LayoutUnit(allowedFlex * (totalFlex / child->style()->boxFlex())); 513 513 spaceAvailableThisPass = expanding ? min(spaceAvailableThisPass, projectedFlex) : max(spaceAvailableThisPass, projectedFlex); 514 514 } … … 528 528 529 529 if (allowedChildFlex(child, expanding, i)) { 530 LayoutUnit spaceAdd = static_cast<LayoutUnit>(spaceAvailableThisPass * (child->style()->boxFlex() / totalFlex));530 LayoutUnit spaceAdd = LayoutUnit(spaceAvailableThisPass * (child->style()->boxFlex() / totalFlex)); 531 531 if (spaceAdd) { 532 532 child->setOverrideWidth(child->overrideWidth() + spaceAdd); … … 907 907 continue; 908 908 909 int newHeight = blockChild->heightForLineCount(numVisibleLines);909 LayoutUnit newHeight = blockChild->heightForLineCount(numVisibleLines); 910 910 if (newHeight == child->height()) 911 911 continue; … … 937 937 938 938 // 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 939 int totalWidth;939 LayoutUnit totalWidth; 940 940 InlineBox* anchorBox = lastLine->lastChild(); 941 941 if (anchorBox && anchorBox->renderer()->style()->isLink()) … … 958 958 continue; 959 959 960 int blockRightEdge = destBlock->logicalRightOffsetForLine(lastVisibleLine->y(), false);961 int blockLeftEdge = destBlock->logicalLeftOffsetForLine(lastVisibleLine->y(), false);962 963 int blockEdge = leftToRight ? blockRightEdge : blockLeftEdge;960 LayoutUnit blockRightEdge = destBlock->logicalRightOffsetForLine(lastVisibleLine->y(), false); 961 LayoutUnit blockLeftEdge = destBlock->logicalLeftOffsetForLine(lastVisibleLine->y(), false); 962 963 LayoutUnit blockEdge = leftToRight ? blockRightEdge : blockLeftEdge; 964 964 if (!lastVisibleLine->lineCanAccommodateEllipsis(leftToRight, blockEdge, lastVisibleLine->x() + lastVisibleLine->logicalWidth(), totalWidth)) 965 965 continue; -
trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.h
r92638 r98929 41 41 void calcVerticalPrefWidths(); 42 42 43 virtual void layoutBlock(bool relayoutChildren, int pageHeight = 0, BlockLayoutPass = NormalLayoutPass);43 virtual void layoutBlock(bool relayoutChildren, LayoutUnit pageHeight = 0, BlockLayoutPass = NormalLayoutPass); 44 44 void layoutHorizontalBox(bool relayoutChildren); 45 45 void layoutVerticalBox(bool relayoutChildren);
Note: See TracChangeset
for help on using the changeset viewer.