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

Unified Diff: Source/core/rendering/RenderTheme.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, 5 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/rendering/RenderTheme.cpp
diff --git a/Source/core/rendering/RenderTheme.cpp b/Source/core/rendering/RenderTheme.cpp
index 0150f98cfc403cf4f41bc1df620bc9b6e468ba3d..5bcb601f63764525bdae7743a131ca0d0a54431e 100644
--- a/Source/core/rendering/RenderTheme.cpp
+++ b/Source/core/rendering/RenderTheme.cpp
@@ -265,17 +265,17 @@ void RenderTheme::adjustStyle(RenderStyle* style, Element* e, const CachedUAStyl
}
}
-bool RenderTheme::paint(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r)
+bool RenderTheme::paint(RenderObject* o, 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
// for that control.
- if (paintInfo.context->updatingControlTints()) {
+ if (paintInfo.getContext()->updatingControlTints()) {
if (controlSupportsTints(o))
o->repaint();
return false;
}
- if (paintInfo.context->paintingDisabled())
+ if (paintInfo.getContext()->paintingDisabled())
return false;
ControlPart part = o->style()->appearance();
@@ -291,7 +291,7 @@ bool RenderTheme::paint(RenderObject* o, const PaintInfo& paintInfo, const IntRe
case SquareButtonPart:
case ButtonPart:
case InnerSpinButtonPart:
- m_theme->paint(part, controlStatesForRenderer(o), const_cast<GraphicsContext*>(paintInfo.context), r, o->style()->effectiveZoom(), o->view()->frameView());
+ m_theme->paint(part, controlStatesForRenderer(o), const_cast<GraphicsContext*>(paintInfo.getContext()), r, o->style()->effectiveZoom(), o->view()->frameView());
return false;
default:
break;
@@ -393,9 +393,9 @@ bool RenderTheme::paint(RenderObject* o, const PaintInfo& paintInfo, const IntRe
return true; // We don't support the appearance, so let the normal background/border paint.
}
-bool RenderTheme::paintBorderOnly(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r)
+bool RenderTheme::paintBorderOnly(RenderObject* o, PaintInfo& paintInfo, const IntRect& r)
{
- if (paintInfo.context->paintingDisabled())
+ if (paintInfo.getContext()->paintingDisabled())
return false;
// Call the appropriate paint method based off the appearance value.
@@ -437,9 +437,9 @@ bool RenderTheme::paintBorderOnly(RenderObject* o, const PaintInfo& paintInfo, c
return false;
}
-bool RenderTheme::paintDecorations(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r)
+bool RenderTheme::paintDecorations(RenderObject* o, PaintInfo& paintInfo, const IntRect& r)
{
- if (paintInfo.context->paintingDisabled())
+ if (paintInfo.getContext()->paintingDisabled())
return false;
// Call the appropriate paint method based off the appearance value.
@@ -955,7 +955,7 @@ void RenderTheme::adjustInputFieldSpeechButtonStyle(RenderStyle* style, Element*
RenderInputSpeech::adjustInputFieldSpeechButtonStyle(style, element);
}
-bool RenderTheme::paintInputFieldSpeechButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
+bool RenderTheme::paintInputFieldSpeechButton(RenderObject* object, PaintInfo& paintInfo, const IntRect& rect)
{
return RenderInputSpeech::paintInputFieldSpeechButton(object, paintInfo, rect);
}
@@ -975,7 +975,7 @@ bool RenderTheme::supportsMeter(ControlPart) const
return false;
}
-bool RenderTheme::paintMeter(RenderObject*, const PaintInfo&, const IntRect&)
+bool RenderTheme::paintMeter(RenderObject*, PaintInfo&, const IntRect&)
{
return true;
}
@@ -985,7 +985,7 @@ LayoutUnit RenderTheme::sliderTickSnappingThreshold() const
return 5;
}
-void RenderTheme::paintSliderTicks(RenderObject* o, const PaintInfo& paintInfo, const IntRect& rect)
+void RenderTheme::paintSliderTicks(RenderObject* o, PaintInfo& paintInfo, const IntRect& rect)
{
Node* node = o->node();
if (!node || !node->hasTagName(inputTag))
@@ -1044,8 +1044,8 @@ void RenderTheme::paintSliderTicks(RenderObject* o, const PaintInfo& paintInfo,
tickRegionWidth = trackBounds.height() - thumbSize.width();
}
RefPtr<HTMLCollection> options = dataList->options();
- GraphicsContextStateSaver stateSaver(*paintInfo.context);
- paintInfo.context->setFillColor(o->resolveColor(CSSPropertyColor));
+ GraphicsContextStateSaver stateSaver(*(paintInfo.getContext()));
+ paintInfo.getContext()->setFillColor(o->resolveColor(CSSPropertyColor));
for (unsigned i = 0; Node* node = options->item(i); i++) {
ASSERT(node->hasTagName(optionTag));
HTMLOptionElement* optionElement = toHTMLOptionElement(node);
@@ -1060,7 +1060,7 @@ void RenderTheme::paintSliderTicks(RenderObject* o, const PaintInfo& paintInfo,
tickRect.setX(tickPosition);
else
tickRect.setY(tickPosition);
- paintInfo.context->fillRect(tickRect);
+ paintInfo.getContext()->fillRect(tickRect);
}
}
@@ -1301,7 +1301,7 @@ void RenderTheme::adjustStyleUsingFallbackTheme(RenderStyle* style, Element* e)
}
}
-bool RenderTheme::paintUsingFallbackTheme(RenderObject* o, const PaintInfo& i, const IntRect& r)
+bool RenderTheme::paintUsingFallbackTheme(RenderObject* o, PaintInfo& i, const IntRect& r)
{
ControlPart part = o->style()->appearance();
switch (part) {
@@ -1324,22 +1324,22 @@ void RenderTheme::setSizeIfAuto(RenderStyle* style, const IntSize& size)
style->setHeight(Length(size.height(), Fixed));
}
-bool RenderTheme::paintCheckboxUsingFallbackTheme(RenderObject* o, const PaintInfo& i, const IntRect& r)
+bool RenderTheme::paintCheckboxUsingFallbackTheme(RenderObject* o, PaintInfo& i, const IntRect& r)
{
WebKit::WebFallbackThemeEngine::ExtraParams extraParams;
- WebKit::WebCanvas* canvas = i.context->canvas();
+ WebKit::WebCanvas* canvas = i.getContext()->canvas();
extraParams.button.checked = isChecked(o);
extraParams.button.indeterminate = isIndeterminate(o);
float zoomLevel = o->style()->effectiveZoom();
- GraphicsContextStateSaver stateSaver(*i.context);
+ GraphicsContextStateSaver stateSaver(*(i.getContext()));
IntRect unzoomedRect = r;
if (zoomLevel != 1) {
unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel);
unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel);
- i.context->translate(unzoomedRect.x(), unzoomedRect.y());
- i.context->scale(FloatSize(zoomLevel, zoomLevel));
- i.context->translate(-unzoomedRect.x(), -unzoomedRect.y());
+ i.getContext()->translate(unzoomedRect.x(), unzoomedRect.y());
+ i.getContext()->scale(FloatSize(zoomLevel, zoomLevel));
+ i.getContext()->translate(-unzoomedRect.x(), -unzoomedRect.y());
}
WebKit::Platform::current()->fallbackThemeEngine()->paint(canvas, WebKit::WebFallbackThemeEngine::PartCheckbox, getWebFallbackThemeState(this, o), WebKit::WebRect(unzoomedRect), &extraParams);
@@ -1366,22 +1366,22 @@ void RenderTheme::adjustCheckboxStyleUsingFallbackTheme(RenderStyle* style, Elem
style->resetBorder();
}
-bool RenderTheme::paintRadioUsingFallbackTheme(RenderObject* o, const PaintInfo& i, const IntRect& r)
+bool RenderTheme::paintRadioUsingFallbackTheme(RenderObject* o, PaintInfo& i, const IntRect& r)
{
WebKit::WebFallbackThemeEngine::ExtraParams extraParams;
- WebKit::WebCanvas* canvas = i.context->canvas();
+ WebKit::WebCanvas* canvas = i.getContext()->canvas();
extraParams.button.checked = isChecked(o);
extraParams.button.indeterminate = isIndeterminate(o);
float zoomLevel = o->style()->effectiveZoom();
- GraphicsContextStateSaver stateSaver(*i.context);
+ GraphicsContextStateSaver stateSaver(*(i.getContext()));
IntRect unzoomedRect = r;
if (zoomLevel != 1) {
unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel);
unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel);
- i.context->translate(unzoomedRect.x(), unzoomedRect.y());
- i.context->scale(FloatSize(zoomLevel, zoomLevel));
- i.context->translate(-unzoomedRect.x(), -unzoomedRect.y());
+ i.getContext()->translate(unzoomedRect.x(), unzoomedRect.y());
+ i.getContext()->scale(FloatSize(zoomLevel, zoomLevel));
+ i.getContext()->translate(-unzoomedRect.x(), -unzoomedRect.y());
}
WebKit::Platform::current()->fallbackThemeEngine()->paint(canvas, WebKit::WebFallbackThemeEngine::PartRadio, getWebFallbackThemeState(this, o), WebKit::WebRect(unzoomedRect), &extraParams);

Powered by Google App Engine
This is Rietveld 408576698