Commit 5cdc5e04 authored by hyatt@apple.com's avatar hyatt@apple.com

2008-10-17 David Hyatt <hyatt@apple.com>

        Eliminate the EAppearance enum in favor of the new ControlPart enum.  Cut out the scrollbar
        values from the enum since they are handled by ScrollbarTheme instead.

        Reviewed by Tim Hatcher

        * css/CSSPrimitiveValueMappings.h:
        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
        (WebCore::CSSPrimitiveValue::operator ControlPart):
        * css/CSSStyleSelector.cpp:
        (WebCore::CSSStyleSelector::adjustRenderStyle):
        * css/CSSValueKeywords.in:
        * platform/gtk/RenderThemeGtk.cpp:
        (WebCore::supportsFocus):
        (WebCore::RenderThemeGtk::baselinePosition):
        (WebCore::setToggleSize):
        (WebCore::RenderThemeGtk::setCheckboxSize):
        (WebCore::RenderThemeGtk::setRadioSize):
        (WebCore::RenderThemeGtk::adjustButtonStyle):
        * platform/qt/RenderThemeQt.cpp:
        (WebCore::RenderThemeQt::baselinePosition):
        (WebCore::RenderThemeQt::controlSupportsTints):
        (WebCore::RenderThemeQt::adjustRepaintRect):
        (WebCore::RenderThemeQt::isControlStyled):
        (WebCore::computeSizeBasedOnStyle):
        (WebCore::RenderThemeQt::paintButton):
        (WebCore::RenderThemeQt::paintTextField):
        (WebCore::RenderThemeQt::paintMenuList):
        (WebCore::RenderThemeQt::supportsFocus):
        (WebCore::RenderThemeQt::applyTheme):
        (WebCore::RenderThemeQt::adjustSliderThumbSize):
        * platform/qt/RenderThemeQt.h:
        * rendering/RenderSlider.cpp:
        (WebCore::RenderSlider::createThumbStyle):
        (WebCore::RenderSlider::layout):
        (WebCore::RenderSlider::setValueForPosition):
        (WebCore::RenderSlider::setPositionFromValue):
        (WebCore::RenderSlider::positionForOffset):
        (WebCore::RenderSlider::currentPosition):
        (WebCore::RenderSlider::setCurrentPosition):
        (WebCore::RenderSlider::trackSize):
        * rendering/RenderTheme.cpp:
        (WebCore::RenderTheme::adjustStyle):
        (WebCore::RenderTheme::paint):
        (WebCore::RenderTheme::paintBorderOnly):
        (WebCore::RenderTheme::paintDecorations):
        (WebCore::RenderTheme::isControlContainer):
        (WebCore::RenderTheme::isControlStyled):
        (WebCore::RenderTheme::supportsFocusRing):
        (WebCore::RenderTheme::isDefault):
        * rendering/RenderTheme.h:
        * rendering/RenderThemeMac.mm:
        (WebCore::RenderThemeMac::isControlStyled):
        (WebCore::RenderThemeMac::adjustRepaintRect):
        (WebCore::RenderThemeMac::baselinePosition):
        (WebCore::RenderThemeMac::controlSupportsTints):
        (WebCore::RenderThemeMac::adjustButtonStyle):
        (WebCore::RenderThemeMac::setButtonCellState):
        (WebCore::RenderThemeMac::popupInternalPaddingLeft):
        (WebCore::RenderThemeMac::popupInternalPaddingRight):
        (WebCore::RenderThemeMac::popupInternalPaddingTop):
        (WebCore::RenderThemeMac::popupInternalPaddingBottom):
        (WebCore::RenderThemeMac::paintSliderTrack):
        (WebCore::RenderThemeMac::paintSliderThumb):
        (WebCore::RenderThemeMac::adjustSliderThumbSize):
        * rendering/RenderThemeSafari.cpp:
        (WebCore::RenderThemeSafari::isControlStyled):
        (WebCore::RenderThemeSafari::adjustRepaintRect):
        (WebCore::RenderThemeSafari::baselinePosition):
        (WebCore::RenderThemeSafari::controlSupportsTints):
        (WebCore::RenderThemeSafari::adjustButtonStyle):
        (WebCore::RenderThemeSafari::popupInternalPaddingLeft):
        (WebCore::RenderThemeSafari::popupInternalPaddingRight):
        (WebCore::RenderThemeSafari::popupInternalPaddingTop):
        (WebCore::RenderThemeSafari::popupInternalPaddingBottom):
        (WebCore::RenderThemeSafari::paintSliderTrack):
        (WebCore::RenderThemeSafari::adjustSliderThumbSize):
        * rendering/RenderThemeWin.cpp:
        (WebCore::RenderThemeWin::supportsFocus):
        (WebCore::RenderThemeWin::determineClassicState):
        (WebCore::RenderThemeWin::getClassicThemeData):
        (WebCore::RenderThemeWin::getThemeData):
        (WebCore::drawControl):
        (WebCore::RenderThemeWin::paintSliderTrack):
        (WebCore::RenderThemeWin::adjustSliderThumbSize):
        * rendering/RenderThemeWin.h:
        * rendering/style/RenderStyle.h:
        (WebCore::InheritedFlags::hasAppearance):
        (WebCore::InheritedFlags::appearance):
        (WebCore::InheritedFlags::setAppearance):
        (WebCore::InheritedFlags::initialAppearance):
        * rendering/style/RenderStyleConstants.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37663 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 084394f0
2008-10-17 David Hyatt <hyatt@apple.com>
Eliminate the EAppearance enum in favor of the new ControlPart enum. Cut out the scrollbar
values from the enum since they are handled by ScrollbarTheme instead.
Reviewed by Tim Hatcher
* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator ControlPart):
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::adjustRenderStyle):
* css/CSSValueKeywords.in:
* platform/gtk/RenderThemeGtk.cpp:
(WebCore::supportsFocus):
(WebCore::RenderThemeGtk::baselinePosition):
(WebCore::setToggleSize):
(WebCore::RenderThemeGtk::setCheckboxSize):
(WebCore::RenderThemeGtk::setRadioSize):
(WebCore::RenderThemeGtk::adjustButtonStyle):
* platform/qt/RenderThemeQt.cpp:
(WebCore::RenderThemeQt::baselinePosition):
(WebCore::RenderThemeQt::controlSupportsTints):
(WebCore::RenderThemeQt::adjustRepaintRect):
(WebCore::RenderThemeQt::isControlStyled):
(WebCore::computeSizeBasedOnStyle):
(WebCore::RenderThemeQt::paintButton):
(WebCore::RenderThemeQt::paintTextField):
(WebCore::RenderThemeQt::paintMenuList):
(WebCore::RenderThemeQt::supportsFocus):
(WebCore::RenderThemeQt::applyTheme):
(WebCore::RenderThemeQt::adjustSliderThumbSize):
* platform/qt/RenderThemeQt.h:
* rendering/RenderSlider.cpp:
(WebCore::RenderSlider::createThumbStyle):
(WebCore::RenderSlider::layout):
(WebCore::RenderSlider::setValueForPosition):
(WebCore::RenderSlider::setPositionFromValue):
(WebCore::RenderSlider::positionForOffset):
(WebCore::RenderSlider::currentPosition):
(WebCore::RenderSlider::setCurrentPosition):
(WebCore::RenderSlider::trackSize):
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::adjustStyle):
(WebCore::RenderTheme::paint):
(WebCore::RenderTheme::paintBorderOnly):
(WebCore::RenderTheme::paintDecorations):
(WebCore::RenderTheme::isControlContainer):
(WebCore::RenderTheme::isControlStyled):
(WebCore::RenderTheme::supportsFocusRing):
(WebCore::RenderTheme::isDefault):
* rendering/RenderTheme.h:
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::isControlStyled):
(WebCore::RenderThemeMac::adjustRepaintRect):
(WebCore::RenderThemeMac::baselinePosition):
(WebCore::RenderThemeMac::controlSupportsTints):
(WebCore::RenderThemeMac::adjustButtonStyle):
(WebCore::RenderThemeMac::setButtonCellState):
(WebCore::RenderThemeMac::popupInternalPaddingLeft):
(WebCore::RenderThemeMac::popupInternalPaddingRight):
(WebCore::RenderThemeMac::popupInternalPaddingTop):
(WebCore::RenderThemeMac::popupInternalPaddingBottom):
(WebCore::RenderThemeMac::paintSliderTrack):
(WebCore::RenderThemeMac::paintSliderThumb):
(WebCore::RenderThemeMac::adjustSliderThumbSize):
* rendering/RenderThemeSafari.cpp:
(WebCore::RenderThemeSafari::isControlStyled):
(WebCore::RenderThemeSafari::adjustRepaintRect):
(WebCore::RenderThemeSafari::baselinePosition):
(WebCore::RenderThemeSafari::controlSupportsTints):
(WebCore::RenderThemeSafari::adjustButtonStyle):
(WebCore::RenderThemeSafari::popupInternalPaddingLeft):
(WebCore::RenderThemeSafari::popupInternalPaddingRight):
(WebCore::RenderThemeSafari::popupInternalPaddingTop):
(WebCore::RenderThemeSafari::popupInternalPaddingBottom):
(WebCore::RenderThemeSafari::paintSliderTrack):
(WebCore::RenderThemeSafari::adjustSliderThumbSize):
* rendering/RenderThemeWin.cpp:
(WebCore::RenderThemeWin::supportsFocus):
(WebCore::RenderThemeWin::determineClassicState):
(WebCore::RenderThemeWin::getClassicThemeData):
(WebCore::RenderThemeWin::getThemeData):
(WebCore::drawControl):
(WebCore::RenderThemeWin::paintSliderTrack):
(WebCore::RenderThemeWin::adjustSliderThumbSize):
* rendering/RenderThemeWin.h:
* rendering/style/RenderStyle.h:
(WebCore::InheritedFlags::hasAppearance):
(WebCore::InheritedFlags::appearance):
(WebCore::InheritedFlags::setAppearance):
(WebCore::InheritedFlags::initialAppearance):
* rendering/style/RenderStyleConstants.h:
2008-10-17 David Hyatt <hyatt@apple.com>
Beginning of the RenderTheme re-architecture (to share more code). Add the new Theme API header
......
......@@ -161,148 +161,121 @@ template<> inline CSSPrimitiveValue::operator CompositeOperator() const
}
}
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EAppearance e)
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ControlPart e)
: m_type(CSS_IDENT)
{
switch (e) {
case NoAppearance:
case NoControlPart:
m_value.ident = CSSValueNone;
break;
case CheckboxAppearance:
case CheckboxPart:
m_value.ident = CSSValueCheckbox;
break;
case RadioAppearance:
case RadioPart:
m_value.ident = CSSValueRadio;
break;
case PushButtonAppearance:
case PushButtonPart:
m_value.ident = CSSValuePushButton;
break;
case SquareButtonAppearance:
case SquareButtonPart:
m_value.ident = CSSValueSquareButton;
break;
case ButtonAppearance:
case ButtonPart:
m_value.ident = CSSValueButton;
break;
case ButtonBevelAppearance:
case ButtonBevelPart:
m_value.ident = CSSValueButtonBevel;
break;
case DefaultButtonAppearance:
case DefaultButtonPart:
m_value.ident = CSSValueDefaultButton;
break;
case ListboxAppearance:
case ListboxPart:
m_value.ident = CSSValueListbox;
break;
case ListItemAppearance:
case ListItemPart:
m_value.ident = CSSValueListitem;
break;
case MediaFullscreenButtonAppearance:
case MediaFullscreenButtonPart:
m_value.ident = CSSValueMediaFullscreenButton;
break;
case MediaPlayButtonAppearance:
case MediaPlayButtonPart:
m_value.ident = CSSValueMediaPlayButton;
break;
case MediaMuteButtonAppearance:
case MediaMuteButtonPart:
m_value.ident = CSSValueMediaMuteButton;
break;
case MediaSeekBackButtonAppearance:
case MediaSeekBackButtonPart:
m_value.ident = CSSValueMediaSeekBackButton;
break;
case MediaSeekForwardButtonAppearance:
case MediaSeekForwardButtonPart:
m_value.ident = CSSValueMediaSeekForwardButton;
break;
case MediaSliderAppearance:
case MediaSliderPart:
m_value.ident = CSSValueMediaSlider;
break;
case MediaSliderThumbAppearance:
case MediaSliderThumbPart:
m_value.ident = CSSValueMediaSliderthumb;
break;
case MenulistAppearance:
case MenulistPart:
m_value.ident = CSSValueMenulist;
break;
case MenulistButtonAppearance:
case MenulistButtonPart:
m_value.ident = CSSValueMenulistButton;
break;
case MenulistTextAppearance:
case MenulistTextPart:
m_value.ident = CSSValueMenulistText;
break;
case MenulistTextFieldAppearance:
case MenulistTextFieldPart:
m_value.ident = CSSValueMenulistTextfield;
break;
case ScrollbarButtonUpAppearance:
m_value.ident = CSSValueScrollbarbuttonUp;
break;
case ScrollbarButtonDownAppearance:
m_value.ident = CSSValueScrollbarbuttonDown;
break;
case ScrollbarButtonLeftAppearance:
m_value.ident = CSSValueScrollbarbuttonLeft;
break;
case ScrollbarButtonRightAppearance:
m_value.ident = CSSValueScrollbarbuttonRight;
break;
case ScrollbarTrackHorizontalAppearance:
m_value.ident = CSSValueScrollbartrackHorizontal;
break;
case ScrollbarTrackVerticalAppearance:
m_value.ident = CSSValueScrollbartrackVertical;
break;
case ScrollbarThumbHorizontalAppearance:
m_value.ident = CSSValueScrollbarthumbHorizontal;
break;
case ScrollbarThumbVerticalAppearance:
m_value.ident = CSSValueScrollbarthumbVertical;
break;
case ScrollbarGripperHorizontalAppearance:
m_value.ident = CSSValueScrollbargripperHorizontal;
break;
case ScrollbarGripperVerticalAppearance:
m_value.ident = CSSValueScrollbargripperVertical;
break;
case SliderHorizontalAppearance:
case SliderHorizontalPart:
m_value.ident = CSSValueSliderHorizontal;
break;
case SliderVerticalAppearance:
case SliderVerticalPart:
m_value.ident = CSSValueSliderVertical;
break;
case SliderThumbHorizontalAppearance:
case SliderThumbHorizontalPart:
m_value.ident = CSSValueSliderthumbHorizontal;
break;
case SliderThumbVerticalAppearance:
case SliderThumbVerticalPart:
m_value.ident = CSSValueSliderthumbVertical;
break;
case CaretAppearance:
case CaretPart:
m_value.ident = CSSValueCaret;
break;
case SearchFieldAppearance:
case SearchFieldPart:
m_value.ident = CSSValueSearchfield;
break;
case SearchFieldDecorationAppearance:
case SearchFieldDecorationPart:
m_value.ident = CSSValueSearchfieldDecoration;
break;
case SearchFieldResultsDecorationAppearance:
case SearchFieldResultsDecorationPart:
m_value.ident = CSSValueSearchfieldResultsDecoration;
break;
case SearchFieldResultsButtonAppearance:
case SearchFieldResultsButtonPart:
m_value.ident = CSSValueSearchfieldResultsButton;
break;
case SearchFieldCancelButtonAppearance:
case SearchFieldCancelButtonPart:
m_value.ident = CSSValueSearchfieldCancelButton;
break;
case TextFieldAppearance:
case TextFieldPart:
m_value.ident = CSSValueTextfield;
break;
case TextAreaAppearance:
case TextAreaPart:
m_value.ident = CSSValueTextarea;
break;
case CapsLockIndicatorPart:
m_value.ident = CSSValueCapsLockIndicator;
break;
}
}
template<> inline CSSPrimitiveValue::operator EAppearance() const
template<> inline CSSPrimitiveValue::operator ControlPart() const
{
if (m_value.ident == CSSValueNone)
return NoAppearance;
return NoControlPart;
else
return EAppearance(m_value.ident - CSSValueCheckbox + 1);
return ControlPart(m_value.ident - CSSValueCheckbox + 1);
}
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFillBox e)
......
......@@ -1452,7 +1452,7 @@ void CSSStyleSelector::adjustRenderStyle(RenderStyle* style, Element *e)
}
// Menulists should have visible overflow
if (style->appearance() == MenulistAppearance) {
if (style->appearance() == MenulistPart) {
style->setOverflowX(OVISIBLE);
style->setOverflowY(OVISIBLE);
}
......
......@@ -508,16 +508,6 @@ menulist
menulist-button
menulist-text
menulist-textfield
scrollbarbutton-up
scrollbarbutton-down
scrollbarbutton-left
scrollbarbutton-right
scrollbartrack-horizontal
scrollbartrack-vertical
scrollbarthumb-horizontal
scrollbarthumb-vertical
scrollbargripper-horizontal
scrollbargripper-vertical
slider-horizontal
slider-vertical
sliderthumb-horizontal
......@@ -530,6 +520,7 @@ searchfield-results-button
searchfield-cancel-button
textfield
textarea
caps-lock-indicator
#
# CSS_PROP_BORDER_IMAGE
......
......@@ -53,17 +53,17 @@ RenderThemeGtk::RenderThemeGtk()
}
}
static bool supportsFocus(EAppearance appearance)
static bool supportsFocus(ControlPart appearance)
{
switch (appearance) {
case PushButtonAppearance:
case ButtonAppearance:
case TextFieldAppearance:
case TextAreaAppearance:
case SearchFieldAppearance:
case MenulistAppearance:
case RadioAppearance:
case CheckboxAppearance:
case PushButtonPart:
case ButtonPart:
case TextFieldPart:
case TextAreaPart:
case SearchFieldPart:
case MenulistPart:
case RadioPart:
case CheckboxPart:
return true;
default:
return false;
......@@ -83,8 +83,8 @@ bool RenderThemeGtk::controlSupportsTints(const RenderObject* o) const
int RenderThemeGtk::baselinePosition(const RenderObject* o) const
{
// FIXME: This strategy is possibly incorrect for the GTK+ port.
if (o->style()->appearance() == CheckboxAppearance ||
o->style()->appearance() == RadioAppearance)
if (o->style()->appearance() == CheckboxPart ||
o->style()->appearance() == RadioPart)
return o->marginTop() + o->height() - 2;
return RenderTheme::baselinePosition(o);
}
......@@ -194,7 +194,7 @@ static void setButtonPadding(RenderStyle* style)
style->setPaddingBottom(Length(padding / 2, Fixed));
}
static void setToggleSize(RenderStyle* style, EAppearance appearance)
static void setToggleSize(RenderStyle* style, ControlPart appearance)
{
// The width and height are both specified, so we shouldn't change them.
if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto())
......@@ -204,11 +204,11 @@ static void setToggleSize(RenderStyle* style, EAppearance appearance)
gint indicator_size, indicator_spacing;
switch (appearance) {
case CheckboxAppearance:
case CheckboxPart:
if (moz_gtk_checkbox_get_metrics(&indicator_size, &indicator_spacing) != MOZ_GTK_SUCCESS)
return;
break;
case RadioAppearance:
case RadioPart:
if (moz_gtk_radio_get_metrics(&indicator_size, &indicator_spacing) != MOZ_GTK_SUCCESS)
return;
break;
......@@ -228,7 +228,7 @@ static void setToggleSize(RenderStyle* style, EAppearance appearance)
void RenderThemeGtk::setCheckboxSize(RenderStyle* style) const
{
setToggleSize(style, RadioAppearance);
setToggleSize(style, RadioPart);
}
bool RenderThemeGtk::paintCheckbox(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& rect)
......@@ -238,7 +238,7 @@ bool RenderThemeGtk::paintCheckbox(RenderObject* o, const RenderObject::PaintInf
void RenderThemeGtk::setRadioSize(RenderStyle* style) const
{
setToggleSize(style, RadioAppearance);
setToggleSize(style, RadioPart);
}
bool RenderThemeGtk::paintRadio(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& rect)
......@@ -249,7 +249,7 @@ bool RenderThemeGtk::paintRadio(RenderObject* o, const RenderObject::PaintInfo&
void RenderThemeGtk::adjustButtonStyle(CSSStyleSelector* selector, RenderStyle* style, WebCore::Element* e) const
{
// FIXME: Is this condition necessary?
if (style->appearance() == PushButtonAppearance) {
if (style->appearance() == PushButtonPart) {
style->resetBorder();
style->setHeight(Length(Auto));
style->setWhiteSpace(PRE);
......
......@@ -151,8 +151,8 @@ bool RenderThemeQt::supportsFocusRing(const RenderStyle* style) const
int RenderThemeQt::baselinePosition(const RenderObject* o) const
{
if (o->style()->appearance() == CheckboxAppearance ||
o->style()->appearance() == RadioAppearance)
if (o->style()->appearance() == CheckboxPart ||
o->style()->appearance() == RadioPart)
return o->marginTop() + o->height() - 2; // Same as in old khtml
return RenderTheme::baselinePosition(o);
}
......@@ -163,7 +163,7 @@ bool RenderThemeQt::controlSupportsTints(const RenderObject* o) const
return false;
// Checkboxes only have tint when checked.
if (o->style()->appearance() == CheckboxAppearance)
if (o->style()->appearance() == CheckboxPart)
return isChecked(o);
// For now assume other controls have tint if enabled.
......@@ -198,19 +198,19 @@ static QRect inflateButtonRect(const QRect& originalRect)
void RenderThemeQt::adjustRepaintRect(const RenderObject* o, IntRect& r)
{
switch (o->style()->appearance()) {
case CheckboxAppearance: {
case CheckboxPart: {
break;
}
case RadioAppearance: {
case RadioPart: {
break;
}
case PushButtonAppearance:
case ButtonAppearance: {
case PushButtonPart:
case ButtonPart: {
QRect inflatedRect = inflateButtonRect(r);
r = IntRect(inflatedRect.x(), inflatedRect.y(), inflatedRect.width(), inflatedRect.height());
break;
}
case MenulistAppearance: {
case MenulistPart: {
break;
}
default:
......@@ -221,9 +221,9 @@ void RenderThemeQt::adjustRepaintRect(const RenderObject* o, IntRect& r)
bool RenderThemeQt::isControlStyled(const RenderStyle* style, const BorderData& border,
const FillLayer& background, const Color& backgroundColor) const
{
if (style->appearance() == TextFieldAppearance
|| style->appearance() == TextAreaAppearance
|| style->appearance() == ListboxAppearance) {
if (style->appearance() == TextFieldPart
|| style->appearance() == TextAreaPart
|| style->appearance() == ListboxPart) {
return style->border() != border;
}
......@@ -276,7 +276,7 @@ static void computeSizeBasedOnStyle(RenderStyle* renderStyle)
QStyle* applicationStyle = QApplication::style();
switch (renderStyle->appearance()) {
case CheckboxAppearance: {
case CheckboxPart: {
QStyleOption styleOption;
styleOption.state |= QStyle::State_Small;
int checkBoxWidth = applicationStyle->pixelMetric(QStyle::PM_IndicatorWidth,
......@@ -284,7 +284,7 @@ static void computeSizeBasedOnStyle(RenderStyle* renderStyle)
size = QSize(checkBoxWidth, checkBoxWidth);
break;
}
case RadioAppearance: {
case RadioPart: {
QStyleOption styleOption;
styleOption.state |= QStyle::State_Small;
int radioWidth = applicationStyle->pixelMetric(QStyle::PM_ExclusiveIndicatorWidth,
......@@ -292,8 +292,8 @@ static void computeSizeBasedOnStyle(RenderStyle* renderStyle)
size = QSize(radioWidth, radioWidth);
break;
}
case PushButtonAppearance:
case ButtonAppearance: {
case PushButtonPart:
case ButtonPart: {
QStyleOptionButton styleOption;
styleOption.state |= QStyle::State_Small;
QSize contentSize = fm.size(Qt::TextShowMnemonic, QString::fromLatin1("X"));
......@@ -315,7 +315,7 @@ static void computeSizeBasedOnStyle(RenderStyle* renderStyle)
break;
}
case MenulistAppearance: {
case MenulistPart: {
QStyleOptionComboBox styleOption;
styleOption.state |= QStyle::State_Small;
int contentHeight = qMax(fm.lineSpacing(), 14) + 2;
......@@ -326,7 +326,7 @@ static void computeSizeBasedOnStyle(RenderStyle* renderStyle)
size.setHeight(menuListSize.height());
break;
}
case TextFieldAppearance: {
case TextFieldPart: {
const int verticalMargin = 1;
const int horizontalMargin = 2;
int h = qMax(fm.lineSpacing(), 14) + 2*verticalMargin;
......@@ -461,13 +461,13 @@ bool RenderThemeQt::paintButton(RenderObject* o, const RenderObject::PaintInfo&
option.rect = r;
option.state |= QStyle::State_Small;
EAppearance appearance = applyTheme(option, o);
if(appearance == PushButtonAppearance || appearance == ButtonAppearance) {
ControlPart appearance = applyTheme(option, o);
if(appearance == PushButtonPart || appearance == ButtonPart) {
option.rect = inflateButtonRect(option.rect);
p.drawControl(QStyle::CE_PushButton, option);
} else if(appearance == RadioAppearance) {
} else if(appearance == RadioPart) {
p.drawControl(QStyle::CE_RadioButton, option);
} else if(appearance == CheckboxAppearance) {
} else if(appearance == CheckboxPart) {
p.drawControl(QStyle::CE_CheckBox, option);
}
......@@ -496,11 +496,11 @@ bool RenderThemeQt::paintTextField(RenderObject* o, const RenderObject::PaintInf
panel.features = QStyleOptionFrameV2::None;
// Get the correct theme data for a text field
EAppearance appearance = applyTheme(panel, o);
if (appearance != TextFieldAppearance
&& appearance != SearchFieldAppearance
&& appearance != TextAreaAppearance
&& appearance != ListboxAppearance)
ControlPart appearance = applyTheme(panel, o);
if (appearance != TextFieldPart
&& appearance != SearchFieldPart
&& appearance != TextAreaPart
&& appearance != ListboxPart)
return true;
// Now paint the text field.
......@@ -560,7 +560,7 @@ bool RenderThemeQt::paintMenuList(RenderObject* o, const RenderObject::PaintInfo
QStyleOptionComboBox opt;
if (p.widget)
opt.initFrom(p.widget);
EAppearance appearance = applyTheme(opt, o);
ControlPart appearance = applyTheme(opt, o);
const QPoint topLeft = r.topLeft();
p.painter->translate(topLeft);
......@@ -686,24 +686,24 @@ bool RenderThemeQt::paintSearchFieldResultsDecoration(RenderObject* o, const Ren
return RenderTheme::paintSearchFieldResultsDecoration(o, pi, r);
}
bool RenderThemeQt::supportsFocus(EAppearance appearance) const
bool RenderThemeQt::supportsFocus(ControlPart appearance) const
{
switch (appearance) {
case PushButtonAppearance:
case ButtonAppearance:
case TextFieldAppearance:
case TextAreaAppearance:
case ListboxAppearance:
case MenulistAppearance:
case RadioAppearance:
case CheckboxAppearance:
case PushButtonPart:
case ButtonPart:
case TextFieldPart:
case TextAreaPart:
case ListboxPart:
case MenulistPart:
case RadioPart:
case CheckboxPart:
return true;
default: // No for all others...
return false;
}
}
EAppearance RenderThemeQt::applyTheme(QStyleOption& option, RenderObject* o) const
ControlPart RenderThemeQt::applyTheme(QStyleOption& option, RenderObject* o) const
{
// Default bits: no focus, no mouse over
option.state &= ~(QStyle::State_HasFocus | QStyle::State_MouseOver);
......@@ -721,32 +721,26 @@ EAppearance RenderThemeQt::applyTheme(QStyleOption& option, RenderObject* o) con
if (isHovered(o))
option.state |= QStyle::State_MouseOver;
EAppearance result = o->style()->appearance();
ControlPart result = o->style()->appearance();
switch (result) {
case PushButtonAppearance:
case SquareButtonAppearance:
case ButtonAppearance:
case ButtonBevelAppearance:
case ListItemAppearance:
case MenulistButtonAppearance:
case ScrollbarButtonLeftAppearance:
case ScrollbarButtonRightAppearance:
case ScrollbarTrackHorizontalAppearance:
case ScrollbarTrackVerticalAppearance:
case ScrollbarThumbHorizontalAppearance:
case ScrollbarThumbVerticalAppearance:
case SearchFieldResultsButtonAppearance:
case SearchFieldCancelButtonAppearance: {
case PushButtonPart:
case SquareButtonPart:
case ButtonPart:
case ButtonBevelPart:
case ListItemPart:
case MenulistButtonPart:
case SearchFieldResultsButtonPart:
case SearchFieldCancelButtonPart: {
if (isPressed(o))
option.state |= QStyle::State_Sunken;
else if (result == PushButtonAppearance)
else if (result == PushButtonPart)
option.state |= QStyle::State_Raised;
break;
}
}
if(result == RadioAppearance || result == CheckboxAppearance)
if(result == RadioPart || result == CheckboxPart)
option.state |= (isChecked(o) ? QStyle::State_On : QStyle::State_Off);
// If the webview has a custom palette, use it
......@@ -938,7 +932,7 @@ bool RenderThemeQt::paintMediaSliderThumb(RenderObject* o, const RenderObject::P