+2007-11-05 Adam Roben <aroben@apple.com>
+
+ Don't crash if SafariTheme can't be loaded
+
+ PlatformScrollBarSafari and RenderThemeSafari were not checking
+ whether SafariTheme was successfully loaded. All other uses of
+ SafariTheme already check this.
+
+ Reviewed by Steve.
+
+ * platform/win/PlatformScrollBarSafari.cpp: Don't paint if SafariTheme
+ couldn't be loaded.
+ (WebCore::PlatformScrollbar::paintButton):
+ (WebCore::PlatformScrollbar::paintTrack):
+ (WebCore::PlatformScrollbar::paintThumb):
+ * rendering/RenderThemeSafari.cpp:
+ (WebCore::RenderThemeSafari::isControlStyled): Always return true if
+ we couldn't load SafariTheme. This way we should never try to paint
+ themed controls (and we assert as such in the paint functions).
+ (WebCore::RenderThemeSafari::paintCheckbox):
+ (WebCore::RenderThemeSafari::paintRadio):
+ (WebCore::RenderThemeSafari::paintButton):
+ (WebCore::RenderThemeSafari::paintTextField):
+ (WebCore::RenderThemeSafari::paintCapsLockIndicator):
+ (WebCore::RenderThemeSafari::paintTextArea):
+ (WebCore::RenderThemeSafari::paintMenuList):
+ (WebCore::RenderThemeSafari::paintSliderThumb):
+ (WebCore::RenderThemeSafari::paintSearchField):
+ (WebCore::RenderThemeSafari::paintSearchFieldCancelButton):
+ (WebCore::RenderThemeSafari::paintSearchFieldResultsDecoration):
+ (WebCore::RenderThemeSafari::paintSearchFieldResultsButton):
+
2007-11-05 Kevin Ollivier <kevino@theolliviers.com>
Adding the rest of wx port's graphics impl.
bool RenderThemeSafari::isControlStyled(const RenderStyle* style, const BorderData& border,
const BackgroundLayer& background, const Color& backgroundColor) const
{
+ // If we didn't find SafariTheme.dll we won't be able to paint any themed controls.
+ if (!paintThemePart)
+ return true;
+
if (style->appearance() == TextFieldAppearance || style->appearance() == TextAreaAppearance || style->appearance() == ListboxAppearance)
return style->border() != border;
return RenderTheme::isControlStyled(style, border, background, backgroundColor);
bool RenderThemeSafari::paintCheckbox(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
{
+ ASSERT(paintThemePart);
+
NSControlSize controlSize = controlSizeForFont(o->style());
IntRect inflatedRect = inflateRect(r, checkboxSizes()[controlSize], checkboxMargins(controlSize));
bool RenderThemeSafari::paintRadio(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
{
+ ASSERT(paintThemePart);
+
NSControlSize controlSize = controlSizeForFont(o->style());
IntRect inflatedRect = inflateRect(r, radioSizes()[controlSize], radioMargins(controlSize));
bool RenderThemeSafari::paintButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
{
+ ASSERT(paintThemePart);
+
// We inflate the rect as needed to account for padding included in the cell to accommodate the button
// shadow. We don't consider this part of the bounds of the control in WebKit.
bool RenderThemeSafari::paintTextField(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
{
+ ASSERT(paintThemePart);
+
paintThemePart(TextFieldPart, paintInfo.context->platformContext(), r, (NSControlSize)0, determineState(o) & ~FocusedState);
return false;
}
bool RenderThemeSafari::paintCapsLockIndicator(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
{
#if defined(SAFARI_THEME_VERSION) && SAFARI_THEME_VERSION >= 1
+ ASSERT(paintThemePart);
+
if (paintInfo.context->paintingDisabled())
return true;
bool RenderThemeSafari::paintTextArea(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
{
+ ASSERT(paintThemePart);
+
paintThemePart(TextAreaPart, paintInfo.context->platformContext(), r, (NSControlSize)0, determineState(o) & ~FocusedState);
return false;
}
bool RenderThemeSafari::paintMenuList(RenderObject* o, const RenderObject::PaintInfo& info, const IntRect& r)
{
+ ASSERT(paintThemePart);
+
NSControlSize controlSize = controlSizeFromRect(r, popupButtonSizes());
IntRect inflatedRect = r;
IntSize size = popupButtonSizes()[controlSize];
bool RenderThemeSafari::paintSliderThumb(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
{
+ ASSERT(paintThemePart);
+
ASSERT(o->parent()->isSlider());
bool pressed = static_cast<RenderSlider*>(o->parent())->inDragMode();
bool RenderThemeSafari::paintSearchField(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
{
+ ASSERT(paintThemePart);
+
paintThemePart(SearchFieldPart, paintInfo.context->platformContext(), r, controlSizeFromRect(r, searchFieldSizes()), determineState(o));
return false;
}
bool RenderThemeSafari::paintSearchFieldCancelButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect&)
{
+ ASSERT(paintThemePart);
+
Node* input = o->node()->shadowAncestorNode();
ASSERT(input);
RenderObject* renderer = input->renderer();
bool RenderThemeSafari::paintSearchFieldResultsDecoration(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect&)
{
+ ASSERT(paintThemePart);
+
Node* input = o->node()->shadowAncestorNode();
ASSERT(input);
RenderObject* renderer = input->renderer();
bool RenderThemeSafari::paintSearchFieldResultsButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect&)
{
+ ASSERT(paintThemePart);
+
Node* input = o->node()->shadowAncestorNode();
ASSERT(input);
RenderObject* renderer = input->renderer();