Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: Source/core/rendering/RenderThemeChromiumSkia.cpp

Issue 21430003: Implement interfaces in PaintInfo and make it a class. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@getterPaintInfo01
Patch Set: Second try Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Apple Inc. 2 * Copyright (C) 2007 Apple Inc.
3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
4 * Copyright (C) 2008 Collabora Ltd. 4 * Copyright (C) 2008 Collabora Ltd.
5 * Copyright (C) 2008, 2009 Google Inc. 5 * Copyright (C) 2008, 2009 Google Inc.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 // Calculate cancel button's coordinates relative to the input element. 238 // Calculate cancel button's coordinates relative to the input element.
239 // Center the button vertically. Round up though, so if it has to be one pi xel off-center, it will 239 // Center the button vertically. Round up though, so if it has to be one pi xel off-center, it will
240 // be one pixel closer to the bottom of the field. This tends to look bette r with the text. 240 // be one pixel closer to the bottom of the field. This tends to look bette r with the text.
241 LayoutRect cancelButtonRect(cancelButtonObject->offsetFromAncestorContainer( inputRenderBox).width(), 241 LayoutRect cancelButtonRect(cancelButtonObject->offsetFromAncestorContainer( inputRenderBox).width(),
242 inputContentBox.y() + (inputContentBox.height() - cancelButtonSize + 1) / 2, 242 inputContentBox.y() + (inputContentBox.height() - cancelButtonSize + 1) / 2,
243 cancelButtonSize, cancelButtonSize); 243 cancelButtonSize, cancelButtonSize);
244 IntRect paintingRect = convertToPaintingRect(inputRenderBox, cancelButtonObj ect, cancelButtonRect, r); 244 IntRect paintingRect = convertToPaintingRect(inputRenderBox, cancelButtonObj ect, cancelButtonRect, r);
245 245
246 static Image* cancelImage = Image::loadPlatformResource("searchCancel").leak Ref(); 246 static Image* cancelImage = Image::loadPlatformResource("searchCancel").leak Ref();
247 static Image* cancelPressedImage = Image::loadPlatformResource("searchCancel Pressed").leakRef(); 247 static Image* cancelPressedImage = Image::loadPlatformResource("searchCancel Pressed").leakRef();
248 paintInfo.context->drawImage(isPressed(cancelButtonObject) ? cancelPressedIm age : cancelImage, paintingRect); 248 paintInfo.getContext()->drawImage(isPressed(cancelButtonObject) ? cancelPres sedImage : cancelImage, paintingRect);
249 return false; 249 return false;
250 } 250 }
251 251
252 void RenderThemeChromiumSkia::adjustSearchFieldDecorationStyle(RenderStyle* styl e, Element*) const 252 void RenderThemeChromiumSkia::adjustSearchFieldDecorationStyle(RenderStyle* styl e, Element*) const
253 { 253 {
254 IntSize emptySize(1, 11); 254 IntSize emptySize(1, 11);
255 style->setWidth(Length(emptySize.width(), Fixed)); 255 style->setWidth(Length(emptySize.width(), Fixed));
256 style->setHeight(Length(emptySize.height(), Fixed)); 256 style->setHeight(Length(emptySize.height(), Fixed));
257 } 257 }
258 258
(...skipping 21 matching lines...) Expand all
280 LayoutUnit magnifierSize = std::min(inputContentBox.width(), std::min<Layout Unit>(inputContentBox.height(), r.height())); 280 LayoutUnit magnifierSize = std::min(inputContentBox.width(), std::min<Layout Unit>(inputContentBox.height(), r.height()));
281 // Calculate decoration's coordinates relative to the input element. 281 // Calculate decoration's coordinates relative to the input element.
282 // Center the decoration vertically. Round up though, so if it has to be on e pixel off-center, it will 282 // Center the decoration vertically. Round up though, so if it has to be on e pixel off-center, it will
283 // be one pixel closer to the bottom of the field. This tends to look bette r with the text. 283 // be one pixel closer to the bottom of the field. This tends to look bette r with the text.
284 LayoutRect magnifierRect(magnifierObject->offsetFromAncestorContainer(inputR enderBox).width(), 284 LayoutRect magnifierRect(magnifierObject->offsetFromAncestorContainer(inputR enderBox).width(),
285 inputContentBox.y() + (inputContentBox.height() - m agnifierSize + 1) / 2, 285 inputContentBox.y() + (inputContentBox.height() - m agnifierSize + 1) / 2,
286 magnifierSize, magnifierSize); 286 magnifierSize, magnifierSize);
287 IntRect paintingRect = convertToPaintingRect(inputRenderBox, magnifierObject , magnifierRect, r); 287 IntRect paintingRect = convertToPaintingRect(inputRenderBox, magnifierObject , magnifierRect, r);
288 288
289 static Image* magnifierImage = Image::loadPlatformResource("searchMagnifier" ).leakRef(); 289 static Image* magnifierImage = Image::loadPlatformResource("searchMagnifier" ).leakRef();
290 paintInfo.context->drawImage(magnifierImage, paintingRect); 290 paintInfo.getContext()->drawImage(magnifierImage, paintingRect);
291 return false; 291 return false;
292 } 292 }
293 293
294 bool RenderThemeChromiumSkia::paintMediaSliderTrack(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect) 294 bool RenderThemeChromiumSkia::paintMediaSliderTrack(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
295 { 295 {
296 return RenderMediaControlsChromium::paintMediaControlsPart(MediaSlider, obje ct, paintInfo, rect); 296 return RenderMediaControlsChromium::paintMediaControlsPart(MediaSlider, obje ct, paintInfo, rect);
297 } 297 }
298 298
299 bool RenderThemeChromiumSkia::paintMediaVolumeSliderTrack(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect) 299 bool RenderThemeChromiumSkia::paintMediaVolumeSliderTrack(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
300 { 300 {
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 { 464 {
465 return renderProgress->isDeterminate() ? determinateProgressValueRectFor(ren derProgress, rect) : indeterminateProgressValueRectFor(renderProgress, rect); 465 return renderProgress->isDeterminate() ? determinateProgressValueRectFor(ren derProgress, rect) : indeterminateProgressValueRectFor(renderProgress, rect);
466 } 466 }
467 467
468 RenderThemeChromiumSkia::DirectionFlippingScope::DirectionFlippingScope(RenderOb ject* renderer, const PaintInfo& paintInfo, const IntRect& rect) 468 RenderThemeChromiumSkia::DirectionFlippingScope::DirectionFlippingScope(RenderOb ject* renderer, const PaintInfo& paintInfo, const IntRect& rect)
469 : m_needsFlipping(!renderer->style()->isLeftToRightDirection()) 469 : m_needsFlipping(!renderer->style()->isLeftToRightDirection())
470 , m_paintInfo(paintInfo) 470 , m_paintInfo(paintInfo)
471 { 471 {
472 if (!m_needsFlipping) 472 if (!m_needsFlipping)
473 return; 473 return;
474 m_paintInfo.context->save(); 474 m_paintInfo.getContext()->save();
475 m_paintInfo.context->translate(2 * rect.x() + rect.width(), 0); 475 m_paintInfo.getContext()->translate(2 * rect.x() + rect.width(), 0);
476 m_paintInfo.context->scale(FloatSize(-1, 1)); 476 m_paintInfo.getContext()->scale(FloatSize(-1, 1));
477 } 477 }
478 478
479 RenderThemeChromiumSkia::DirectionFlippingScope::~DirectionFlippingScope() 479 RenderThemeChromiumSkia::DirectionFlippingScope::~DirectionFlippingScope()
480 { 480 {
481 if (!m_needsFlipping) 481 if (!m_needsFlipping)
482 return; 482 return;
483 m_paintInfo.context->restore(); 483 m_paintInfo.getContext()->restore();
484 } 484 }
485 485
486 } // namespace WebCore 486 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698