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):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@113030
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-04-03 Levi Weintraub <leviw@chromium.org>
+
+ 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):
+
2012-03-29 Joseph Pecoraro <joepeck@webkit.org> and Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
Add a Generic WebSocket Server.
FractionalLayoutPoint location() const { return m_location; }
FractionalLayoutSize size() const { return m_size; }
+ IntPoint pixelSnappedLocation() const { return roundedIntPoint(m_location); }
+ IntSize pixelSnappedSize() const { return pixelSnappedIntSize(m_size, m_location); }
+
void setLocation(const FractionalLayoutPoint& location) { m_location = location; }
void setSize(const FractionalLayoutSize& size) { m_size = size; }
int pixelSnappedMaxY() const { return y() + height(); }
int pixelSnappedWidth() const { return m_size.width(); }
int pixelSnappedHeight() const { return m_size.height(); }
+ IntPoint pixelSnappedLocation() const { return location(); }
+ IntSize pixelSnappedSize() const { return size(); }
void setX(int x) { m_location.setX(x); }
void setY(int y) { m_location.setY(y); }
layer()->updateTransform();
}
-LayoutRect RenderBox::absoluteContentBox() const
+IntRect RenderBox::absoluteContentBox() const
{
- LayoutRect rect = contentBoxRect();
+ IntRect rect = pixelSnappedIntRect(contentBoxRect());
FloatPoint absPos = localToAbsolute(FloatPoint());
rect.move(absPos.x(), absPos.y());
return rect;
// If we have a native theme appearance, paint that before painting our background.
// The theme will tell us whether or not we should also paint the CSS background.
- bool themePainted = style()->hasAppearance() && !theme()->paint(this, paintInfo, paintRect);
+ IntRect snappedPaintRect(pixelSnappedIntRect(paintRect));
+ bool themePainted = style()->hasAppearance() && !theme()->paint(this, paintInfo, snappedPaintRect);
if (!themePainted) {
paintBackground(paintInfo, paintRect, bleedAvoidance);
if (style()->hasAppearance())
- theme()->paintDecorations(this, paintInfo, pixelSnappedIntRect(paintRect));
+ theme()->paintDecorations(this, paintInfo, snappedPaintRect);
}
paintBoxShadow(paintInfo, paintRect, style(), Inset);
// The theme will tell us whether or not we should also paint the CSS border.
- if ((!style()->hasAppearance() || (!themePainted && theme()->paintBorderOnly(this, paintInfo, pixelSnappedIntRect(paintRect)))) && style()->hasBorder())
+ if ((!style()->hasAppearance() || (!themePainted && theme()->paintBorderOnly(this, paintInfo, snappedPaintRect))) && style()->hasBorder())
paintBorder(paintInfo, paintRect, style(), bleedAvoidance);
if (bleedAvoidance == BackgroundBleedUseTransparencyLayer)
LayoutPoint location() const { return m_frameRect.location(); }
LayoutSize locationOffset() const { return LayoutSize(x(), y()); }
LayoutSize size() const { return m_frameRect.size(); }
+ IntSize pixelSnappedSize() const { return m_frameRect.pixelSnappedSize(); }
void setLocation(const LayoutPoint& location) { m_frameRect.setLocation(location); }
// The content area of the box (excludes padding and border).
LayoutRect contentBoxRect(PaddingOptions paddingOption = ExcludeIntrinsicPadding) const { return LayoutRect(borderLeft() + paddingLeft(paddingOption), borderTop() + paddingTop(paddingOption), contentWidth(paddingOption), contentHeight(paddingOption)); }
// The content box in absolute coords. Ignores transforms.
- LayoutRect absoluteContentBox() const;
+ IntRect absoluteContentBox() const;
// The content box converted to absolute coords (taking transforms into account).
FloatQuad absoluteContentQuad() const;
static const int yOffset = 5;
float zoomLevel = muteButtonBox->style()->effectiveZoom();
- int y = yOffset * zoomLevel + muteButtonBox->offsetHeight() - size.height();
- FloatPoint absPoint = muteButtonBox->localToAbsolute(FloatPoint(muteButtonBox->offsetLeft(), y), true, true);
+ int y = yOffset * zoomLevel + muteButtonBox->pixelSnappedOffsetHeight() - size.height();
+ FloatPoint absPoint = muteButtonBox->localToAbsolute(FloatPoint(muteButtonBox->pixelSnappedOffsetLeft(), y), true, true);
if (absPoint.y() < 0)
- y = muteButtonBox->height();
+ y = muteButtonBox->pixelSnappedHeight();
return IntPoint(xOffset * zoomLevel, y);
}
void RenderMeter::computeLogicalWidth()
{
RenderBox::computeLogicalWidth();
- setWidth(theme()->meterSizeForBounds(this, frameRect()).width());
+ setWidth(theme()->meterSizeForBounds(this, pixelSnappedIntRect(frameRect())).width());
}
void RenderMeter::computeLogicalHeight()
{
RenderBox::computeLogicalHeight();
- setHeight(theme()->meterSizeForBounds(this, frameRect()).height());
+ setHeight(theme()->meterSizeForBounds(this, pixelSnappedIntRect(frameRect())).height());
}
double RenderMeter::valueRatio() const
}
}
-bool RenderTheme::paint(RenderObject* o, const PaintInfo& paintInfo, const LayoutRect& r)
+bool RenderTheme::paint(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r)
{
// If painting is disabled, but we aren't updating control tints, then just bail.
// If we are updating control tints, just schedule a repaint if the theme supports tinting
return formatMediaControlsTime(currentTime - duration);
}
-LayoutPoint RenderTheme::volumeSliderOffsetFromMuteButton(RenderBox* muteButtonBox, const LayoutSize& size) const
+IntPoint RenderTheme::volumeSliderOffsetFromMuteButton(RenderBox* muteButtonBox, const IntSize& size) const
{
- LayoutUnit y = -size.height();
+ int y = -size.height();
FloatPoint absPoint = muteButtonBox->localToAbsolute(FloatPoint(muteButtonBox->pixelSnappedOffsetLeft(), y), true, true);
if (absPoint.y() < 0)
y = muteButtonBox->height();
- return LayoutPoint(0, y);
+ return IntPoint(0, y);
}
#endif
}
}
-void RenderTheme::adjustRepaintRect(const RenderObject* o, LayoutRect& r)
+void RenderTheme::adjustRepaintRect(const RenderObject* o, IntRect& r)
{
#if USE(NEW_THEME)
m_theme->inflateControlPaintRect(o->style()->appearance(), controlStatesForRenderer(o), r, o->style()->effectiveZoom());
style->setBoxShadow(nullptr);
}
-LayoutSize RenderTheme::meterSizeForBounds(const RenderMeter*, const LayoutRect& bounds) const
+IntSize RenderTheme::meterSizeForBounds(const RenderMeter*, const IntRect& bounds) const
{
return bounds.size();
}
// This method is called to paint the widget as a background of the RenderObject. A widget's foreground, e.g., the
// text of a button, is always rendered by the engine itself. The boolean return value indicates
// whether the CSS border/background should also be painted.
- bool paint(RenderObject*, const PaintInfo&, const LayoutRect&);
+ bool paint(RenderObject*, const PaintInfo&, const IntRect&);
bool paintBorderOnly(RenderObject*, const PaintInfo&, const IntRect&);
bool paintDecorations(RenderObject*, const PaintInfo&, const IntRect&);
// Some controls may spill out of their containers (e.g., the check on an OS X checkbox). When these controls repaint,
// the theme needs to communicate this inflated rect to the engine so that it can invalidate the whole control.
- virtual void adjustRepaintRect(const RenderObject*, LayoutRect&);
+ virtual void adjustRepaintRect(const RenderObject*, IntRect&);
// This method is called whenever a relevant state changes on a particular themed object, e.g., the mouse becomes pressed
// or a control becomes disabled.
virtual ScrollbarControlSize scrollbarControlSizeForPart(ControlPart) { return RegularScrollbar; }
// Method for painting the caps lock indicator
- virtual bool paintCapsLockIndicator(RenderObject*, const PaintInfo&, const LayoutRect&) { return 0; };
+ virtual bool paintCapsLockIndicator(RenderObject*, const PaintInfo&, const IntRect&) { return 0; };
#if ENABLE(PROGRESS_TAG)
// Returns the repeat interval of the animation for the progress bar.
virtual String formatMediaControlsRemainingTime(float currentTime, float duration) const;
// Returns the media volume slider container's offset from the mute button.
- virtual LayoutPoint volumeSliderOffsetFromMuteButton(RenderBox*, const LayoutSize&) const;
+ virtual IntPoint volumeSliderOffsetFromMuteButton(RenderBox*, const IntSize&) const;
#endif
#if ENABLE(METER_TAG)
- virtual LayoutSize meterSizeForBounds(const RenderMeter*, const LayoutRect&) const;
+ virtual IntSize meterSizeForBounds(const RenderMeter*, const IntRect&) const;
virtual bool supportsMeter(ControlPart) const;
#endif
virtual bool paintMediaVolumeSliderContainer(RenderObject*, const PaintInfo&, const IntRect&);
virtual bool paintMediaVolumeSliderTrack(RenderObject*, const PaintInfo&, const IntRect&);
virtual bool paintMediaVolumeSliderThumb(RenderObject*, const PaintInfo&, const IntRect&);
- virtual LayoutPoint volumeSliderOffsetFromMuteButton(RenderBox*, const LayoutSize&) const;
+ virtual IntPoint volumeSliderOffsetFromMuteButton(RenderBox*, const IntSize&) const OVERRIDE;
virtual bool usesMediaControlStatusDisplay() { return false; }
virtual bool hasOwnDisabledStateHandlingFor(ControlPart) const { return true; }
#endif
return RenderMediaControlsChromium::paintMediaControlsPart(MediaSliderThumb, object, paintInfo, rect);
}
-LayoutPoint RenderThemeChromiumMac::volumeSliderOffsetFromMuteButton(RenderBox* muteButtonBox, const LayoutSize& size) const
+IntPoint RenderThemeChromiumMac::volumeSliderOffsetFromMuteButton(RenderBox* muteButtonBox, const IntSize& size) const
{
return RenderTheme::volumeSliderOffsetFromMuteButton(muteButtonBox, size);
}
style->setHeight(Length(cancelButtonSize, Fixed));
}
-LayoutRect RenderThemeChromiumSkia::convertToPaintingRect(RenderObject* inputRenderer, const RenderObject* partRenderer, LayoutRect partRect, const IntRect& localOffset) const
+IntRect RenderThemeChromiumSkia::convertToPaintingRect(RenderObject* inputRenderer, const RenderObject* partRenderer, IntRect partRect, const IntRect& localOffset) const
{
// Compute an offset between the part renderer and the input renderer.
- LayoutSize offsetFromInputRenderer = -(partRenderer->offsetFromAncestorContainer(inputRenderer));
+ IntSize offsetFromInputRenderer = -(partRenderer->offsetFromAncestorContainer(inputRenderer));
// Move the rect into partRenderer's coords.
partRect.move(offsetFromInputRenderer);
// Account for the local drawing offset.
if (!input->renderer()->isBox())
return false;
RenderBox* inputRenderBox = toRenderBox(input->renderer());
- LayoutRect inputContentBox = inputRenderBox->contentBoxRect();
+ IntRect inputContentBox = inputRenderBox->contentBoxRect();
// Make sure the scaled button stays square and will fit in its parent's box.
- LayoutUnit cancelButtonSize = std::min(inputContentBox.width(), std::min<LayoutUnit>(inputContentBox.height(), r.height()));
+ int cancelButtonSize = std::min(inputContentBox.width(), std::min<int>(inputContentBox.height(), r.height()));
// Calculate cancel button's coordinates relative to the input element.
// Center the button vertically. Round up though, so if it has to be one pixel off-center, it will
// be one pixel closer to the bottom of the field. This tends to look better with the text.
- LayoutRect cancelButtonRect(cancelButtonObject->offsetFromAncestorContainer(inputRenderBox).width(),
- inputContentBox.y() + (inputContentBox.height() - cancelButtonSize + 1) / 2,
- cancelButtonSize, cancelButtonSize);
- LayoutRect paintingRect = convertToPaintingRect(inputRenderBox, cancelButtonObject, cancelButtonRect, r);
+ IntRect cancelButtonRect(cancelButtonObject->offsetFromAncestorContainer(inputRenderBox).width(),
+ inputContentBox.y() + (inputContentBox.height() - cancelButtonSize + 1) / 2,
+ cancelButtonSize, cancelButtonSize);
+ IntRect paintingRect = convertToPaintingRect(inputRenderBox, cancelButtonObject, cancelButtonRect, r);
static Image* cancelImage = Image::loadPlatformResource("searchCancel").leakRef();
static Image* cancelPressedImage = Image::loadPlatformResource("searchCancelPressed").leakRef();
if (!input->renderer()->isBox())
return false;
RenderBox* inputRenderBox = toRenderBox(input->renderer());
- LayoutRect inputContentBox = inputRenderBox->contentBoxRect();
+ IntRect inputContentBox = inputRenderBox->contentBoxRect();
// Make sure the scaled decoration stays square and will fit in its parent's box.
- LayoutUnit magnifierSize = std::min(inputContentBox.width(), std::min<LayoutUnit>(inputContentBox.height(), r.height()));
+ int magnifierSize = std::min(inputContentBox.width(), std::min<int>(inputContentBox.height(), r.height()));
// Calculate decoration's coordinates relative to the input element.
// Center the decoration vertically. Round up though, so if it has to be one pixel off-center, it will
// be one pixel closer to the bottom of the field. This tends to look better with the text.
- LayoutRect magnifierRect(magnifierObject->offsetFromAncestorContainer(inputRenderBox).width(),
- inputContentBox.y() + (inputContentBox.height() - magnifierSize + 1) / 2,
- magnifierSize, magnifierSize);
- LayoutRect paintingRect = convertToPaintingRect(inputRenderBox, magnifierObject, magnifierRect, r);
+ IntRect magnifierRect(magnifierObject->offsetFromAncestorContainer(inputRenderBox).width(),
+ inputContentBox.y() + (inputContentBox.height() - magnifierSize + 1) / 2,
+ magnifierSize, magnifierSize);
+ IntRect paintingRect = convertToPaintingRect(inputRenderBox, magnifierObject, magnifierRect, r);
static Image* magnifierImage = Image::loadPlatformResource("searchMagnifier").leakRef();
paintInfo.context->drawImage(magnifierImage, magnifierObject->style()->colorSpace(), paintingRect);
if (!input->renderer()->isBox())
return false;
RenderBox* inputRenderBox = toRenderBox(input->renderer());
- LayoutRect inputContentBox = inputRenderBox->contentBoxRect();
+ IntRect inputContentBox = inputRenderBox->contentBoxRect();
// Make sure the scaled decoration will fit in its parent's box.
- LayoutUnit magnifierHeight = std::min<LayoutUnit>(inputContentBox.height(), r.height());
- LayoutUnit magnifierWidth = std::min<LayoutUnit>(inputContentBox.width(), magnifierHeight * defaultSearchFieldResultsButtonWidth / defaultSearchFieldResultsDecorationSize);
- LayoutRect magnifierRect(magnifierObject->offsetFromAncestorContainer(inputRenderBox).width(),
- inputContentBox.y() + (inputContentBox.height() - magnifierHeight + 1) / 2,
- magnifierWidth, magnifierHeight);
- LayoutRect paintingRect = convertToPaintingRect(inputRenderBox, magnifierObject, magnifierRect, r);
+ int magnifierHeight = std::min<int>(inputContentBox.height(), r.height());
+ int magnifierWidth = std::min<int>(inputContentBox.width(), magnifierHeight * defaultSearchFieldResultsButtonWidth / defaultSearchFieldResultsDecorationSize);
+ IntRect magnifierRect(magnifierObject->offsetFromAncestorContainer(inputRenderBox).width(),
+ inputContentBox.y() + (inputContentBox.height() - magnifierHeight + 1) / 2,
+ magnifierWidth, magnifierHeight);
+ IntRect paintingRect = convertToPaintingRect(inputRenderBox, magnifierObject, magnifierRect, r);
static Image* magnifierImage = Image::loadPlatformResource("searchMagnifierResults").leakRef();
paintInfo.context->drawImage(magnifierImage, magnifierObject->style()->colorSpace(), paintingRect);
int menuListInternalPadding(RenderStyle*, int paddingType) const;
bool paintMediaButtonInternal(GraphicsContext*, const IntRect&, Image*);
- LayoutRect convertToPaintingRect(RenderObject* inputRenderer, const RenderObject* partRenderer, LayoutRect partRect, const IntRect& localOffset) const;
+ IntRect convertToPaintingRect(RenderObject* inputRenderer, const RenderObject* partRenderer, IntRect partRect, const IntRect& localOffset) const;
};
} // namespace WebCore
// A general method asking if any control tinting is supported at all.
virtual bool supportsControlTints() const { return true; }
- virtual void adjustRepaintRect(const RenderObject*, LayoutRect&);
+ virtual void adjustRepaintRect(const RenderObject*, IntRect&) OVERRIDE;
virtual bool isControlStyled(const RenderStyle*, const BorderData&,
const FillLayer&, const Color& backgroundColor) const;
virtual int popupInternalPaddingTop(RenderStyle*) const;
virtual int popupInternalPaddingBottom(RenderStyle*) const;
- virtual bool paintCapsLockIndicator(RenderObject*, const PaintInfo&, const LayoutRect&);
+ virtual bool paintCapsLockIndicator(RenderObject*, const PaintInfo&, const IntRect&) OVERRIDE;
virtual bool popsMenuByArrowKeys() const OVERRIDE { return true; }
#if ENABLE(METER_TAG)
- virtual LayoutSize meterSizeForBounds(const RenderMeter*, const LayoutRect&) const;
+ virtual IntSize meterSizeForBounds(const RenderMeter*, const IntRect&) const OVERRIDE;
virtual bool paintMeter(RenderObject*, const PaintInfo&, const IntRect&);
virtual bool supportsMeter(ControlPart) const;
#endif
virtual bool usesMediaControlStatusDisplay();
virtual bool usesMediaControlVolumeSlider() const;
virtual void adjustMediaSliderThumbSize(RenderStyle*) const;
- virtual LayoutPoint volumeSliderOffsetFromMuteButton(RenderBox*, const LayoutSize&) const;
+ virtual IntPoint volumeSliderOffsetFromMuteButton(RenderBox*, const IntSize&) const OVERRIDE;
#endif
virtual bool shouldShowPlaceholderWhenFocused() const;
private:
virtual String fileListNameForWidth(const FileList*, const Font&, int width, bool multipleFilesAllowed) const OVERRIDE;
- LayoutRect inflateRect(const LayoutRect&, const IntSize&, const int* margins, float zoomLevel = 1.0f) const;
+ IntRect inflateRect(const IntRect&, const IntSize&, const int* margins, float zoomLevel = 1.0f) const;
FloatRect convertToPaintingRect(const RenderObject* inputRenderer, const RenderObject* partRenderer, const FloatRect& inputRect, const IntRect& r) const;
// Get the control size based off the font. Used by some of the controls (like buttons).
NSControlSize controlSizeForFont(RenderStyle*) const;
NSControlSize controlSizeForSystemFont(RenderStyle*) const;
- void setControlSize(NSCell*, const IntSize* sizes, const LayoutSize& minSize, float zoomLevel = 1.0f);
+ void setControlSize(NSCell*, const IntSize* sizes, const IntSize& minSize, float zoomLevel = 1.0f);
void setSizeFromFont(RenderStyle*, const IntSize* sizes) const;
IntSize sizeForFont(RenderStyle*, const IntSize* sizes) const;
IntSize sizeForSystemFont(RenderStyle*, const IntSize* sizes) const;
// Helpers for adjusting appearance and for painting
- void setPopupButtonCellState(const RenderObject*, const LayoutRect&);
+ void setPopupButtonCellState(const RenderObject*, const IntRect&);
const IntSize* popupButtonSizes() const;
const int* popupButtonMargins() const;
const int* popupButtonPadding(NSControlSize) const;
return RenderTheme::isControlStyled(style, border, background, backgroundColor);
}
-void RenderThemeMac::adjustRepaintRect(const RenderObject* o, LayoutRect& r)
+void RenderThemeMac::adjustRepaintRect(const RenderObject* o, IntRect& r)
{
ControlPart part = o->style()->appearance();
}
}
-LayoutRect RenderThemeMac::inflateRect(const LayoutRect& r, const IntSize& size, const int* margins, float zoomLevel) const
+IntRect RenderThemeMac::inflateRect(const IntRect& r, const IntSize& size, const int* margins, float zoomLevel) const
{
// Only do the inflation if the available width/height are too small. Otherwise try to
// fit the glow/check space into the available box's width/height.
- LayoutUnit widthDelta = r.width() - (size.width() + margins[leftMargin] * zoomLevel + margins[rightMargin] * zoomLevel);
- LayoutUnit heightDelta = r.height() - (size.height() + margins[topMargin] * zoomLevel + margins[bottomMargin] * zoomLevel);
- LayoutRect result(r);
+ int widthDelta = r.width() - (size.width() + margins[leftMargin] * zoomLevel + margins[rightMargin] * zoomLevel);
+ int heightDelta = r.height() - (size.height() + margins[topMargin] * zoomLevel + margins[bottomMargin] * zoomLevel);
+ IntRect result(r);
if (widthDelta < 0) {
result.setX(result.x() - margins[leftMargin] * zoomLevel);
result.setWidth(result.width() - widthDelta);
const RenderObject* renderer = partRenderer;
while (renderer && renderer != inputRenderer) {
RenderObject* containingRenderer = renderer->container();
- offsetFromInputRenderer -= renderer->offsetFromContainer(containingRenderer, LayoutPoint());
+ offsetFromInputRenderer -= roundedIntSize(renderer->offsetFromContainer(containingRenderer, LayoutPoint()));
renderer = containingRenderer;
}
// If the input renderer was not a container, something went wrong
return NSMiniControlSize;
}
-void RenderThemeMac::setControlSize(NSCell* cell, const IntSize* sizes, const LayoutSize& minSize, float zoomLevel)
+void RenderThemeMac::setControlSize(NSCell* cell, const IntSize* sizes, const IntSize& minSize, float zoomLevel)
{
NSControlSize size;
- if (minSize.width() >= static_cast<LayoutUnit>(sizes[NSRegularControlSize].width() * zoomLevel) &&
- minSize.height() >= static_cast<LayoutUnit>(sizes[NSRegularControlSize].height() * zoomLevel))
+ if (minSize.width() >= static_cast<int>(sizes[NSRegularControlSize].width() * zoomLevel) &&
+ minSize.height() >= static_cast<int>(sizes[NSRegularControlSize].height() * zoomLevel))
size = NSRegularControlSize;
- else if (minSize.width() >= static_cast<LayoutUnit>(sizes[NSSmallControlSize].width() * zoomLevel) &&
- minSize.height() >= static_cast<LayoutUnit>(sizes[NSSmallControlSize].height() * zoomLevel))
+ else if (minSize.width() >= static_cast<int>(sizes[NSSmallControlSize].width() * zoomLevel) &&
+ minSize.height() >= static_cast<int>(sizes[NSSmallControlSize].height() * zoomLevel))
size = NSSmallControlSize;
else
size = NSMiniControlSize;
{
}
-bool RenderThemeMac::paintCapsLockIndicator(RenderObject*, const PaintInfo& paintInfo, const LayoutRect& r)
+bool RenderThemeMac::paintCapsLockIndicator(RenderObject*, const PaintInfo& paintInfo, const IntRect& r)
{
if (paintInfo.context->paintingDisabled())
return true;
size.setWidth(r.width());
// Now inflate it to account for the shadow.
- LayoutRect inflatedRect = r;
+ IntRect inflatedRect = r;
if (r.width() >= minimumMenuListSize(o->style()))
inflatedRect = inflateRect(inflatedRect, size, popupButtonMargins(), zoomLevel);
#if ENABLE(METER_TAG)
-LayoutSize RenderThemeMac::meterSizeForBounds(const RenderMeter* renderMeter, const LayoutRect& bounds) const
+IntSize RenderThemeMac::meterSizeForBounds(const RenderMeter* renderMeter, const IntRect& bounds) const
{
if (NoControlPart == renderMeter->style()->appearance())
return bounds.size();
NSLevelIndicatorCell* cell = levelIndicatorFor(renderMeter);
// Makes enough room for cell's intrinsic size.
- NSSize cellSize = [cell cellSizeForBounds:LayoutRect(LayoutPoint(), bounds.size())];
- return LayoutSize(bounds.width() < cellSize.width ? cellSize.width : bounds.width(),
- bounds.height() < cellSize.height ? cellSize.height : bounds.height());
+ NSSize cellSize = [cell cellSizeForBounds:IntRect(IntPoint(), bounds.size())];
+ return IntSize(bounds.width() < cellSize.width ? cellSize.width : bounds.width(),
+ bounds.height() < cellSize.height ? cellSize.height : bounds.height());
}
bool RenderThemeMac::paintMeter(RenderObject* renderObject, const PaintInfo& paintInfo, const IntRect& rect)
style->setLineHeight(RenderStyle::initialLineHeight());
}
-void RenderThemeMac::setPopupButtonCellState(const RenderObject* o, const LayoutRect& r)
+void RenderThemeMac::setPopupButtonCellState(const RenderObject* o, const IntRect& r)
{
NSPopUpButtonCell* popupButton = this->popupButton();
#if ENABLE(INPUT_SPEECH)
// Take care of cases where the cancel button was not aligned with the right border of the input element (for e.g.
// when speech input is enabled for the input element.
- LayoutRect absBoundingBox = input->renderer()->absoluteBoundingBoxRect();
- LayoutUnit absRight = absBoundingBox.x() + absBoundingBox.width() - input->renderBox()->paddingRight() - input->renderBox()->borderRight();
- LayoutUnit spaceToRightOfCancelButton = absRight - (r.x() + r.width());
+ IntRect absBoundingBox = input->renderer()->absoluteBoundingBoxRect();
+ int absRight = absBoundingBox.x() + absBoundingBox.width() - input->renderBox()->paddingRight() - input->renderBox()->borderRight();
+ int spaceToRightOfCancelButton = absRight - (r.x() + r.width());
localBounds.setX(localBounds.x() - spaceToRightOfCancelButton);
#endif
return mediaControllerTheme() == MediaControllerThemeQuickTime;
}
-LayoutPoint RenderThemeMac::volumeSliderOffsetFromMuteButton(RenderBox* muteButtonBox, const LayoutSize& size) const
+IntPoint RenderThemeMac::volumeSliderOffsetFromMuteButton(RenderBox* muteButtonBox, const IntSize& size) const
{
return RenderMediaControls::volumeSliderOffsetFromMuteButton(muteButtonBox, size);
}
bool RenderThemeWin::paintSearchFieldCancelButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r)
{
- LayoutRect bounds = r;
+ IntRect bounds = r;
ASSERT(o->parent());
if (!o->parent() || !o->parent()->isBox())
return false;
RenderBox* parentRenderBox = toRenderBox(o->parent());
- LayoutRect parentBox = parentRenderBox->absoluteContentBox();
+ IntRect parentBox = parentRenderBox->absoluteContentBox();
// Make sure the scaled button stays square and will fit in its parent's box
bounds.setHeight(min(parentBox.width(), min(parentBox.height(), bounds.height())));
bool RenderThemeWin::paintSearchFieldResultsDecoration(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r)
{
- LayoutRect bounds = r;
+ IntRect bounds = r;
ASSERT(o->parent());
if (!o->parent() || !o->parent()->isBox())
return false;
RenderBox* parentRenderBox = toRenderBox(o->parent());
- LayoutRect parentBox = parentRenderBox->absoluteContentBox();
+ IntRect parentBox = parentRenderBox->absoluteContentBox();
// Make sure the scaled decoration stays square and will fit in its parent's box
bounds.setHeight(min(parentBox.width(), min(parentBox.height(), bounds.height())));
bool RenderThemeWin::paintSearchFieldResultsButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r)
{
- LayoutRect bounds = r;
+ IntRect bounds = r;
ASSERT(o->parent());
if (!o->parent())
return false;
return false;
RenderBox* parentRenderBox = toRenderBox(o->parent());
- LayoutRect parentBox = parentRenderBox->absoluteContentBox();
+ IntRect parentBox = parentRenderBox->absoluteContentBox();
// Make sure the scaled decoration will fit in its parent's box
bounds.setHeight(min(parentBox.height(), bounds.height()));
- bounds.setWidth(min<LayoutUnit>(parentBox.width(), bounds.height() * defaultSearchFieldResultsButtonWidth / defaultSearchFieldResultsDecorationSize));
+ bounds.setWidth(min<int>(parentBox.width(), bounds.height() * defaultSearchFieldResultsButtonWidth / defaultSearchFieldResultsDecorationSize));
// Center the button vertically. Round up though, so if it has to be one pixel off-center, it will
// be one pixel closer to the bottom of the field. This tends to look better with the text.
return RenderMediaControls::paintMediaControlsPart(MediaVolumeSliderThumb, o, paintInfo, r);
}
-LayoutPoint RenderThemeWin::volumeSliderOffsetFromMuteButton(RenderBox* muteButtonBox, const LayoutSize& size) const
+IntPoint RenderThemeWin::volumeSliderOffsetFromMuteButton(RenderBox* muteButtonBox, const IntSize& size) const
{
return RenderMediaControls::volumeSliderOffsetFromMuteButton(muteButtonBox, size);
}
virtual bool paintMediaVolumeSliderContainer(RenderObject*, const PaintInfo&, const IntRect&);
virtual bool paintMediaVolumeSliderTrack(RenderObject*, const PaintInfo&, const IntRect&);
virtual bool paintMediaVolumeSliderThumb(RenderObject*, const PaintInfo&, const IntRect&);
- virtual LayoutPoint volumeSliderOffsetFromMuteButton(RenderBox*, const LayoutSize&) const;
+ virtual IntPoint volumeSliderOffsetFromMuteButton(RenderBox*, const IntSize&) const OVERRIDE;
#endif
virtual bool shouldShowPlaceholderWhenFocused() const { return true; }