diff options
author | Ben Murdoch <benm@google.com> | 2011-05-24 11:24:40 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-06-02 09:53:15 +0100 |
commit | 81bc750723a18f21cd17d1b173cd2a4dda9cea6e (patch) | |
tree | 7a9e5ed86ff429fd347a25153107221543909b19 /Source/WebCore/rendering/RenderThemeChromiumWin.cpp | |
parent | 94088a6d336c1dd80a1e734af51e96abcbb689a7 (diff) | |
download | external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.zip external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.tar.gz external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.tar.bz2 |
Merge WebKit at r80534: Intial merge by Git
Change-Id: Ia7a83357124c9e1cdb1debf55d9661ec0bd09a61
Diffstat (limited to 'Source/WebCore/rendering/RenderThemeChromiumWin.cpp')
-rw-r--r-- | Source/WebCore/rendering/RenderThemeChromiumWin.cpp | 54 |
1 files changed, 37 insertions, 17 deletions
diff --git a/Source/WebCore/rendering/RenderThemeChromiumWin.cpp b/Source/WebCore/rendering/RenderThemeChromiumWin.cpp index d538050..6f3be00 100644 --- a/Source/WebCore/rendering/RenderThemeChromiumWin.cpp +++ b/Source/WebCore/rendering/RenderThemeChromiumWin.cpp @@ -62,10 +62,15 @@ namespace WebCore { static const int kStandardMenuListButtonWidth = 17; namespace { +// We must not create multiple ThemePainter instances. class ThemePainter { public: ThemePainter(GraphicsContext* context, const IntRect& r) { +#ifndef NDEBUG + ASSERT(!s_hasInstance); + s_hasInstance = true; +#endif TransparencyWin::TransformMode transformMode = getTransformMode(context->getCTM()); m_helper.init(context, getLayerMode(context, transformMode), transformMode, r); @@ -85,6 +90,9 @@ public: ~ThemePainter() { m_helper.composite(); +#ifndef NDEBUG + s_hasInstance = false; +#endif } GraphicsContext* context() { return m_helper.context(); } @@ -120,8 +128,15 @@ private: } TransparencyWin m_helper; +#ifndef NDEBUG + static bool s_hasInstance; +#endif }; +#ifndef NDEBUG +bool ThemePainter::s_hasInstance = false; +#endif + } // namespace static void getNonClientMetrics(NONCLIENTMETRICS* metrics) @@ -707,23 +722,28 @@ bool RenderThemeChromiumWin::paintInnerSpinButton(RenderObject* object, const Pa { IntRect half = rect; - half.setHeight(rect.height() / 2); - const ThemeData& upThemeData = getThemeData(object, SpinButtonUp); - ThemePainter upPainter(info.context, half); - PlatformBridge::paintSpinButton(upPainter.context(), - upThemeData.m_part, - upThemeData.m_state, - upThemeData.m_classicState, - upPainter.drawRect()); - - half.setY(rect.y() + rect.height() / 2); - const ThemeData& downThemeData = getThemeData(object, SpinButtonDown); - ThemePainter downPainter(info.context, half); - PlatformBridge::paintSpinButton(downPainter.context(), - downThemeData.m_part, - downThemeData.m_state, - downThemeData.m_classicState, - downPainter.drawRect()); + // Need explicit blocks to avoid to create multiple ThemePainter instances. + { + half.setHeight(rect.height() / 2); + const ThemeData& upThemeData = getThemeData(object, SpinButtonUp); + ThemePainter upPainter(info.context, half); + PlatformBridge::paintSpinButton(upPainter.context(), + upThemeData.m_part, + upThemeData.m_state, + upThemeData.m_classicState, + upPainter.drawRect()); + } + + { + half.setY(rect.y() + rect.height() / 2); + const ThemeData& downThemeData = getThemeData(object, SpinButtonDown); + ThemePainter downPainter(info.context, half); + PlatformBridge::paintSpinButton(downPainter.context(), + downThemeData.m_part, + downThemeData.m_state, + downThemeData.m_classicState, + downPainter.drawRect()); + } return false; } |