Changeset 201114 in webkit


Ignore:
Timestamp:
May 18, 2016, 4:25:47 PM (9 years ago)
Author:
Alan Bujtas
Message:

Remove LayoutUnit::operator unsigned().
https://bugs.webkit.org/show_bug.cgi?id=157856

Reviewed by Simon Fraser.

Converting LayoutUnit values to unsigned is lossy. We should avoid
such implicit conversions.

No behaviour change.

  • html/ImageInputType.cpp:

(WebCore::ImageInputType::height):
(WebCore::ImageInputType::width):

  • page/EventHandler.cpp:

(WebCore::EventHandler::hitTestResultAtPoint):

  • platform/LayoutUnit.h:

(WebCore::LayoutUnit::operator unsigned): Deleted.

  • rendering/RenderBlockFlow.cpp:

(WebCore::RenderBlockFlow::computeColumnCountAndWidth):

Location:
trunk/Source
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r201113 r201114  
     12016-05-18  Zalan Bujtas  <zalan@apple.com>
     2
     3        Remove LayoutUnit::operator unsigned().
     4        https://bugs.webkit.org/show_bug.cgi?id=157856
     5
     6        Reviewed by Simon Fraser.
     7
     8        Converting LayoutUnit values to unsigned is lossy. We should avoid
     9        such implicit conversions.
     10
     11        No behaviour change.
     12
     13        * html/ImageInputType.cpp:
     14        (WebCore::ImageInputType::height):
     15        (WebCore::ImageInputType::width):
     16        * page/EventHandler.cpp:
     17        (WebCore::EventHandler::hitTestResultAtPoint):
     18        * platform/LayoutUnit.h:
     19        (WebCore::LayoutUnit::operator unsigned): Deleted.
     20        * rendering/RenderBlockFlow.cpp:
     21        (WebCore::RenderBlockFlow::computeColumnCountAndWidth):
     22
    1232016-05-18  Alex Christensen  <achristensen@webkit.org>
    224
  • trunk/Source/WebCore/html/ImageInputType.cpp

    r200041 r201114  
    183183        HTMLImageLoader* imageLoader = element->imageLoader();
    184184        if (imageLoader && imageLoader->image())
    185             return imageLoader->image()->imageSizeForRenderer(element->renderer(), 1).height();
     185            return imageLoader->image()->imageSizeForRenderer(element->renderer(), 1).height().toUnsigned();
    186186    }
    187187
     
    204204        HTMLImageLoader* imageLoader = element->imageLoader();
    205205        if (imageLoader && imageLoader->image())
    206             return imageLoader->image()->imageSizeForRenderer(element->renderer(), 1).width();
     206            return imageLoader->image()->imageSizeForRenderer(element->renderer(), 1).width().toUnsigned();
    207207    }
    208208
  • trunk/Source/WebCore/page/EventHandler.cpp

    r200971 r201114  
    11321132    }
    11331133
    1134     HitTestResult result(point, padding.height(), padding.width(), padding.height(), padding.width());
     1134    unsigned nonNegativePaddingWidth = std::max<LayoutUnit>(0, padding.width()).toUnsigned();
     1135    unsigned nonNegativePaddingHeight = std::max<LayoutUnit>(0, padding.height()).toUnsigned();
     1136    HitTestResult result(point, nonNegativePaddingHeight, nonNegativePaddingWidth, nonNegativePaddingHeight, nonNegativePaddingWidth);
    11351137
    11361138    RenderView* renderView = m_frame.contentRenderer();
  • trunk/Source/WebCore/platform/LayoutUnit.h

    r192357 r201114  
    115115
    116116    operator int() const { return toInt(); }
    117     operator unsigned() const { return toUnsigned(); }
    118117    operator float() const { return toFloat(); }
    119118    operator double() const { return toDouble(); }
  • trunk/Source/WebCore/rendering/RenderBlockFlow.cpp

    r201104 r201114  
    413413    LayoutUnit colGap = columnGap();
    414414    LayoutUnit colWidth = std::max<LayoutUnit>(LayoutUnit::fromPixel(1), LayoutUnit(style().columnWidth()));
    415     int colCount = std::max<int>(1, style().columnCount());
     415    unsigned colCount = std::max<unsigned>(1, style().columnCount());
    416416
    417417    if (style().hasAutoColumnWidth() && !style().hasAutoColumnCount()) {
     
    419419        desiredColumnWidth = std::max<LayoutUnit>(0, (availWidth - ((desiredColumnCount - 1) * colGap)) / desiredColumnCount);
    420420    } else if (!style().hasAutoColumnWidth() && style().hasAutoColumnCount()) {
    421         desiredColumnCount = std::max<LayoutUnit>(1, (availWidth + colGap) / (colWidth + colGap));
     421        desiredColumnCount = std::max<LayoutUnit>(1, (availWidth + colGap) / (colWidth + colGap)).toUnsigned();
    422422        desiredColumnWidth = ((availWidth + colGap) / desiredColumnCount) - colGap;
    423423    } else {
    424         desiredColumnCount = std::max<LayoutUnit>(std::min<LayoutUnit>(colCount, (availWidth + colGap) / (colWidth + colGap)), 1);
     424        desiredColumnCount = std::max<LayoutUnit>(std::min<LayoutUnit>(colCount, (availWidth + colGap) / (colWidth + colGap)), 1).toUnsigned();
    425425        desiredColumnWidth = ((availWidth + colGap) / desiredColumnCount) - colGap;
    426426    }
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r200588 r201114  
    51055105    LayoutUnit contentArea = pluginRenderBox.contentWidth() * pluginRenderBox.contentHeight();
    51065106    if (contentArea > candidatePlugInArea * primarySnapshottedPlugInSearchBucketSize) {
    5107         candidatePlugInArea = contentArea;
     5107        candidatePlugInArea = contentArea.toUnsigned();
    51085108        return true;
    51095109    }
Note: See TracChangeset for help on using the changeset viewer.