Changeset 114537 in webkit


Ignore:
Timestamp:
Apr 18, 2012 11:31:35 AM (12 years ago)
Author:
eae@chromium.org
Message:

Use explicit casts for size_t to unsigned conversion
https://bugs.webkit.org/show_bug.cgi?id=83602

Reviewed by Eric Seidel.

No new tests, no change in functinality.

Not all platforms have implicit casts from size_t to unsigned and we
can't add size_t versions of the operators to FractionalLayoutUnit for
all platforms as it would conflict with the unsigned versions of same.

Change support methods to take unsigned instead of size_t and use
explicit casts when multiplying or dividing a FractionalLayoutUnit with
a size_t and the other way around.

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::adjustForColumns):

  • rendering/RenderFlexibleBox.cpp:

(WebCore::initialPackingOffset):
(WebCore::packingSpaceBetweenChildren):
(WebCore::initialLinePackingOffset):
(WebCore::linePackingSpaceBetweenChildren):
(WebCore::RenderFlexibleBox::packFlexLines):

  • rendering/RenderFrameSet.cpp:

(WebCore::RenderFrameSet::layout):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r114535 r114537  
     12012-04-18  Emil A Eklund  <eae@chromium.org>
     2
     3        Use explicit casts for size_t to unsigned conversion
     4        https://bugs.webkit.org/show_bug.cgi?id=83602
     5
     6        Reviewed by Eric Seidel.
     7
     8        No new tests, no change in functinality.
     9
     10        Not all platforms have implicit casts from size_t to unsigned and we
     11        can't add size_t versions of the operators to FractionalLayoutUnit for
     12        all platforms as it would conflict with the unsigned versions of same.
     13
     14        Change support methods to take unsigned instead of size_t and use
     15        explicit casts when multiplying or dividing a FractionalLayoutUnit with
     16        a size_t and the other way around.
     17
     18        * rendering/RenderBlock.cpp:
     19        (WebCore::RenderBlock::adjustForColumns):
     20        * rendering/RenderFlexibleBox.cpp:
     21        (WebCore::initialPackingOffset):
     22        (WebCore::packingSpaceBetweenChildren):
     23        (WebCore::initialLinePackingOffset):
     24        (WebCore::linePackingSpaceBetweenChildren):
     25        (WebCore::RenderFlexibleBox::packFlexLines):
     26        * rendering/RenderFrameSet.cpp:
     27        (WebCore::RenderFrameSet::layout):
     28
    1292012-04-18  Pavel Feldman  <pfeldman@chromium.org>
    230
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r114461 r114537  
    51775177
    51785178    LayoutUnit logicalLeft = logicalLeftOffsetForContent();
    5179     size_t colCount = columnCount(colInfo);
     5179    unsigned colCount = columnCount(colInfo);
    51805180    LayoutUnit colLogicalWidth = colInfo->desiredColumnWidth();
    51815181    LayoutUnit colLogicalHeight = colInfo->columnHeight();
    51825182
    5183     for (size_t i = 0; i < colCount; ++i) {
     5183    for (unsigned i = 0; i < colCount; ++i) {
    51845184        // Compute the edges for a given column in the block progression direction.
    51855185        LayoutRect sliceRect = LayoutRect(logicalLeft, borderBefore() + paddingBefore() + i * colLogicalHeight, colLogicalWidth, colLogicalHeight);
  • trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp

    r113665 r114537  
    807807}
    808808
    809 static LayoutUnit initialPackingOffset(LayoutUnit availableFreeSpace, EFlexPack flexPack, size_t numberOfChildren)
     809static LayoutUnit initialPackingOffset(LayoutUnit availableFreeSpace, EFlexPack flexPack, unsigned numberOfChildren)
    810810{
    811811    if (flexPack == PackEnd)
     
    822822}
    823823
    824 static LayoutUnit packingSpaceBetweenChildren(LayoutUnit availableFreeSpace, EFlexPack flexPack, size_t numberOfChildren)
     824static LayoutUnit packingSpaceBetweenChildren(LayoutUnit availableFreeSpace, EFlexPack flexPack, unsigned numberOfChildren)
    825825{
    826826    if (availableFreeSpace > 0 && numberOfChildren > 1) {
     
    970970}
    971971
    972 static LayoutUnit initialLinePackingOffset(LayoutUnit availableFreeSpace, EFlexLinePack linePack, size_t numberOfLines)
     972static LayoutUnit initialLinePackingOffset(LayoutUnit availableFreeSpace, EFlexLinePack linePack, unsigned numberOfLines)
    973973{
    974974    if (linePack == LinePackEnd)
     
    985985}
    986986
    987 static LayoutUnit linePackingSpaceBetweenChildren(LayoutUnit availableFreeSpace, EFlexLinePack linePack, size_t numberOfLines)
     987static LayoutUnit linePackingSpaceBetweenChildren(LayoutUnit availableFreeSpace, EFlexLinePack linePack, unsigned numberOfLines)
    988988{
    989989    if (availableFreeSpace > 0 && numberOfLines > 1) {
     
    10071007    RenderBox* child = iterator.first();
    10081008    LayoutUnit lineOffset = initialLinePackingOffset(availableCrossAxisSpace, style()->flexLinePack(), lineContexts.size());
    1009     for (size_t lineNumber = 0; lineNumber < lineContexts.size(); ++lineNumber) {
     1009    for (unsigned lineNumber = 0; lineNumber < lineContexts.size(); ++lineNumber) {
    10101010        lineContexts[lineNumber].crossAxisOffset += lineOffset;
    10111011        for (size_t childNumber = 0; childNumber < lineContexts[lineNumber].numberOfChildren; ++childNumber, child = iterator.next())
     
    10131013
    10141014        if (style()->flexLinePack() == LinePackStretch && availableCrossAxisSpace > 0)
    1015             lineContexts[lineNumber].crossAxisExtent += availableCrossAxisSpace / lineContexts.size();
     1015            lineContexts[lineNumber].crossAxisExtent += availableCrossAxisSpace / static_cast<unsigned>(lineContexts.size());
    10161016
    10171017        lineOffset += linePackingSpaceBetweenChildren(availableCrossAxisSpace, style()->flexLinePack(), lineContexts.size());
  • trunk/Source/WebCore/rendering/RenderFrameSet.cpp

    r114079 r114537  
    473473    }
    474474
    475     size_t cols = frameSet()->totalCols();
    476     size_t rows = frameSet()->totalRows();
     475    unsigned cols = frameSet()->totalCols();
     476    unsigned rows = frameSet()->totalRows();
    477477
    478478    if (m_rows.m_sizes.size() != rows || m_cols.m_sizes.size() != cols) {
Note: See TracChangeset for help on using the changeset viewer.