Changeset 113030 in webkit


Ignore:
Timestamp:
Apr 3, 2012 6:55:52 AM (12 years ago)
Author:
leviw@chromium.org
Message:

Revert RenderTheme paint and layout functions to ints
https://bugs.webkit.org/show_bug.cgi?id=82196

Reviewed by Julien Chaffraix.

When dealing with object that are rendered outside of WebCore, we do all necessary pixel snapping
before passing coordinates to the external code. RenderTheme encompasses a set of objects whose
rendering is influenced by the platform. This change reverts the interface between this platform
code and WebCore to be integers.

Some platforms, such as Mac, use sub-pixel units for layout and rendering, but it's still not
desirable to pass sub-pixel values to these API's, because ultimately we'll render these objects
at whole-pixel values to avoid anti-aliasing.

Marking touched overridden virtual functions as OVERRIDE. There are many more to update.

No new tests. No change in behavior.

  • platform/graphics/FractionalLayoutRect.h:

(WebCore::FractionalLayoutRect::pixelSnappedLocation): Convenience function.
(WebCore::FractionalLayoutRect::pixelSnappedSize): Ditto.
(FractionalLayoutRect):

  • platform/graphics/IntRect.h:

(WebCore::IntRect::pixelSnappedLocation): Temporary mirrors to the functions of the same name on
FractionalLayoutRect.
(WebCore::IntRect::pixelSnappedSize): Ditto.

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::paintBoxDecorations): Adding a local pixel snapped paint rect to avoid
repeated pixel snapping.

  • rendering/RenderBox.h:

(WebCore::RenderBox::absoluteContentBox): Reverting to integers since this represents on-screen
coordinates
(WebCore::RenderBox::pixelSnappedSize): Convenience method.

  • rendering/RenderMediaControls.cpp:

(WebCore::RenderMediaControls::volumeSliderOffsetFromMuteButton): This static function is only called
from RenderTheme platform code. Changing it to operate on pixel snapped values since we don't want
to pipe LayoutUnits through that code.

  • rendering/RenderMeter.cpp:

(WebCore::RenderMeter::computeLogicalWidth): Changing to feed pixel snapped values into the platform
code to properly determine the resulting meter size.
(WebCore::RenderMeter::computeLogicalHeight): Ditto.

  • rendering/RenderTheme.cpp:

(WebCore::RenderTheme::paint):
(WebCore::RenderTheme::volumeSliderOffsetFromMuteButton):
(WebCore::RenderTheme::adjustRepaintRect):
(WebCore::RenderTheme::meterSizeForBounds):

  • rendering/RenderTheme.h:

(RenderTheme):
(WebCore::RenderTheme::paintCapsLockIndicator):

  • rendering/RenderThemeChromiumMac.h:

(RenderThemeChromiumMac):

  • rendering/RenderThemeChromiumSkia.cpp:

(WebCore::RenderThemeChromiumSkia::convertToPaintingRect):
(WebCore::RenderThemeChromiumSkia::paintSearchFieldCancelButton):
(WebCore::RenderThemeChromiumSkia::paintSearchFieldResultsDecoration):
(WebCore::RenderThemeChromiumSkia::paintSearchFieldResultsButton):

  • rendering/RenderThemeChromiumSkia.h:
  • rendering/RenderThemeMac.h:

(RenderThemeMac):

  • rendering/RenderThemeMac.mm:

(WebCore::RenderThemeMac::adjustRepaintRect):
(WebCore::RenderThemeMac::inflateRect):
(WebCore::RenderThemeMac::convertToPaintingRect):
(WebCore::RenderThemeMac::setControlSize):
(WebCore::RenderThemeMac::paintCapsLockIndicator):
(WebCore::RenderThemeMac::paintMenuList):
(WebCore::RenderThemeMac::meterSizeForBounds):
(WebCore::RenderThemeMac::setPopupButtonCellState):
(WebCore::RenderThemeMac::paintSearchFieldCancelButton):
(WebCore::RenderThemeMac::volumeSliderOffsetFromMuteButton):

  • rendering/RenderThemeWin.cpp:

(WebCore::RenderThemeWin::volumeSliderOffsetFromMuteButton):

  • rendering/RenderThemeWin.h:

(RenderThemeWin):

Location:
trunk/Source/WebCore
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r113026 r113030  
     12012-04-03  Levi Weintraub  <leviw@chromium.org>
     2
     3        Revert RenderTheme paint and layout functions to ints
     4        https://bugs.webkit.org/show_bug.cgi?id=82196
     5
     6        Reviewed by Julien Chaffraix.
     7
     8        When dealing with object that are rendered outside of WebCore, we do all necessary pixel snapping
     9        before passing coordinates to the external code. RenderTheme encompasses a set of objects whose
     10        rendering is influenced by the platform. This change reverts the interface between this platform
     11        code and WebCore to be integers.
     12
     13        Some platforms, such as Mac, use sub-pixel units for layout and rendering, but it's still not
     14        desirable to pass sub-pixel values to these API's, because ultimately we'll render these objects
     15        at whole-pixel values to avoid anti-aliasing.
     16
     17        Marking touched overridden virtual functions as OVERRIDE. There are many more to update.
     18
     19        No new tests. No change in behavior.
     20
     21        * platform/graphics/FractionalLayoutRect.h:
     22        (WebCore::FractionalLayoutRect::pixelSnappedLocation): Convenience function.
     23        (WebCore::FractionalLayoutRect::pixelSnappedSize): Ditto.
     24        (FractionalLayoutRect):
     25        * platform/graphics/IntRect.h:
     26        (WebCore::IntRect::pixelSnappedLocation): Temporary mirrors to the functions of the same name on
     27        FractionalLayoutRect.
     28        (WebCore::IntRect::pixelSnappedSize): Ditto.
     29        * rendering/RenderBox.cpp:
     30        (WebCore::RenderBox::paintBoxDecorations): Adding a local pixel snapped paint rect to avoid
     31        repeated pixel snapping.
     32        * rendering/RenderBox.h:
     33        (WebCore::RenderBox::absoluteContentBox): Reverting to integers since this represents on-screen
     34        coordinates
     35        (WebCore::RenderBox::pixelSnappedSize): Convenience method.
     36        * rendering/RenderMediaControls.cpp:
     37        (WebCore::RenderMediaControls::volumeSliderOffsetFromMuteButton): This static function is only called
     38        from RenderTheme platform code. Changing it to operate on pixel snapped values since we don't want
     39        to pipe LayoutUnits through that code.
     40        * rendering/RenderMeter.cpp:
     41        (WebCore::RenderMeter::computeLogicalWidth): Changing to feed pixel snapped values into the platform
     42        code to properly determine the resulting meter size.
     43        (WebCore::RenderMeter::computeLogicalHeight): Ditto.
     44        * rendering/RenderTheme.cpp:
     45        (WebCore::RenderTheme::paint):
     46        (WebCore::RenderTheme::volumeSliderOffsetFromMuteButton):
     47        (WebCore::RenderTheme::adjustRepaintRect):
     48        (WebCore::RenderTheme::meterSizeForBounds):
     49        * rendering/RenderTheme.h:
     50        (RenderTheme):
     51        (WebCore::RenderTheme::paintCapsLockIndicator):
     52        * rendering/RenderThemeChromiumMac.h:
     53        (RenderThemeChromiumMac):
     54        * rendering/RenderThemeChromiumSkia.cpp:
     55        (WebCore::RenderThemeChromiumSkia::convertToPaintingRect):
     56        (WebCore::RenderThemeChromiumSkia::paintSearchFieldCancelButton):
     57        (WebCore::RenderThemeChromiumSkia::paintSearchFieldResultsDecoration):
     58        (WebCore::RenderThemeChromiumSkia::paintSearchFieldResultsButton):
     59        * rendering/RenderThemeChromiumSkia.h:
     60        * rendering/RenderThemeMac.h:
     61        (RenderThemeMac):
     62        * rendering/RenderThemeMac.mm:
     63        (WebCore::RenderThemeMac::adjustRepaintRect):
     64        (WebCore::RenderThemeMac::inflateRect):
     65        (WebCore::RenderThemeMac::convertToPaintingRect):
     66        (WebCore::RenderThemeMac::setControlSize):
     67        (WebCore::RenderThemeMac::paintCapsLockIndicator):
     68        (WebCore::RenderThemeMac::paintMenuList):
     69        (WebCore::RenderThemeMac::meterSizeForBounds):
     70        (WebCore::RenderThemeMac::setPopupButtonCellState):
     71        (WebCore::RenderThemeMac::paintSearchFieldCancelButton):
     72        (WebCore::RenderThemeMac::volumeSliderOffsetFromMuteButton):
     73        * rendering/RenderThemeWin.cpp:
     74        (WebCore::RenderThemeWin::volumeSliderOffsetFromMuteButton):
     75        * rendering/RenderThemeWin.h:
     76        (RenderThemeWin):
     77
    1782012-03-29  Joseph Pecoraro  <joepeck@webkit.org> and Jocelyn Turcotte  <jocelyn.turcotte@nokia.com>
    279
  • trunk/Source/WebCore/platform/graphics/FractionalLayoutRect.h

    r109835 r113030  
    5555    FractionalLayoutPoint location() const { return m_location; }
    5656    FractionalLayoutSize size() const { return m_size; }
     57
     58    IntPoint pixelSnappedLocation() const { return roundedIntPoint(m_location); }
     59    IntSize pixelSnappedSize() const { return pixelSnappedIntSize(m_size, m_location); }
    5760
    5861    void setLocation(const FractionalLayoutPoint& location) { m_location = location; }
  • trunk/Source/WebCore/platform/graphics/IntRect.h

    r111185 r113030  
    112112    int pixelSnappedWidth() const { return m_size.width(); }
    113113    int pixelSnappedHeight() const { return m_size.height(); }
     114    IntPoint pixelSnappedLocation() const { return location(); }
     115    IntSize pixelSnappedSize() const { return size(); }
    114116
    115117    void setX(int x) { m_location.setX(x); }
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r112749 r113030  
    555555}
    556556
    557 LayoutRect RenderBox::absoluteContentBox() const
    558 {
    559     LayoutRect rect = contentBoxRect();
     557IntRect RenderBox::absoluteContentBox() const
     558{
     559    IntRect rect = pixelSnappedIntRect(contentBoxRect());
    560560    FloatPoint absPos = localToAbsolute(FloatPoint());
    561561    rect.move(absPos.x(), absPos.y());
     
    10011001    // If we have a native theme appearance, paint that before painting our background.
    10021002    // The theme will tell us whether or not we should also paint the CSS background.
    1003     bool themePainted = style()->hasAppearance() && !theme()->paint(this, paintInfo, paintRect);
     1003    IntRect snappedPaintRect(pixelSnappedIntRect(paintRect));
     1004    bool themePainted = style()->hasAppearance() && !theme()->paint(this, paintInfo, snappedPaintRect);
    10041005    if (!themePainted) {
    10051006        paintBackground(paintInfo, paintRect, bleedAvoidance);
    10061007
    10071008        if (style()->hasAppearance())
    1008             theme()->paintDecorations(this, paintInfo, pixelSnappedIntRect(paintRect));
     1009            theme()->paintDecorations(this, paintInfo, snappedPaintRect);
    10091010    }
    10101011    paintBoxShadow(paintInfo, paintRect, style(), Inset);
    10111012
    10121013    // The theme will tell us whether or not we should also paint the CSS border.
    1013     if ((!style()->hasAppearance() || (!themePainted && theme()->paintBorderOnly(this, paintInfo, pixelSnappedIntRect(paintRect)))) && style()->hasBorder())
     1014    if ((!style()->hasAppearance() || (!themePainted && theme()->paintBorderOnly(this, paintInfo, snappedPaintRect))) && style()->hasBorder())
    10141015        paintBorder(paintInfo, paintRect, style(), bleedAvoidance);
    10151016
  • trunk/Source/WebCore/rendering/RenderBox.h

    r112758 r113030  
    124124    LayoutSize locationOffset() const { return LayoutSize(x(), y()); }
    125125    LayoutSize size() const { return m_frameRect.size(); }
     126    IntSize pixelSnappedSize() const { return m_frameRect.pixelSnappedSize(); }
    126127
    127128    void setLocation(const LayoutPoint& location) { m_frameRect.setLocation(location); }
     
    140141    LayoutRect contentBoxRect(PaddingOptions paddingOption = ExcludeIntrinsicPadding) const { return LayoutRect(borderLeft() + paddingLeft(paddingOption), borderTop() + paddingTop(paddingOption), contentWidth(paddingOption), contentHeight(paddingOption)); }
    141142    // The content box in absolute coords. Ignores transforms.
    142     LayoutRect absoluteContentBox() const;
     143    IntRect absoluteContentBox() const;
    143144    // The content box converted to absolute coords (taking transforms into account).
    144145    FloatQuad absoluteContentQuad() const;
  • trunk/Source/WebCore/rendering/RenderMediaControls.cpp

    r111041 r113030  
    213213
    214214    float zoomLevel = muteButtonBox->style()->effectiveZoom();
    215     int y = yOffset * zoomLevel + muteButtonBox->offsetHeight() - size.height();
    216     FloatPoint absPoint = muteButtonBox->localToAbsolute(FloatPoint(muteButtonBox->offsetLeft(), y), true, true);
     215    int y = yOffset * zoomLevel + muteButtonBox->pixelSnappedOffsetHeight() - size.height();
     216    FloatPoint absPoint = muteButtonBox->localToAbsolute(FloatPoint(muteButtonBox->pixelSnappedOffsetLeft(), y), true, true);
    217217    if (absPoint.y() < 0)
    218         y = muteButtonBox->height();
     218        y = muteButtonBox->pixelSnappedHeight();
    219219    return IntPoint(xOffset * zoomLevel, y);
    220220}
  • trunk/Source/WebCore/rendering/RenderMeter.cpp

    r95901 r113030  
    4747{
    4848    RenderBox::computeLogicalWidth();
    49     setWidth(theme()->meterSizeForBounds(this, frameRect()).width());
     49    setWidth(theme()->meterSizeForBounds(this, pixelSnappedIntRect(frameRect())).width());
    5050}
    5151
     
    5353{
    5454    RenderBox::computeLogicalHeight();
    55     setHeight(theme()->meterSizeForBounds(this, frameRect()).height());
     55    setHeight(theme()->meterSizeForBounds(this, pixelSnappedIntRect(frameRect())).height());
    5656}
    5757
  • trunk/Source/WebCore/rendering/RenderTheme.cpp

    r111041 r113030  
    245245}
    246246
    247 bool RenderTheme::paint(RenderObject* o, const PaintInfo& paintInfo, const LayoutRect& r)
     247bool RenderTheme::paint(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r)
    248248{
    249249    // If painting is disabled, but we aren't updating control tints, then just bail.
     
    508508}
    509509
    510 LayoutPoint RenderTheme::volumeSliderOffsetFromMuteButton(RenderBox* muteButtonBox, const LayoutSize& size) const
    511 {
    512     LayoutUnit y = -size.height();
     510IntPoint RenderTheme::volumeSliderOffsetFromMuteButton(RenderBox* muteButtonBox, const IntSize& size) const
     511{
     512    int y = -size.height();
    513513    FloatPoint absPoint = muteButtonBox->localToAbsolute(FloatPoint(muteButtonBox->pixelSnappedOffsetLeft(), y), true, true);
    514514    if (absPoint.y() < 0)
    515515        y = muteButtonBox->height();
    516     return LayoutPoint(0, y);
     516    return IntPoint(0, y);
    517517}
    518518
     
    670670}
    671671
    672 void RenderTheme::adjustRepaintRect(const RenderObject* o, LayoutRect& r)
     672void RenderTheme::adjustRepaintRect(const RenderObject* o, IntRect& r)
    673673{
    674674#if USE(NEW_THEME)
     
    927927}
    928928
    929 LayoutSize RenderTheme::meterSizeForBounds(const RenderMeter*, const LayoutRect& bounds) const
     929IntSize RenderTheme::meterSizeForBounds(const RenderMeter*, const IntRect& bounds) const
    930930{
    931931    return bounds.size();
  • trunk/Source/WebCore/rendering/RenderTheme.h

    r110560 r113030  
    7878    // text of a button, is always rendered by the engine itself.  The boolean return value indicates
    7979    // whether the CSS border/background should also be painted.
    80     bool paint(RenderObject*, const PaintInfo&, const LayoutRect&);
     80    bool paint(RenderObject*, const PaintInfo&, const IntRect&);
    8181    bool paintBorderOnly(RenderObject*, const PaintInfo&, const IntRect&);
    8282    bool paintDecorations(RenderObject*, const PaintInfo&, const IntRect&);
     
    116116    // Some controls may spill out of their containers (e.g., the check on an OS X checkbox).  When these controls repaint,
    117117    // the theme needs to communicate this inflated rect to the engine so that it can invalidate the whole control.
    118     virtual void adjustRepaintRect(const RenderObject*, LayoutRect&);
     118    virtual void adjustRepaintRect(const RenderObject*, IntRect&);
    119119
    120120    // This method is called whenever a relevant state changes on a particular themed object, e.g., the mouse becomes pressed
     
    178178
    179179    // Method for painting the caps lock indicator
    180     virtual bool paintCapsLockIndicator(RenderObject*, const PaintInfo&, const LayoutRect&) { return 0; };
     180    virtual bool paintCapsLockIndicator(RenderObject*, const PaintInfo&, const IntRect&) { return 0; };
    181181
    182182#if ENABLE(PROGRESS_TAG)
     
    200200   
    201201    // Returns the media volume slider container's offset from the mute button.
    202     virtual LayoutPoint volumeSliderOffsetFromMuteButton(RenderBox*, const LayoutSize&) const;
     202    virtual IntPoint volumeSliderOffsetFromMuteButton(RenderBox*, const IntSize&) const;
    203203#endif
    204204
    205205#if ENABLE(METER_TAG)
    206     virtual LayoutSize meterSizeForBounds(const RenderMeter*, const LayoutRect&) const;
     206    virtual IntSize meterSizeForBounds(const RenderMeter*, const IntRect&) const;
    207207    virtual bool supportsMeter(ControlPart) const;
    208208#endif
  • trunk/Source/WebCore/rendering/RenderThemeChromiumMac.h

    r106734 r113030  
    5050    virtual bool paintMediaVolumeSliderTrack(RenderObject*, const PaintInfo&, const IntRect&);
    5151    virtual bool paintMediaVolumeSliderThumb(RenderObject*, const PaintInfo&, const IntRect&);
    52     virtual LayoutPoint volumeSliderOffsetFromMuteButton(RenderBox*, const LayoutSize&) const;
     52    virtual IntPoint volumeSliderOffsetFromMuteButton(RenderBox*, const IntSize&) const OVERRIDE;
    5353    virtual bool usesMediaControlStatusDisplay() { return false; }
    5454    virtual bool hasOwnDisabledStateHandlingFor(ControlPart) const { return true; }
  • trunk/Source/WebCore/rendering/RenderThemeChromiumMac.mm

    r106734 r113030  
    212212}
    213213
    214 LayoutPoint RenderThemeChromiumMac::volumeSliderOffsetFromMuteButton(RenderBox* muteButtonBox, const LayoutSize& size) const
     214IntPoint RenderThemeChromiumMac::volumeSliderOffsetFromMuteButton(RenderBox* muteButtonBox, const IntSize& size) const
    215215{
    216216    return RenderTheme::volumeSliderOffsetFromMuteButton(muteButtonBox, size);
  • trunk/Source/WebCore/rendering/RenderThemeChromiumSkia.cpp

    r111274 r113030  
    262262}
    263263
    264 LayoutRect RenderThemeChromiumSkia::convertToPaintingRect(RenderObject* inputRenderer, const RenderObject* partRenderer, LayoutRect partRect, const IntRect& localOffset) const
     264IntRect RenderThemeChromiumSkia::convertToPaintingRect(RenderObject* inputRenderer, const RenderObject* partRenderer, IntRect partRect, const IntRect& localOffset) const
    265265{
    266266    // Compute an offset between the part renderer and the input renderer.
    267     LayoutSize offsetFromInputRenderer = -(partRenderer->offsetFromAncestorContainer(inputRenderer));
     267    IntSize offsetFromInputRenderer = -(partRenderer->offsetFromAncestorContainer(inputRenderer));
    268268    // Move the rect into partRenderer's coords.
    269269    partRect.move(offsetFromInputRenderer);
     
    281281        return false;
    282282    RenderBox* inputRenderBox = toRenderBox(input->renderer());
    283     LayoutRect inputContentBox = inputRenderBox->contentBoxRect();
     283    IntRect inputContentBox = inputRenderBox->contentBoxRect();
    284284
    285285    // Make sure the scaled button stays square and will fit in its parent's box.
    286     LayoutUnit cancelButtonSize = std::min(inputContentBox.width(), std::min<LayoutUnit>(inputContentBox.height(), r.height()));
     286    int cancelButtonSize = std::min(inputContentBox.width(), std::min<int>(inputContentBox.height(), r.height()));
    287287    // Calculate cancel button's coordinates relative to the input element.
    288288    // Center the button vertically.  Round up though, so if it has to be one pixel off-center, it will
    289289    // be one pixel closer to the bottom of the field.  This tends to look better with the text.
    290     LayoutRect cancelButtonRect(cancelButtonObject->offsetFromAncestorContainer(inputRenderBox).width(),
    291                                 inputContentBox.y() + (inputContentBox.height() - cancelButtonSize + 1) / 2,
    292                                 cancelButtonSize, cancelButtonSize);
    293     LayoutRect paintingRect = convertToPaintingRect(inputRenderBox, cancelButtonObject, cancelButtonRect, r);
     290    IntRect cancelButtonRect(cancelButtonObject->offsetFromAncestorContainer(inputRenderBox).width(),
     291                             inputContentBox.y() + (inputContentBox.height() - cancelButtonSize + 1) / 2,
     292                             cancelButtonSize, cancelButtonSize);
     293    IntRect paintingRect = convertToPaintingRect(inputRenderBox, cancelButtonObject, cancelButtonRect, r);
    294294
    295295    static Image* cancelImage = Image::loadPlatformResource("searchCancel").leakRef();
     
    324324        return false;
    325325    RenderBox* inputRenderBox = toRenderBox(input->renderer());
    326     LayoutRect inputContentBox = inputRenderBox->contentBoxRect();
     326    IntRect inputContentBox = inputRenderBox->contentBoxRect();
    327327
    328328    // Make sure the scaled decoration stays square and will fit in its parent's box.
    329     LayoutUnit magnifierSize = std::min(inputContentBox.width(), std::min<LayoutUnit>(inputContentBox.height(), r.height()));
     329    int magnifierSize = std::min(inputContentBox.width(), std::min<int>(inputContentBox.height(), r.height()));
    330330    // Calculate decoration's coordinates relative to the input element.
    331331    // Center the decoration vertically.  Round up though, so if it has to be one pixel off-center, it will
    332332    // be one pixel closer to the bottom of the field.  This tends to look better with the text.
    333     LayoutRect magnifierRect(magnifierObject->offsetFromAncestorContainer(inputRenderBox).width(),
    334                              inputContentBox.y() + (inputContentBox.height() - magnifierSize + 1) / 2,
    335                              magnifierSize, magnifierSize);
    336     LayoutRect paintingRect = convertToPaintingRect(inputRenderBox, magnifierObject, magnifierRect, r);
     333    IntRect magnifierRect(magnifierObject->offsetFromAncestorContainer(inputRenderBox).width(),
     334                          inputContentBox.y() + (inputContentBox.height() - magnifierSize + 1) / 2,
     335                          magnifierSize, magnifierSize);
     336    IntRect paintingRect = convertToPaintingRect(inputRenderBox, magnifierObject, magnifierRect, r);
    337337
    338338    static Image* magnifierImage = Image::loadPlatformResource("searchMagnifier").leakRef();
     
    359359        return false;
    360360    RenderBox* inputRenderBox = toRenderBox(input->renderer());
    361     LayoutRect inputContentBox = inputRenderBox->contentBoxRect();
     361    IntRect inputContentBox = inputRenderBox->contentBoxRect();
    362362
    363363    // Make sure the scaled decoration will fit in its parent's box.
    364     LayoutUnit magnifierHeight = std::min<LayoutUnit>(inputContentBox.height(), r.height());
    365     LayoutUnit magnifierWidth = std::min<LayoutUnit>(inputContentBox.width(), magnifierHeight * defaultSearchFieldResultsButtonWidth / defaultSearchFieldResultsDecorationSize);
    366     LayoutRect magnifierRect(magnifierObject->offsetFromAncestorContainer(inputRenderBox).width(),
    367                              inputContentBox.y() + (inputContentBox.height() - magnifierHeight + 1) / 2,
    368                              magnifierWidth, magnifierHeight);
    369     LayoutRect paintingRect = convertToPaintingRect(inputRenderBox, magnifierObject, magnifierRect, r);
     364    int magnifierHeight = std::min<int>(inputContentBox.height(), r.height());
     365    int magnifierWidth = std::min<int>(inputContentBox.width(), magnifierHeight * defaultSearchFieldResultsButtonWidth / defaultSearchFieldResultsDecorationSize);
     366    IntRect magnifierRect(magnifierObject->offsetFromAncestorContainer(inputRenderBox).width(),
     367                          inputContentBox.y() + (inputContentBox.height() - magnifierHeight + 1) / 2,
     368                          magnifierWidth, magnifierHeight);
     369    IntRect paintingRect = convertToPaintingRect(inputRenderBox, magnifierObject, magnifierRect, r);
    370370
    371371    static Image* magnifierImage = Image::loadPlatformResource("searchMagnifierResults").leakRef();
  • trunk/Source/WebCore/rendering/RenderThemeChromiumSkia.h

    r106734 r113030  
    158158    int menuListInternalPadding(RenderStyle*, int paddingType) const;
    159159    bool paintMediaButtonInternal(GraphicsContext*, const IntRect&, Image*);
    160     LayoutRect convertToPaintingRect(RenderObject* inputRenderer, const RenderObject* partRenderer, LayoutRect partRect, const IntRect& localOffset) const;
     160    IntRect convertToPaintingRect(RenderObject* inputRenderer, const RenderObject* partRenderer, IntRect partRect, const IntRect& localOffset) const;
    161161};
    162162
  • trunk/Source/WebCore/rendering/RenderThemeMac.h

    r110560 r113030  
    4646    virtual bool supportsControlTints() const { return true; }
    4747
    48     virtual void adjustRepaintRect(const RenderObject*, LayoutRect&);
     48    virtual void adjustRepaintRect(const RenderObject*, IntRect&) OVERRIDE;
    4949
    5050    virtual bool isControlStyled(const RenderStyle*, const BorderData&,
     
    7575    virtual int popupInternalPaddingBottom(RenderStyle*) const;
    7676   
    77     virtual bool paintCapsLockIndicator(RenderObject*, const PaintInfo&, const LayoutRect&);
     77    virtual bool paintCapsLockIndicator(RenderObject*, const PaintInfo&, const IntRect&) OVERRIDE;
    7878
    7979    virtual bool popsMenuByArrowKeys() const OVERRIDE { return true; }
    8080
    8181#if ENABLE(METER_TAG)
    82     virtual LayoutSize meterSizeForBounds(const RenderMeter*, const LayoutRect&) const;
     82    virtual IntSize meterSizeForBounds(const RenderMeter*, const IntRect&) const OVERRIDE;
    8383    virtual bool paintMeter(RenderObject*, const PaintInfo&, const IntRect&);
    8484    virtual bool supportsMeter(ControlPart) const;
     
    172172    virtual bool usesMediaControlVolumeSlider() const;
    173173    virtual void adjustMediaSliderThumbSize(RenderStyle*) const;
    174     virtual LayoutPoint volumeSliderOffsetFromMuteButton(RenderBox*, const LayoutSize&) const;
     174    virtual IntPoint volumeSliderOffsetFromMuteButton(RenderBox*, const IntSize&) const OVERRIDE;
    175175#endif
    176176   
     
    180180    virtual String fileListNameForWidth(const FileList*, const Font&, int width, bool multipleFilesAllowed) const OVERRIDE;
    181181
    182     LayoutRect inflateRect(const LayoutRect&, const IntSize&, const int* margins, float zoomLevel = 1.0f) const;
     182    IntRect inflateRect(const IntRect&, const IntSize&, const int* margins, float zoomLevel = 1.0f) const;
    183183
    184184    FloatRect convertToPaintingRect(const RenderObject* inputRenderer, const RenderObject* partRenderer, const FloatRect& inputRect, const IntRect& r) const;
     
    187187    NSControlSize controlSizeForFont(RenderStyle*) const;
    188188    NSControlSize controlSizeForSystemFont(RenderStyle*) const;
    189     void setControlSize(NSCell*, const IntSize* sizes, const LayoutSize& minSize, float zoomLevel = 1.0f);
     189    void setControlSize(NSCell*, const IntSize* sizes, const IntSize& minSize, float zoomLevel = 1.0f);
    190190    void setSizeFromFont(RenderStyle*, const IntSize* sizes) const;
    191191    IntSize sizeForFont(RenderStyle*, const IntSize* sizes) const;
     
    202202    // Helpers for adjusting appearance and for painting
    203203
    204     void setPopupButtonCellState(const RenderObject*, const LayoutRect&);
     204    void setPopupButtonCellState(const RenderObject*, const IntRect&);
    205205    const IntSize* popupButtonSizes() const;
    206206    const int* popupButtonMargins() const;
  • trunk/Source/WebCore/rendering/RenderThemeMac.mm

    r112301 r113030  
    503503}
    504504
    505 void RenderThemeMac::adjustRepaintRect(const RenderObject* o, LayoutRect& r)
     505void RenderThemeMac::adjustRepaintRect(const RenderObject* o, IntRect& r)
    506506{
    507507    ControlPart part = o->style()->appearance();
     
    534534}
    535535
    536 LayoutRect RenderThemeMac::inflateRect(const LayoutRect& r, const IntSize& size, const int* margins, float zoomLevel) const
     536IntRect RenderThemeMac::inflateRect(const IntRect& r, const IntSize& size, const int* margins, float zoomLevel) const
    537537{
    538538    // Only do the inflation if the available width/height are too small.  Otherwise try to
    539539    // fit the glow/check space into the available box's width/height.
    540     LayoutUnit widthDelta = r.width() - (size.width() + margins[leftMargin] * zoomLevel + margins[rightMargin] * zoomLevel);
    541     LayoutUnit heightDelta = r.height() - (size.height() + margins[topMargin] * zoomLevel + margins[bottomMargin] * zoomLevel);
    542     LayoutRect result(r);
     540    int widthDelta = r.width() - (size.width() + margins[leftMargin] * zoomLevel + margins[rightMargin] * zoomLevel);
     541    int heightDelta = r.height() - (size.height() + margins[topMargin] * zoomLevel + margins[bottomMargin] * zoomLevel);
     542    IntRect result(r);
    543543    if (widthDelta < 0) {
    544544        result.setX(result.x() - margins[leftMargin] * zoomLevel);
     
    561561    while (renderer && renderer != inputRenderer) {
    562562        RenderObject* containingRenderer = renderer->container();
    563         offsetFromInputRenderer -= renderer->offsetFromContainer(containingRenderer, LayoutPoint());
     563        offsetFromInputRenderer -= roundedIntSize(renderer->offsetFromContainer(containingRenderer, LayoutPoint()));
    564564        renderer = containingRenderer;
    565565    }
     
    642642}
    643643
    644 void RenderThemeMac::setControlSize(NSCell* cell, const IntSize* sizes, const LayoutSize& minSize, float zoomLevel)
     644void RenderThemeMac::setControlSize(NSCell* cell, const IntSize* sizes, const IntSize& minSize, float zoomLevel)
    645645{
    646646    NSControlSize size;
    647     if (minSize.width() >= static_cast<LayoutUnit>(sizes[NSRegularControlSize].width() * zoomLevel) &&
    648         minSize.height() >= static_cast<LayoutUnit>(sizes[NSRegularControlSize].height() * zoomLevel))
     647    if (minSize.width() >= static_cast<int>(sizes[NSRegularControlSize].width() * zoomLevel) &&
     648        minSize.height() >= static_cast<int>(sizes[NSRegularControlSize].height() * zoomLevel))
    649649        size = NSRegularControlSize;
    650     else if (minSize.width() >= static_cast<LayoutUnit>(sizes[NSSmallControlSize].width() * zoomLevel) &&
    651              minSize.height() >= static_cast<LayoutUnit>(sizes[NSSmallControlSize].height() * zoomLevel))
     650    else if (minSize.width() >= static_cast<int>(sizes[NSSmallControlSize].width() * zoomLevel) &&
     651             minSize.height() >= static_cast<int>(sizes[NSSmallControlSize].height() * zoomLevel))
    652652        size = NSSmallControlSize;
    653653    else
     
    732732}
    733733
    734 bool RenderThemeMac::paintCapsLockIndicator(RenderObject*, const PaintInfo& paintInfo, const LayoutRect& r)
     734bool RenderThemeMac::paintCapsLockIndicator(RenderObject*, const PaintInfo& paintInfo, const IntRect& r)
    735735{
    736736    if (paintInfo.context->paintingDisabled())
     
    795795
    796796    // Now inflate it to account for the shadow.
    797     LayoutRect inflatedRect = r;
     797    IntRect inflatedRect = r;
    798798    if (r.width() >= minimumMenuListSize(o->style()))
    799799        inflatedRect = inflateRect(inflatedRect, size, popupButtonMargins(), zoomLevel);
     
    820820#if ENABLE(METER_TAG)
    821821
    822 LayoutSize RenderThemeMac::meterSizeForBounds(const RenderMeter* renderMeter, const LayoutRect& bounds) const
     822IntSize RenderThemeMac::meterSizeForBounds(const RenderMeter* renderMeter, const IntRect& bounds) const
    823823{
    824824    if (NoControlPart == renderMeter->style()->appearance())
     
    827827    NSLevelIndicatorCell* cell = levelIndicatorFor(renderMeter);
    828828    // Makes enough room for cell's intrinsic size.
    829     NSSize cellSize = [cell cellSizeForBounds:LayoutRect(LayoutPoint(), bounds.size())];
    830     return LayoutSize(bounds.width() < cellSize.width ? cellSize.width : bounds.width(),
    831                       bounds.height() < cellSize.height ? cellSize.height : bounds.height());
     829    NSSize cellSize = [cell cellSizeForBounds:IntRect(IntPoint(), bounds.size())];
     830    return IntSize(bounds.width() < cellSize.width ? cellSize.width : bounds.width(),
     831                   bounds.height() < cellSize.height ? cellSize.height : bounds.height());
    832832}
    833833
     
    12791279}
    12801280
    1281 void RenderThemeMac::setPopupButtonCellState(const RenderObject* o, const LayoutRect& r)
     1281void RenderThemeMac::setPopupButtonCellState(const RenderObject* o, const IntRect& r)
    12821282{
    12831283    NSPopUpButtonCell* popupButton = this->popupButton();
     
    15411541    // Take care of cases where the cancel button was not aligned with the right border of the input element (for e.g.
    15421542    // when speech input is enabled for the input element.
    1543     LayoutRect absBoundingBox = input->renderer()->absoluteBoundingBoxRect();
    1544     LayoutUnit absRight = absBoundingBox.x() + absBoundingBox.width() - input->renderBox()->paddingRight() - input->renderBox()->borderRight();
    1545     LayoutUnit spaceToRightOfCancelButton = absRight - (r.x() + r.width());
     1543    IntRect absBoundingBox = input->renderer()->absoluteBoundingBoxRect();
     1544    int absRight = absBoundingBox.x() + absBoundingBox.width() - input->renderBox()->paddingRight() - input->renderBox()->borderRight();
     1545    int spaceToRightOfCancelButton = absRight - (r.x() + r.width());
    15461546    localBounds.setX(localBounds.x() - spaceToRightOfCancelButton);
    15471547#endif
     
    20612061}
    20622062
    2063 LayoutPoint RenderThemeMac::volumeSliderOffsetFromMuteButton(RenderBox* muteButtonBox, const LayoutSize& size) const
     2063IntPoint RenderThemeMac::volumeSliderOffsetFromMuteButton(RenderBox* muteButtonBox, const IntSize& size) const
    20642064{
    20652065    return RenderMediaControls::volumeSliderOffsetFromMuteButton(muteButtonBox, size);
  • trunk/Source/WebCore/rendering/RenderThemeWin.cpp

    r111041 r113030  
    877877bool RenderThemeWin::paintSearchFieldCancelButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r)
    878878{
    879     LayoutRect bounds = r;
     879    IntRect bounds = r;
    880880    ASSERT(o->parent());
    881881    if (!o->parent() || !o->parent()->isBox())
     
    884884    RenderBox* parentRenderBox = toRenderBox(o->parent());
    885885
    886     LayoutRect parentBox = parentRenderBox->absoluteContentBox();
     886    IntRect parentBox = parentRenderBox->absoluteContentBox();
    887887   
    888888    // Make sure the scaled button stays square and will fit in its parent's box
     
    928928bool RenderThemeWin::paintSearchFieldResultsDecoration(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r)
    929929{
    930     LayoutRect bounds = r;
     930    IntRect bounds = r;
    931931    ASSERT(o->parent());
    932932    if (!o->parent() || !o->parent()->isBox())
     
    934934   
    935935    RenderBox* parentRenderBox = toRenderBox(o->parent());
    936     LayoutRect parentBox = parentRenderBox->absoluteContentBox();
     936    IntRect parentBox = parentRenderBox->absoluteContentBox();
    937937   
    938938    // Make sure the scaled decoration stays square and will fit in its parent's box
     
    962962bool RenderThemeWin::paintSearchFieldResultsButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r)
    963963{
    964     LayoutRect bounds = r;
     964    IntRect bounds = r;
    965965    ASSERT(o->parent());
    966966    if (!o->parent())
     
    970970   
    971971    RenderBox* parentRenderBox = toRenderBox(o->parent());
    972     LayoutRect parentBox = parentRenderBox->absoluteContentBox();
     972    IntRect parentBox = parentRenderBox->absoluteContentBox();
    973973   
    974974    // Make sure the scaled decoration will fit in its parent's box
    975975    bounds.setHeight(min(parentBox.height(), bounds.height()));
    976     bounds.setWidth(min<LayoutUnit>(parentBox.width(), bounds.height() * defaultSearchFieldResultsButtonWidth / defaultSearchFieldResultsDecorationSize));
     976    bounds.setWidth(min<int>(parentBox.width(), bounds.height() * defaultSearchFieldResultsButtonWidth / defaultSearchFieldResultsDecorationSize));
    977977
    978978    // Center the button vertically.  Round up though, so if it has to be one pixel off-center, it will
     
    11201120}
    11211121
    1122 LayoutPoint RenderThemeWin::volumeSliderOffsetFromMuteButton(RenderBox* muteButtonBox, const LayoutSize& size) const
     1122IntPoint RenderThemeWin::volumeSliderOffsetFromMuteButton(RenderBox* muteButtonBox, const IntSize& size) const
    11231123{
    11241124    return RenderMediaControls::volumeSliderOffsetFromMuteButton(muteButtonBox, size);
  • trunk/Source/WebCore/rendering/RenderThemeWin.h

    r106734 r113030  
    142142    virtual bool paintMediaVolumeSliderTrack(RenderObject*, const PaintInfo&, const IntRect&);
    143143    virtual bool paintMediaVolumeSliderThumb(RenderObject*, const PaintInfo&, const IntRect&);
    144     virtual LayoutPoint volumeSliderOffsetFromMuteButton(RenderBox*, const LayoutSize&) const;
     144    virtual IntPoint volumeSliderOffsetFromMuteButton(RenderBox*, const IntSize&) const OVERRIDE;
    145145#endif
    146146
Note: See TracChangeset for help on using the changeset viewer.