Changeset 114471 in webkit
- Timestamp:
- Apr 17, 2012 5:31:32 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r114470 r114471 1 2012-04-17 Emil A Eklund <eae@chromium.org> 2 3 Change RenderThemeChromiumSkia paint methods to use pixel snapping 4 https://bugs.webkit.org/show_bug.cgi?id=84175 5 6 Reviewed by Eric Seidel. 7 8 No new tests, no change in functionality. 9 10 Change RenderThemeChromiumSkia to use subpixel types and pixel snap 11 values just before painting. 12 13 * rendering/RenderThemeChromiumSkia.cpp: 14 (WebCore::RenderThemeChromiumSkia::convertToPaintingRect): 15 (WebCore::RenderThemeChromiumSkia::paintSearchFieldCancelButton): 16 (WebCore::RenderThemeChromiumSkia::paintSearchFieldResultsDecoration): 17 (WebCore::RenderThemeChromiumSkia::paintSearchFieldResultsButton): 18 * rendering/RenderThemeChromiumSkia.h: 19 1 20 2012-04-17 Levi Weintraub <leviw@chromium.org> 2 21 -
trunk/Source/WebCore/rendering/RenderThemeChromiumSkia.cpp
r113030 r114471 262 262 } 263 263 264 IntRect RenderThemeChromiumSkia::convertToPaintingRect(RenderObject* inputRenderer, const RenderObject* partRenderer, IntRect partRect, const IntRect& localOffset) const264 IntRect RenderThemeChromiumSkia::convertToPaintingRect(RenderObject* inputRenderer, const RenderObject* partRenderer, LayoutRect partRect, const IntRect& localOffset) const 265 265 { 266 266 // Compute an offset between the part renderer and the input renderer. 267 IntSize offsetFromInputRenderer = -(partRenderer->offsetFromAncestorContainer(inputRenderer));267 LayoutSize offsetFromInputRenderer = -partRenderer->offsetFromAncestorContainer(inputRenderer); 268 268 // Move the rect into partRenderer's coords. 269 269 partRect.move(offsetFromInputRenderer); … … 271 271 partRect.move(localOffset.x(), localOffset.y()); 272 272 273 return p artRect;273 return pixelSnappedIntRect(partRect); 274 274 } 275 275 … … 281 281 return false; 282 282 RenderBox* inputRenderBox = toRenderBox(input->renderer()); 283 IntRect inputContentBox = inputRenderBox->contentBoxRect();283 LayoutRect inputContentBox = inputRenderBox->contentBoxRect(); 284 284 285 285 // Make sure the scaled button stays square and will fit in its parent's box. 286 int cancelButtonSize = std::min(inputContentBox.width(), std::min<int>(inputContentBox.height(), r.height()));286 LayoutUnit cancelButtonSize = std::min(inputContentBox.width(), std::min(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 IntRect cancelButtonRect(cancelButtonObject->offsetFromAncestorContainer(inputRenderBox).width(),291 inputContentBox.y() + (inputContentBox.height() - cancelButtonSize + 1) / 2,292 cancelButtonSize, cancelButtonSize);290 LayoutRect cancelButtonRect(cancelButtonObject->offsetFromAncestorContainer(inputRenderBox).width(), 291 inputContentBox.y() + (inputContentBox.height() - cancelButtonSize + 1) / 2, 292 cancelButtonSize, cancelButtonSize); 293 293 IntRect paintingRect = convertToPaintingRect(inputRenderBox, cancelButtonObject, cancelButtonRect, r); 294 294 … … 324 324 return false; 325 325 RenderBox* inputRenderBox = toRenderBox(input->renderer()); 326 IntRect inputContentBox = inputRenderBox->contentBoxRect();326 LayoutRect inputContentBox = inputRenderBox->contentBoxRect(); 327 327 328 328 // Make sure the scaled decoration stays square and will fit in its parent's box. 329 int magnifierSize = std::min(inputContentBox.width(), std::min<int>(inputContentBox.height(), r.height()));329 LayoutUnit magnifierSize = std::min(inputContentBox.width(), std::min(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 IntRect magnifierRect(magnifierObject->offsetFromAncestorContainer(inputRenderBox).width(),334 inputContentBox.y() + (inputContentBox.height() - magnifierSize + 1) / 2,335 magnifierSize, magnifierSize);333 LayoutRect magnifierRect(magnifierObject->offsetFromAncestorContainer(inputRenderBox).width(), 334 inputContentBox.y() + (inputContentBox.height() - magnifierSize + 1) / 2, 335 magnifierSize, magnifierSize); 336 336 IntRect paintingRect = convertToPaintingRect(inputRenderBox, magnifierObject, magnifierRect, r); 337 337 … … 359 359 return false; 360 360 RenderBox* inputRenderBox = toRenderBox(input->renderer()); 361 IntRect inputContentBox = inputRenderBox->contentBoxRect();361 LayoutRect inputContentBox = inputRenderBox->contentBoxRect(); 362 362 363 363 // Make sure the scaled decoration will fit in its parent's box. 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);364 LayoutUnit magnifierHeight = std::min(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 369 IntRect paintingRect = convertToPaintingRect(inputRenderBox, magnifierObject, magnifierRect, r); 370 370 -
trunk/Source/WebCore/rendering/RenderThemeChromiumSkia.h
r113030 r114471 158 158 int menuListInternalPadding(RenderStyle*, int paddingType) const; 159 159 bool paintMediaButtonInternal(GraphicsContext*, const IntRect&, Image*); 160 IntRect convertToPaintingRect(RenderObject* inputRenderer, const RenderObject* partRenderer, IntRect partRect, const IntRect& localOffset) const;160 IntRect convertToPaintingRect(RenderObject* inputRenderer, const RenderObject* partRenderer, LayoutRect partRect, const IntRect& localOffset) const; 161 161 }; 162 162
Note: See TracChangeset
for help on using the changeset viewer.