Changeset 113030 in webkit
- Timestamp:
- Apr 3, 2012 6:55:52 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r113026 r113030 1 2012-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 1 78 2012-03-29 Joseph Pecoraro <joepeck@webkit.org> and Jocelyn Turcotte <jocelyn.turcotte@nokia.com> 2 79 -
trunk/Source/WebCore/platform/graphics/FractionalLayoutRect.h
r109835 r113030 55 55 FractionalLayoutPoint location() const { return m_location; } 56 56 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); } 57 60 58 61 void setLocation(const FractionalLayoutPoint& location) { m_location = location; } -
trunk/Source/WebCore/platform/graphics/IntRect.h
r111185 r113030 112 112 int pixelSnappedWidth() const { return m_size.width(); } 113 113 int pixelSnappedHeight() const { return m_size.height(); } 114 IntPoint pixelSnappedLocation() const { return location(); } 115 IntSize pixelSnappedSize() const { return size(); } 114 116 115 117 void setX(int x) { m_location.setX(x); } -
trunk/Source/WebCore/rendering/RenderBox.cpp
r112749 r113030 555 555 } 556 556 557 LayoutRect RenderBox::absoluteContentBox() const558 { 559 LayoutRect rect = contentBoxRect();557 IntRect RenderBox::absoluteContentBox() const 558 { 559 IntRect rect = pixelSnappedIntRect(contentBoxRect()); 560 560 FloatPoint absPos = localToAbsolute(FloatPoint()); 561 561 rect.move(absPos.x(), absPos.y()); … … 1001 1001 // If we have a native theme appearance, paint that before painting our background. 1002 1002 // 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); 1004 1005 if (!themePainted) { 1005 1006 paintBackground(paintInfo, paintRect, bleedAvoidance); 1006 1007 1007 1008 if (style()->hasAppearance()) 1008 theme()->paintDecorations(this, paintInfo, pixelSnappedIntRect(paintRect));1009 theme()->paintDecorations(this, paintInfo, snappedPaintRect); 1009 1010 } 1010 1011 paintBoxShadow(paintInfo, paintRect, style(), Inset); 1011 1012 1012 1013 // 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()) 1014 1015 paintBorder(paintInfo, paintRect, style(), bleedAvoidance); 1015 1016 -
trunk/Source/WebCore/rendering/RenderBox.h
r112758 r113030 124 124 LayoutSize locationOffset() const { return LayoutSize(x(), y()); } 125 125 LayoutSize size() const { return m_frameRect.size(); } 126 IntSize pixelSnappedSize() const { return m_frameRect.pixelSnappedSize(); } 126 127 127 128 void setLocation(const LayoutPoint& location) { m_frameRect.setLocation(location); } … … 140 141 LayoutRect contentBoxRect(PaddingOptions paddingOption = ExcludeIntrinsicPadding) const { return LayoutRect(borderLeft() + paddingLeft(paddingOption), borderTop() + paddingTop(paddingOption), contentWidth(paddingOption), contentHeight(paddingOption)); } 141 142 // The content box in absolute coords. Ignores transforms. 142 LayoutRect absoluteContentBox() const;143 IntRect absoluteContentBox() const; 143 144 // The content box converted to absolute coords (taking transforms into account). 144 145 FloatQuad absoluteContentQuad() const; -
trunk/Source/WebCore/rendering/RenderMediaControls.cpp
r111041 r113030 213 213 214 214 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); 217 217 if (absPoint.y() < 0) 218 y = muteButtonBox-> height();218 y = muteButtonBox->pixelSnappedHeight(); 219 219 return IntPoint(xOffset * zoomLevel, y); 220 220 } -
trunk/Source/WebCore/rendering/RenderMeter.cpp
r95901 r113030 47 47 { 48 48 RenderBox::computeLogicalWidth(); 49 setWidth(theme()->meterSizeForBounds(this, frameRect()).width());49 setWidth(theme()->meterSizeForBounds(this, pixelSnappedIntRect(frameRect())).width()); 50 50 } 51 51 … … 53 53 { 54 54 RenderBox::computeLogicalHeight(); 55 setHeight(theme()->meterSizeForBounds(this, frameRect()).height());55 setHeight(theme()->meterSizeForBounds(this, pixelSnappedIntRect(frameRect())).height()); 56 56 } 57 57 -
trunk/Source/WebCore/rendering/RenderTheme.cpp
r111041 r113030 245 245 } 246 246 247 bool RenderTheme::paint(RenderObject* o, const PaintInfo& paintInfo, const LayoutRect& r)247 bool RenderTheme::paint(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) 248 248 { 249 249 // If painting is disabled, but we aren't updating control tints, then just bail. … … 508 508 } 509 509 510 LayoutPoint RenderTheme::volumeSliderOffsetFromMuteButton(RenderBox* muteButtonBox, const LayoutSize& size) const511 { 512 LayoutUnit y = -size.height();510 IntPoint RenderTheme::volumeSliderOffsetFromMuteButton(RenderBox* muteButtonBox, const IntSize& size) const 511 { 512 int y = -size.height(); 513 513 FloatPoint absPoint = muteButtonBox->localToAbsolute(FloatPoint(muteButtonBox->pixelSnappedOffsetLeft(), y), true, true); 514 514 if (absPoint.y() < 0) 515 515 y = muteButtonBox->height(); 516 return LayoutPoint(0, y);516 return IntPoint(0, y); 517 517 } 518 518 … … 670 670 } 671 671 672 void RenderTheme::adjustRepaintRect(const RenderObject* o, LayoutRect& r)672 void RenderTheme::adjustRepaintRect(const RenderObject* o, IntRect& r) 673 673 { 674 674 #if USE(NEW_THEME) … … 927 927 } 928 928 929 LayoutSize RenderTheme::meterSizeForBounds(const RenderMeter*, const LayoutRect& bounds) const929 IntSize RenderTheme::meterSizeForBounds(const RenderMeter*, const IntRect& bounds) const 930 930 { 931 931 return bounds.size(); -
trunk/Source/WebCore/rendering/RenderTheme.h
r110560 r113030 78 78 // text of a button, is always rendered by the engine itself. The boolean return value indicates 79 79 // 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&); 81 81 bool paintBorderOnly(RenderObject*, const PaintInfo&, const IntRect&); 82 82 bool paintDecorations(RenderObject*, const PaintInfo&, const IntRect&); … … 116 116 // Some controls may spill out of their containers (e.g., the check on an OS X checkbox). When these controls repaint, 117 117 // 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&); 119 119 120 120 // This method is called whenever a relevant state changes on a particular themed object, e.g., the mouse becomes pressed … … 178 178 179 179 // 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; }; 181 181 182 182 #if ENABLE(PROGRESS_TAG) … … 200 200 201 201 // 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; 203 203 #endif 204 204 205 205 #if ENABLE(METER_TAG) 206 virtual LayoutSize meterSizeForBounds(const RenderMeter*, const LayoutRect&) const;206 virtual IntSize meterSizeForBounds(const RenderMeter*, const IntRect&) const; 207 207 virtual bool supportsMeter(ControlPart) const; 208 208 #endif -
trunk/Source/WebCore/rendering/RenderThemeChromiumMac.h
r106734 r113030 50 50 virtual bool paintMediaVolumeSliderTrack(RenderObject*, const PaintInfo&, const IntRect&); 51 51 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; 53 53 virtual bool usesMediaControlStatusDisplay() { return false; } 54 54 virtual bool hasOwnDisabledStateHandlingFor(ControlPart) const { return true; } -
trunk/Source/WebCore/rendering/RenderThemeChromiumMac.mm
r106734 r113030 212 212 } 213 213 214 LayoutPoint RenderThemeChromiumMac::volumeSliderOffsetFromMuteButton(RenderBox* muteButtonBox, const LayoutSize& size) const214 IntPoint RenderThemeChromiumMac::volumeSliderOffsetFromMuteButton(RenderBox* muteButtonBox, const IntSize& size) const 215 215 { 216 216 return RenderTheme::volumeSliderOffsetFromMuteButton(muteButtonBox, size); -
trunk/Source/WebCore/rendering/RenderThemeChromiumSkia.cpp
r111274 r113030 262 262 } 263 263 264 LayoutRect RenderThemeChromiumSkia::convertToPaintingRect(RenderObject* inputRenderer, const RenderObject* partRenderer, LayoutRect partRect, const IntRect& localOffset) const264 IntRect RenderThemeChromiumSkia::convertToPaintingRect(RenderObject* inputRenderer, const RenderObject* partRenderer, IntRect partRect, const IntRect& localOffset) const 265 265 { 266 266 // Compute an offset between the part renderer and the input renderer. 267 LayoutSize offsetFromInputRenderer = -(partRenderer->offsetFromAncestorContainer(inputRenderer));267 IntSize offsetFromInputRenderer = -(partRenderer->offsetFromAncestorContainer(inputRenderer)); 268 268 // Move the rect into partRenderer's coords. 269 269 partRect.move(offsetFromInputRenderer); … … 281 281 return false; 282 282 RenderBox* inputRenderBox = toRenderBox(input->renderer()); 283 LayoutRect inputContentBox = inputRenderBox->contentBoxRect();283 IntRect inputContentBox = inputRenderBox->contentBoxRect(); 284 284 285 285 // 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())); 287 287 // Calculate cancel button's coordinates relative to the input element. 288 288 // Center the button vertically. Round up though, so if it has to be one pixel off-center, it will 289 289 // 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 292 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); 294 294 295 295 static Image* cancelImage = Image::loadPlatformResource("searchCancel").leakRef(); … … 324 324 return false; 325 325 RenderBox* inputRenderBox = toRenderBox(input->renderer()); 326 LayoutRect inputContentBox = inputRenderBox->contentBoxRect();326 IntRect inputContentBox = inputRenderBox->contentBoxRect(); 327 327 328 328 // 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())); 330 330 // Calculate decoration's coordinates relative to the input element. 331 331 // Center the decoration vertically. Round up though, so if it has to be one pixel off-center, it will 332 332 // 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 335 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); 337 337 338 338 static Image* magnifierImage = Image::loadPlatformResource("searchMagnifier").leakRef(); … … 359 359 return false; 360 360 RenderBox* inputRenderBox = toRenderBox(input->renderer()); 361 LayoutRect inputContentBox = inputRenderBox->contentBoxRect();361 IntRect inputContentBox = inputRenderBox->contentBoxRect(); 362 362 363 363 // 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 368 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); 370 370 371 371 static Image* magnifierImage = Image::loadPlatformResource("searchMagnifierResults").leakRef(); -
trunk/Source/WebCore/rendering/RenderThemeChromiumSkia.h
r106734 r113030 158 158 int menuListInternalPadding(RenderStyle*, int paddingType) const; 159 159 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; 161 161 }; 162 162 -
trunk/Source/WebCore/rendering/RenderThemeMac.h
r110560 r113030 46 46 virtual bool supportsControlTints() const { return true; } 47 47 48 virtual void adjustRepaintRect(const RenderObject*, LayoutRect&);48 virtual void adjustRepaintRect(const RenderObject*, IntRect&) OVERRIDE; 49 49 50 50 virtual bool isControlStyled(const RenderStyle*, const BorderData&, … … 75 75 virtual int popupInternalPaddingBottom(RenderStyle*) const; 76 76 77 virtual bool paintCapsLockIndicator(RenderObject*, const PaintInfo&, const LayoutRect&);77 virtual bool paintCapsLockIndicator(RenderObject*, const PaintInfo&, const IntRect&) OVERRIDE; 78 78 79 79 virtual bool popsMenuByArrowKeys() const OVERRIDE { return true; } 80 80 81 81 #if ENABLE(METER_TAG) 82 virtual LayoutSize meterSizeForBounds(const RenderMeter*, const LayoutRect&) const;82 virtual IntSize meterSizeForBounds(const RenderMeter*, const IntRect&) const OVERRIDE; 83 83 virtual bool paintMeter(RenderObject*, const PaintInfo&, const IntRect&); 84 84 virtual bool supportsMeter(ControlPart) const; … … 172 172 virtual bool usesMediaControlVolumeSlider() const; 173 173 virtual void adjustMediaSliderThumbSize(RenderStyle*) const; 174 virtual LayoutPoint volumeSliderOffsetFromMuteButton(RenderBox*, const LayoutSize&) const;174 virtual IntPoint volumeSliderOffsetFromMuteButton(RenderBox*, const IntSize&) const OVERRIDE; 175 175 #endif 176 176 … … 180 180 virtual String fileListNameForWidth(const FileList*, const Font&, int width, bool multipleFilesAllowed) const OVERRIDE; 181 181 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; 183 183 184 184 FloatRect convertToPaintingRect(const RenderObject* inputRenderer, const RenderObject* partRenderer, const FloatRect& inputRect, const IntRect& r) const; … … 187 187 NSControlSize controlSizeForFont(RenderStyle*) const; 188 188 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); 190 190 void setSizeFromFont(RenderStyle*, const IntSize* sizes) const; 191 191 IntSize sizeForFont(RenderStyle*, const IntSize* sizes) const; … … 202 202 // Helpers for adjusting appearance and for painting 203 203 204 void setPopupButtonCellState(const RenderObject*, const LayoutRect&);204 void setPopupButtonCellState(const RenderObject*, const IntRect&); 205 205 const IntSize* popupButtonSizes() const; 206 206 const int* popupButtonMargins() const; -
trunk/Source/WebCore/rendering/RenderThemeMac.mm
r112301 r113030 503 503 } 504 504 505 void RenderThemeMac::adjustRepaintRect(const RenderObject* o, LayoutRect& r)505 void RenderThemeMac::adjustRepaintRect(const RenderObject* o, IntRect& r) 506 506 { 507 507 ControlPart part = o->style()->appearance(); … … 534 534 } 535 535 536 LayoutRect RenderThemeMac::inflateRect(const LayoutRect& r, const IntSize& size, const int* margins, float zoomLevel) const536 IntRect RenderThemeMac::inflateRect(const IntRect& r, const IntSize& size, const int* margins, float zoomLevel) const 537 537 { 538 538 // Only do the inflation if the available width/height are too small. Otherwise try to 539 539 // 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); 543 543 if (widthDelta < 0) { 544 544 result.setX(result.x() - margins[leftMargin] * zoomLevel); … … 561 561 while (renderer && renderer != inputRenderer) { 562 562 RenderObject* containingRenderer = renderer->container(); 563 offsetFromInputRenderer -= r enderer->offsetFromContainer(containingRenderer, LayoutPoint());563 offsetFromInputRenderer -= roundedIntSize(renderer->offsetFromContainer(containingRenderer, LayoutPoint())); 564 564 renderer = containingRenderer; 565 565 } … … 642 642 } 643 643 644 void RenderThemeMac::setControlSize(NSCell* cell, const IntSize* sizes, const LayoutSize& minSize, float zoomLevel)644 void RenderThemeMac::setControlSize(NSCell* cell, const IntSize* sizes, const IntSize& minSize, float zoomLevel) 645 645 { 646 646 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)) 649 649 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)) 652 652 size = NSSmallControlSize; 653 653 else … … 732 732 } 733 733 734 bool RenderThemeMac::paintCapsLockIndicator(RenderObject*, const PaintInfo& paintInfo, const LayoutRect& r)734 bool RenderThemeMac::paintCapsLockIndicator(RenderObject*, const PaintInfo& paintInfo, const IntRect& r) 735 735 { 736 736 if (paintInfo.context->paintingDisabled()) … … 795 795 796 796 // Now inflate it to account for the shadow. 797 LayoutRect inflatedRect = r;797 IntRect inflatedRect = r; 798 798 if (r.width() >= minimumMenuListSize(o->style())) 799 799 inflatedRect = inflateRect(inflatedRect, size, popupButtonMargins(), zoomLevel); … … 820 820 #if ENABLE(METER_TAG) 821 821 822 LayoutSize RenderThemeMac::meterSizeForBounds(const RenderMeter* renderMeter, const LayoutRect& bounds) const822 IntSize RenderThemeMac::meterSizeForBounds(const RenderMeter* renderMeter, const IntRect& bounds) const 823 823 { 824 824 if (NoControlPart == renderMeter->style()->appearance()) … … 827 827 NSLevelIndicatorCell* cell = levelIndicatorFor(renderMeter); 828 828 // 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 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()); 832 832 } 833 833 … … 1279 1279 } 1280 1280 1281 void RenderThemeMac::setPopupButtonCellState(const RenderObject* o, const LayoutRect& r)1281 void RenderThemeMac::setPopupButtonCellState(const RenderObject* o, const IntRect& r) 1282 1282 { 1283 1283 NSPopUpButtonCell* popupButton = this->popupButton(); … … 1541 1541 // Take care of cases where the cancel button was not aligned with the right border of the input element (for e.g. 1542 1542 // 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()); 1546 1546 localBounds.setX(localBounds.x() - spaceToRightOfCancelButton); 1547 1547 #endif … … 2061 2061 } 2062 2062 2063 LayoutPoint RenderThemeMac::volumeSliderOffsetFromMuteButton(RenderBox* muteButtonBox, const LayoutSize& size) const2063 IntPoint RenderThemeMac::volumeSliderOffsetFromMuteButton(RenderBox* muteButtonBox, const IntSize& size) const 2064 2064 { 2065 2065 return RenderMediaControls::volumeSliderOffsetFromMuteButton(muteButtonBox, size); -
trunk/Source/WebCore/rendering/RenderThemeWin.cpp
r111041 r113030 877 877 bool RenderThemeWin::paintSearchFieldCancelButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) 878 878 { 879 LayoutRect bounds = r;879 IntRect bounds = r; 880 880 ASSERT(o->parent()); 881 881 if (!o->parent() || !o->parent()->isBox()) … … 884 884 RenderBox* parentRenderBox = toRenderBox(o->parent()); 885 885 886 LayoutRect parentBox = parentRenderBox->absoluteContentBox();886 IntRect parentBox = parentRenderBox->absoluteContentBox(); 887 887 888 888 // Make sure the scaled button stays square and will fit in its parent's box … … 928 928 bool RenderThemeWin::paintSearchFieldResultsDecoration(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) 929 929 { 930 LayoutRect bounds = r;930 IntRect bounds = r; 931 931 ASSERT(o->parent()); 932 932 if (!o->parent() || !o->parent()->isBox()) … … 934 934 935 935 RenderBox* parentRenderBox = toRenderBox(o->parent()); 936 LayoutRect parentBox = parentRenderBox->absoluteContentBox();936 IntRect parentBox = parentRenderBox->absoluteContentBox(); 937 937 938 938 // Make sure the scaled decoration stays square and will fit in its parent's box … … 962 962 bool RenderThemeWin::paintSearchFieldResultsButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) 963 963 { 964 LayoutRect bounds = r;964 IntRect bounds = r; 965 965 ASSERT(o->parent()); 966 966 if (!o->parent()) … … 970 970 971 971 RenderBox* parentRenderBox = toRenderBox(o->parent()); 972 LayoutRect parentBox = parentRenderBox->absoluteContentBox();972 IntRect parentBox = parentRenderBox->absoluteContentBox(); 973 973 974 974 // Make sure the scaled decoration will fit in its parent's box 975 975 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)); 977 977 978 978 // Center the button vertically. Round up though, so if it has to be one pixel off-center, it will … … 1120 1120 } 1121 1121 1122 LayoutPoint RenderThemeWin::volumeSliderOffsetFromMuteButton(RenderBox* muteButtonBox, const LayoutSize& size) const1122 IntPoint RenderThemeWin::volumeSliderOffsetFromMuteButton(RenderBox* muteButtonBox, const IntSize& size) const 1123 1123 { 1124 1124 return RenderMediaControls::volumeSliderOffsetFromMuteButton(muteButtonBox, size); -
trunk/Source/WebCore/rendering/RenderThemeWin.h
r106734 r113030 142 142 virtual bool paintMediaVolumeSliderTrack(RenderObject*, const PaintInfo&, const IntRect&); 143 143 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; 145 145 #endif 146 146
Note: See TracChangeset
for help on using the changeset viewer.