+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
}
}
-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)
}
// Menulists should have visible overflow
- if (style->appearance() == MenulistAppearance) {
+ if (style->appearance() == MenulistPart) {
style->setOverflowX(OVISIBLE);
style->setOverflowY(OVISIBLE);
}
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
searchfield-cancel-button
textfield
textarea
+caps-lock-indicator
#
# CSS_PROP_BORDER_IMAGE
}
}
-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;
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);
}
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())
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;
void RenderThemeGtk::setCheckboxSize(RenderStyle* style) const
{
- setToggleSize(style, RadioAppearance);
+ setToggleSize(style, RadioPart);
}
bool RenderThemeGtk::paintCheckbox(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& rect)
void RenderThemeGtk::setRadioSize(RenderStyle* style) const
{
- setToggleSize(style, RadioAppearance);
+ setToggleSize(style, RadioPart);
}
bool RenderThemeGtk::paintRadio(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& rect)
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);
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);
}
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.
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:
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;
}
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,
size = QSize(checkBoxWidth, checkBoxWidth);
break;
}
- case RadioAppearance: {
+ case RadioPart: {
QStyleOption styleOption;
styleOption.state |= QStyle::State_Small;
int radioWidth = applicationStyle->pixelMetric(QStyle::PM_ExclusiveIndicatorWidth,
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"));
break;
}
- case MenulistAppearance: {
+ case MenulistPart: {
QStyleOptionComboBox styleOption;
styleOption.state |= QStyle::State_Small;
int contentHeight = qMax(fm.lineSpacing(), 14) + 2;
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;
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);
}
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.
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);
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);
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
void RenderThemeQt::adjustSliderThumbSize(RenderObject* o) const
{
- if (o->style()->appearance() == MediaSliderThumbAppearance) {
+ if (o->style()->appearance() == MediaSliderThumbPart) {
RenderStyle* parentStyle = o->parent()->style();
Q_ASSERT(parentStyle);
#endif
private:
- bool supportsFocus(EAppearance) const;
+ bool supportsFocus(ControlPart) const;
EAppearance applyTheme(QStyleOption&, RenderObject*) const;
style->setTop(oldStyle->top());
}
- if (parentStyle->appearance() == SliderVerticalAppearance)
- style->setAppearance(SliderThumbVerticalAppearance);
- else if (parentStyle->appearance() == SliderHorizontalAppearance)
- style->setAppearance(SliderThumbHorizontalAppearance);
- else if (parentStyle->appearance() == MediaSliderAppearance)
- style->setAppearance(MediaSliderThumbAppearance);
+ if (parentStyle->appearance() == SliderVerticalPart)
+ style->setAppearance(SliderThumbVerticalPart);
+ else if (parentStyle->appearance() == SliderHorizontalPart)
+ style->setAppearance(SliderThumbHorizontalPart);
+ else if (parentStyle->appearance() == MediaSliderPart)
+ style->setAppearance(MediaSliderThumbPart);
return style.release();
}
if (m_thumb->renderer()->style()->hasAppearance())
theme()->adjustSliderThumbSize(m_thumb->renderer());
- if (style()->appearance() == SliderVerticalAppearance) {
+ if (style()->appearance() == SliderVerticalPart) {
// FIXME: Handle percentage widths correctly. See http://bugs.webkit.org/show_bug.cgi?id=12104
m_thumb->renderer()->style()->setLeft(Length(contentWidth() / 2 - m_thumb->renderer()->style()->width().value() / 2, Fixed));
} else {
// Calculate the new value based on the position
double factor = (double)position / (double)trackSize();
- if (style()->appearance() == SliderVerticalAppearance)
+ if (style()->appearance() == SliderVerticalPart)
factor = 1.0 - factor;
double val = minVal + factor * (maxVal - minVal);
// Calculate the new position based on the value
double factor = (val - minVal) / (maxVal - minVal);
- if (style()->appearance() == SliderVerticalAppearance)
+ if (style()->appearance() == SliderVerticalPart)
factor = 1.0 - factor;
setCurrentPosition((int)(factor * trackSize()));
return 0;
int position;
- if (style()->appearance() == SliderVerticalAppearance)
+ if (style()->appearance() == SliderVerticalPart)
position = p.y() - m_thumb->renderer()->height() / 2;
else
position = p.x() - m_thumb->renderer()->width() / 2;
if (!m_thumb || !m_thumb->renderer())
return 0;
- if (style()->appearance() == SliderVerticalAppearance)
+ if (style()->appearance() == SliderVerticalPart)
return m_thumb->renderer()->style()->top().value();
return m_thumb->renderer()->style()->left().value();
}
if (!m_thumb || !m_thumb->renderer())
return;
- if (style()->appearance() == SliderVerticalAppearance)
+ if (style()->appearance() == SliderVerticalPart)
m_thumb->renderer()->style()->setTop(Length(pos, Fixed));
else
m_thumb->renderer()->style()->setLeft(Length(pos, Fixed));
if (!m_thumb || !m_thumb->renderer())
return 0;
- if (style()->appearance() == SliderVerticalAppearance)
+ if (style()->appearance() == SliderVerticalPart)
return contentHeight() - m_thumb->renderer()->height();
return contentWidth() - m_thumb->renderer()->width();
}
style->setDisplay(BLOCK);
if (UAHasAppearance && theme()->isControlStyled(style, border, background, backgroundColor)) {
- if (style->appearance() == MenulistAppearance)
- style->setAppearance(MenulistButtonAppearance);
+ if (style->appearance() == MenulistPart)
+ style->setAppearance(MenulistButtonPart);
else
- style->setAppearance(NoAppearance);
+ style->setAppearance(NoControlPart);
}
// Call the appropriate style adjustment method based off the appearance value.
switch (style->appearance()) {
- case CheckboxAppearance:
+ case CheckboxPart:
return adjustCheckboxStyle(selector, style, e);
- case RadioAppearance:
+ case RadioPart:
return adjustRadioStyle(selector, style, e);
- case PushButtonAppearance:
- case SquareButtonAppearance:
- case DefaultButtonAppearance:
- case ButtonAppearance:
+ case PushButtonPart:
+ case SquareButtonPart:
+ case DefaultButtonPart:
+ case ButtonPart:
return adjustButtonStyle(selector, style, e);
- case TextFieldAppearance:
+ case TextFieldPart:
return adjustTextFieldStyle(selector, style, e);
- case TextAreaAppearance:
+ case TextAreaPart:
return adjustTextAreaStyle(selector, style, e);
- case MenulistAppearance:
+ case MenulistPart:
return adjustMenuListStyle(selector, style, e);
- case MenulistButtonAppearance:
+ case MenulistButtonPart:
return adjustMenuListButtonStyle(selector, style, e);
- case MediaSliderAppearance:
- case SliderHorizontalAppearance:
- case SliderVerticalAppearance:
+ case MediaSliderPart:
+ case SliderHorizontalPart:
+ case SliderVerticalPart:
return adjustSliderTrackStyle(selector, style, e);
- case SliderThumbHorizontalAppearance:
- case SliderThumbVerticalAppearance:
+ case SliderThumbHorizontalPart:
+ case SliderThumbVerticalPart:
return adjustSliderThumbStyle(selector, style, e);
- case SearchFieldAppearance:
+ case SearchFieldPart:
return adjustSearchFieldStyle(selector, style, e);
- case SearchFieldCancelButtonAppearance:
+ case SearchFieldCancelButtonPart:
return adjustSearchFieldCancelButtonStyle(selector, style, e);
- case SearchFieldDecorationAppearance:
+ case SearchFieldDecorationPart:
return adjustSearchFieldDecorationStyle(selector, style, e);
- case SearchFieldResultsDecorationAppearance:
+ case SearchFieldResultsDecorationPart:
return adjustSearchFieldResultsDecorationStyle(selector, style, e);
- case SearchFieldResultsButtonAppearance:
+ case SearchFieldResultsButtonPart:
return adjustSearchFieldResultsButtonStyle(selector, style, e);
default:
break;
// Call the appropriate paint method based off the appearance value.
switch (o->style()->appearance()) {
- case CheckboxAppearance:
+ case CheckboxPart:
return paintCheckbox(o, paintInfo, r);
- case RadioAppearance:
+ case RadioPart:
return paintRadio(o, paintInfo, r);
- case PushButtonAppearance:
- case SquareButtonAppearance:
- case DefaultButtonAppearance:
- case ButtonAppearance:
+ case PushButtonPart:
+ case SquareButtonPart:
+ case DefaultButtonPart:
+ case ButtonPart:
return paintButton(o, paintInfo, r);
- case MenulistAppearance:
+ case MenulistPart:
return paintMenuList(o, paintInfo, r);
- case SliderHorizontalAppearance:
- case SliderVerticalAppearance:
+ case SliderHorizontalPart:
+ case SliderVerticalPart:
return paintSliderTrack(o, paintInfo, r);
- case SliderThumbHorizontalAppearance:
- case SliderThumbVerticalAppearance:
+ case SliderThumbHorizontalPart:
+ case SliderThumbVerticalPart:
if (o->parent()->isSlider())
return paintSliderThumb(o, paintInfo, r);
// We don't support drawing a slider thumb without a parent slider
break;
- case MediaFullscreenButtonAppearance:
+ case MediaFullscreenButtonPart:
return paintMediaFullscreenButton(o, paintInfo, r);
- case MediaPlayButtonAppearance:
+ case MediaPlayButtonPart:
return paintMediaPlayButton(o, paintInfo, r);
- case MediaMuteButtonAppearance:
+ case MediaMuteButtonPart:
return paintMediaMuteButton(o, paintInfo, r);
- case MediaSeekBackButtonAppearance:
+ case MediaSeekBackButtonPart:
return paintMediaSeekBackButton(o, paintInfo, r);
- case MediaSeekForwardButtonAppearance:
+ case MediaSeekForwardButtonPart:
return paintMediaSeekForwardButton(o, paintInfo, r);
- case MediaSliderAppearance:
+ case MediaSliderPart:
return paintMediaSliderTrack(o, paintInfo, r);
- case MediaSliderThumbAppearance:
+ case MediaSliderThumbPart:
if (o->parent()->isSlider())
return paintMediaSliderThumb(o, paintInfo, r);
break;
- case MenulistButtonAppearance:
- case TextFieldAppearance:
- case TextAreaAppearance:
- case ListboxAppearance:
+ case MenulistButtonPart:
+ case TextFieldPart:
+ case TextAreaPart:
+ case ListboxPart:
return true;
- case SearchFieldAppearance:
+ case SearchFieldPart:
return paintSearchField(o, paintInfo, r);
- case SearchFieldCancelButtonAppearance:
+ case SearchFieldCancelButtonPart:
return paintSearchFieldCancelButton(o, paintInfo, r);
- case SearchFieldDecorationAppearance:
+ case SearchFieldDecorationPart:
return paintSearchFieldDecoration(o, paintInfo, r);
- case SearchFieldResultsDecorationAppearance:
+ case SearchFieldResultsDecorationPart:
return paintSearchFieldResultsDecoration(o, paintInfo, r);
- case SearchFieldResultsButtonAppearance:
+ case SearchFieldResultsButtonPart:
return paintSearchFieldResultsButton(o, paintInfo, r);
default:
break;
// Call the appropriate paint method based off the appearance value.
switch (o->style()->appearance()) {
- case TextFieldAppearance:
+ case TextFieldPart:
return paintTextField(o, paintInfo, r);
- case ListboxAppearance:
- case TextAreaAppearance:
+ case ListboxPart:
+ case TextAreaPart:
return paintTextArea(o, paintInfo, r);
- case MenulistButtonAppearance:
+ case MenulistButtonPart:
return true;
- case CheckboxAppearance:
- case RadioAppearance:
- case PushButtonAppearance:
- case SquareButtonAppearance:
- case DefaultButtonAppearance:
- case ButtonAppearance:
- case MenulistAppearance:
- case SliderHorizontalAppearance:
- case SliderVerticalAppearance:
- case SliderThumbHorizontalAppearance:
- case SliderThumbVerticalAppearance:
- case SearchFieldAppearance:
- case SearchFieldCancelButtonAppearance:
- case SearchFieldDecorationAppearance:
- case SearchFieldResultsDecorationAppearance:
- case SearchFieldResultsButtonAppearance:
+ case CheckboxPart:
+ case RadioPart:
+ case PushButtonPart:
+ case SquareButtonPart:
+ case DefaultButtonPart:
+ case ButtonPart:
+ case MenulistPart:
+ case SliderHorizontalPart:
+ case SliderVerticalPart:
+ case SliderThumbHorizontalPart:
+ case SliderThumbVerticalPart:
+ case SearchFieldPart:
+ case SearchFieldCancelButtonPart:
+ case SearchFieldDecorationPart:
+ case SearchFieldResultsDecorationPart:
+ case SearchFieldResultsButtonPart:
default:
break;
}
// Call the appropriate paint method based off the appearance value.
switch (o->style()->appearance()) {
- case MenulistButtonAppearance:
+ case MenulistButtonPart:
return paintMenuListButton(o, paintInfo, r);
- case TextFieldAppearance:
- case TextAreaAppearance:
- case ListboxAppearance:
- case CheckboxAppearance:
- case RadioAppearance:
- case PushButtonAppearance:
- case SquareButtonAppearance:
- case DefaultButtonAppearance:
- case ButtonAppearance:
- case MenulistAppearance:
- case SliderHorizontalAppearance:
- case SliderVerticalAppearance:
- case SliderThumbHorizontalAppearance:
- case SliderThumbVerticalAppearance:
- case SearchFieldAppearance:
- case SearchFieldCancelButtonAppearance:
- case SearchFieldDecorationAppearance:
- case SearchFieldResultsDecorationAppearance:
- case SearchFieldResultsButtonAppearance:
+ case TextFieldPart:
+ case TextAreaPart:
+ case ListboxPart:
+ case CheckboxPart:
+ case RadioPart:
+ case PushButtonPart:
+ case SquareButtonPart:
+ case DefaultButtonPart:
+ case ButtonPart:
+ case MenulistPart:
+ case SliderHorizontalPart:
+ case SliderVerticalPart:
+ case SliderThumbHorizontalPart:
+ case SliderThumbVerticalPart:
+ case SearchFieldPart:
+ case SearchFieldCancelButtonPart:
+ case SearchFieldDecorationPart:
+ case SearchFieldResultsDecorationPart:
+ case SearchFieldResultsButtonPart:
default:
break;
}
return o->height() + o->marginTop();
}
-bool RenderTheme::isControlContainer(EAppearance appearance) const
+bool RenderTheme::isControlContainer(ControlPart appearance) const
{
// There are more leaves than this, but we'll patch this function as we add support for
// more controls.
- return appearance != CheckboxAppearance && appearance != RadioAppearance;
+ return appearance != CheckboxPart && appearance != RadioPart;
}
bool RenderTheme::isControlStyled(const RenderStyle* style, const BorderData& border, const FillLayer& background,
const Color& backgroundColor) const
{
switch (style->appearance()) {
- case PushButtonAppearance:
- case SquareButtonAppearance:
- case DefaultButtonAppearance:
- case ButtonAppearance:
- case ListboxAppearance:
- case MenulistAppearance:
+ case PushButtonPart:
+ case SquareButtonPart:
+ case DefaultButtonPart:
+ case ButtonPart:
+ case ListboxPart:
+ case MenulistPart:
// FIXME: Uncomment this when making search fields style-able.
- // case SearchFieldAppearance:
- case TextFieldAppearance:
- case TextAreaAppearance:
+ // case SearchFieldPart:
+ case TextFieldPart:
+ case TextAreaPart:
// Test the style to see if the UA border and background match.
return (style->border() != border ||
*style->backgroundLayers() != background ||
bool RenderTheme::supportsFocusRing(const RenderStyle* style) const
{
- return (style->hasAppearance() && style->appearance() != TextFieldAppearance && style->appearance() != TextAreaAppearance && style->appearance() != MenulistButtonAppearance && style->appearance() != ListboxAppearance);
+ return (style->hasAppearance() && style->appearance() != TextFieldPart && style->appearance() != TextAreaPart && style->appearance() != MenulistButtonPart && style->appearance() != ListboxPart);
}
bool RenderTheme::stateChanged(RenderObject* o, ControlState state) const
if (!o->style())
return false;
- return o->style()->appearance() == DefaultButtonAppearance;
+ return o->style()->appearance() == DefaultButtonPart;
}
void RenderTheme::adjustCheckboxStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const
// A method for asking if a control is a container or not. Leaf controls have to have some special behavior (like
// the baseline position API above).
- virtual bool isControlContainer(EAppearance) const;
+ bool isControlContainer(ControlPart) const;
// A method asking if the control changes its tint when the window has focus or not.
virtual bool controlSupportsTints(const RenderObject*) const { return false; }
bool RenderThemeMac::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;
return RenderTheme::isControlStyled(style, border, background, backgroundColor);
}
float zoomLevel = o->style()->effectiveZoom();
switch (o->style()->appearance()) {
- case CheckboxAppearance: {
+ case CheckboxPart: {
// Since we query the prototype cell, we need to update its state to match.
setCheckboxCellState(o, r);
r = inflateRect(r, size, checkboxMargins(), zoomLevel);
break;
}
- case RadioAppearance: {
+ case RadioPart: {
// Since we query the prototype cell, we need to update its state to match.
setRadioCellState(o, r);
r = inflateRect(r, size, radioMargins(), zoomLevel);
break;
}
- case PushButtonAppearance:
- case DefaultButtonAppearance:
- case ButtonAppearance: {
+ case PushButtonPart:
+ case DefaultButtonPart:
+ case ButtonPart: {
// Since we query the prototype cell, we need to update its state to match.
setButtonCellState(o, r);
}
break;
}
- case MenulistAppearance: {
+ case MenulistPart: {
setPopupButtonCellState(o, r);
IntSize size = popupButtonSizes()[[popupButton() controlSize]];
size.setHeight(size.height() * zoomLevel);
int RenderThemeMac::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 * o->style()->effectiveZoom(); // The baseline is 2px up from the bottom of the checkbox/radio in AppKit.
return RenderTheme::baselinePosition(o);
}
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.
// Determine our control size based off our font.
NSControlSize controlSize = controlSizeForFont(style);
- if (style->appearance() == PushButtonAppearance) {
+ if (style->appearance() == PushButtonPart) {
// Ditch the border.
style->resetBorder();
NSButtonCell* button = this->button();
// Set the control size based off the rectangle we're painting into.
- if (o->style()->appearance() == SquareButtonAppearance ||
+ if (o->style()->appearance() == SquareButtonPart ||
r.height() > buttonSizes()[NSRegularControlSize].height() * o->style()->effectiveZoom()) {
// Use the square button
if ([button bezelStyle] != NSShadowlessSquareBezelStyle)
int RenderThemeMac::popupInternalPaddingLeft(RenderStyle* style) const
{
- if (style->appearance() == MenulistAppearance)
+ if (style->appearance() == MenulistPart)
return popupButtonPadding(controlSizeForFont(style))[leftPadding] * style->effectiveZoom();
- if (style->appearance() == MenulistButtonAppearance)
+ if (style->appearance() == MenulistButtonPart)
return styledPopupPaddingLeft * style->effectiveZoom();
return 0;
}
int RenderThemeMac::popupInternalPaddingRight(RenderStyle* style) const
{
- if (style->appearance() == MenulistAppearance)
+ if (style->appearance() == MenulistPart)
return popupButtonPadding(controlSizeForFont(style))[rightPadding] * style->effectiveZoom();
- if (style->appearance() == MenulistButtonAppearance) {
+ if (style->appearance() == MenulistButtonPart) {
float fontScale = style->fontSize() / baseFontSize;
float arrowWidth = baseArrowWidth * fontScale;
return static_cast<int>(ceilf(arrowWidth + (arrowPaddingLeft + arrowPaddingRight + paddingBeforeSeparator) * style->effectiveZoom()));
int RenderThemeMac::popupInternalPaddingTop(RenderStyle* style) const
{
- if (style->appearance() == MenulistAppearance)
+ if (style->appearance() == MenulistPart)
return popupButtonPadding(controlSizeForFont(style))[topPadding] * style->effectiveZoom();
- if (style->appearance() == MenulistButtonAppearance)
+ if (style->appearance() == MenulistButtonPart)
return styledPopupPaddingTop * style->effectiveZoom();
return 0;
}
int RenderThemeMac::popupInternalPaddingBottom(RenderStyle* style) const
{
- if (style->appearance() == MenulistAppearance)
+ if (style->appearance() == MenulistPart)
return popupButtonPadding(controlSizeForFont(style))[bottomPadding] * style->effectiveZoom();
- if (style->appearance() == MenulistButtonAppearance)
+ if (style->appearance() == MenulistButtonPart)
return styledPopupPaddingBottom * style->effectiveZoom();
return 0;
}
float zoomLevel = o->style()->effectiveZoom();
float zoomedTrackWidth = trackWidth * zoomLevel;
- if (o->style()->appearance() == SliderHorizontalAppearance || o->style()->appearance() == MediaSliderAppearance) {
+ if (o->style()->appearance() == SliderHorizontalPart || o->style()->appearance() == MediaSliderPart) {
bounds.setHeight(zoomedTrackWidth);
bounds.setY(r.y() + r.height() / 2 - zoomedTrackWidth / 2);
- } else if (o->style()->appearance() == SliderVerticalAppearance) {
+ } else if (o->style()->appearance() == SliderVerticalPart) {
bounds.setWidth(zoomedTrackWidth);
bounds.setX(r.x() + r.width() / 2 - zoomedTrackWidth / 2);
}
struct CGFunctionCallbacks mainCallbacks = { 0, TrackGradientInterpolate, NULL };
RetainPtr<CGFunctionRef> mainFunction(AdoptCF, CGFunctionCreate(NULL, 1, NULL, 4, NULL, &mainCallbacks));
RetainPtr<CGShadingRef> mainShading;
- if (o->style()->appearance() == SliderVerticalAppearance)
+ if (o->style()->appearance() == SliderVerticalPart)
mainShading.adoptCF(CGShadingCreateAxial(cspace.get(), CGPointMake(bounds.x(), bounds.bottom()), CGPointMake(bounds.right(), bounds.bottom()), mainFunction.get(), false, false));
else
mainShading.adoptCF(CGShadingCreateAxial(cspace.get(), CGPointMake(bounds.x(), bounds.y()), CGPointMake(bounds.x(), bounds.bottom()), mainFunction.get(), false, false));
{
ASSERT(o->parent()->isSlider());
- NSSliderCell* sliderThumbCell = o->style()->appearance() == SliderThumbVerticalAppearance
+ NSSliderCell* sliderThumbCell = o->style()->appearance() == SliderThumbVerticalPart
? sliderThumbVertical()
: sliderThumbHorizontal();
// Update the pressed state using the NSCell tracking methods, since that's how NSSliderCell keeps track of it.
bool oldPressed;
- if (o->style()->appearance() == SliderThumbVerticalAppearance)
+ if (o->style()->appearance() == SliderThumbVerticalPart)
oldPressed = m_isSliderThumbVerticalPressed;
else
oldPressed = m_isSliderThumbHorizontalPressed;
bool pressed = static_cast<RenderSlider*>(o->parent())->inDragMode();
- if (o->style()->appearance() == SliderThumbVerticalAppearance)
+ if (o->style()->appearance() == SliderThumbVerticalPart)
m_isSliderThumbVerticalPressed = pressed;
else
m_isSliderThumbHorizontalPressed = pressed;
FloatRect bounds = r;
// Make the height of the vertical slider slightly larger so NSSliderCell will draw a vertical slider.
- if (o->style()->appearance() == SliderThumbVerticalAppearance)
+ if (o->style()->appearance() == SliderThumbVerticalPart)
bounds.setHeight(bounds.height() + verticalSliderHeightPadding * o->style()->effectiveZoom());
paintInfo.context->save();
void RenderThemeMac::adjustSliderThumbSize(RenderObject* o) const
{
float zoomLevel = o->style()->effectiveZoom();
- if (o->style()->appearance() == SliderThumbHorizontalAppearance || o->style()->appearance() == SliderThumbVerticalAppearance) {
+ if (o->style()->appearance() == SliderThumbHorizontalPart || o->style()->appearance() == SliderThumbVerticalPart) {
o->style()->setWidth(Length(static_cast<int>(sliderThumbWidth * zoomLevel), Fixed));
o->style()->setHeight(Length(static_cast<int>(sliderThumbHeight * zoomLevel), Fixed));
- } else if (o->style()->appearance() == MediaSliderThumbAppearance) {
+ } else if (o->style()->appearance() == MediaSliderThumbPart) {
o->style()->setWidth(Length(mediaSliderThumbWidth, Fixed));
o->style()->setHeight(Length(mediaSliderThumbHeight, Fixed));
}
if (!SafariThemeLibrary())
return true;
- if (style->appearance() == TextFieldAppearance || style->appearance() == TextAreaAppearance || style->appearance() == ListboxAppearance)
+ if (style->appearance() == TextFieldPart || style->appearance() == TextAreaPart || style->appearance() == ListboxPart)
return style->border() != border;
return RenderTheme::isControlStyled(style, border, background, backgroundColor);
}
NSControlSize controlSize = controlSizeForFont(o->style());
switch (o->style()->appearance()) {
- case CheckboxAppearance: {
+ case CheckboxPart: {
// We inflate the rect as needed to account for padding included in the cell to accommodate the checkbox
// shadow" and the check. We don't consider this part of the bounds of the control in WebKit.
r = inflateRect(r, checkboxSizes()[controlSize], checkboxMargins(controlSize));
break;
}
- case RadioAppearance: {
+ case RadioPart: {
// We inflate the rect as needed to account for padding included in the cell to accommodate the checkbox
// shadow" and the check. We don't consider this part of the bounds of the control in WebKit.
r = inflateRect(r, radioSizes()[controlSize], radioMargins(controlSize));
break;
}
- case PushButtonAppearance:
- case DefaultButtonAppearance:
- case ButtonAppearance: {
+ case PushButtonPart:
+ case DefaultButtonPart:
+ case ButtonPart: {
// We inflate the rect as needed to account for padding included in the cell to accommodate the checkbox
// shadow" and the check. We don't consider this part of the bounds of the control in WebKit.
if (r.height() <= buttonSizes()[NSRegularControlSize].height())
r = inflateRect(r, buttonSizes()[controlSize], buttonMargins(controlSize));
break;
}
- case MenulistAppearance: {
+ case MenulistPart: {
r = inflateRect(r, popupButtonSizes()[controlSize], popupButtonMargins(controlSize));
break;
}
int RenderThemeSafari::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; // The baseline is 2px up from the bottom of the checkbox/radio in AppKit.
return RenderTheme::baselinePosition(o);
}
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.
// Determine our control size based off our font.
NSControlSize controlSize = controlSizeForFont(style);
- if (style->appearance() == PushButtonAppearance) {
+ if (style->appearance() == PushButtonPart) {
// Ditch the border.
style->resetBorder();
int RenderThemeSafari::popupInternalPaddingLeft(RenderStyle* style) const
{
- if (style->appearance() == MenulistAppearance)
+ if (style->appearance() == MenulistPart)
return popupButtonPadding(controlSizeForFont(style))[leftPadding];
- if (style->appearance() == MenulistButtonAppearance)
+ if (style->appearance() == MenulistButtonPart)
return styledPopupPaddingLeft;
return 0;
}
int RenderThemeSafari::popupInternalPaddingRight(RenderStyle* style) const
{
- if (style->appearance() == MenulistAppearance)
+ if (style->appearance() == MenulistPart)
return popupButtonPadding(controlSizeForFont(style))[rightPadding];
- if (style->appearance() == MenulistButtonAppearance) {
+ if (style->appearance() == MenulistButtonPart) {
float fontScale = style->fontSize() / baseFontSize;
float arrowWidth = baseArrowWidth * fontScale;
return static_cast<int>(ceilf(arrowWidth + arrowPaddingLeft + arrowPaddingRight + paddingBeforeSeparator));
int RenderThemeSafari::popupInternalPaddingTop(RenderStyle* style) const
{
- if (style->appearance() == MenulistAppearance)
+ if (style->appearance() == MenulistPart)
return popupButtonPadding(controlSizeForFont(style))[topPadding];
- if (style->appearance() == MenulistButtonAppearance)
+ if (style->appearance() == MenulistButtonPart)
return styledPopupPaddingTop;
return 0;
}
int RenderThemeSafari::popupInternalPaddingBottom(RenderStyle* style) const
{
- if (style->appearance() == MenulistAppearance)
+ if (style->appearance() == MenulistPart)
return popupButtonPadding(controlSizeForFont(style))[bottomPadding];
- if (style->appearance() == MenulistButtonAppearance)
+ if (style->appearance() == MenulistButtonPart)
return styledPopupPaddingBottom;
return 0;
}
{
IntRect bounds = r;
- if (o->style()->appearance() == SliderHorizontalAppearance ||
- o->style()->appearance() == MediaSliderAppearance) {
+ if (o->style()->appearance() == SliderHorizontalPart ||
+ o->style()->appearance() == MediaSliderPart) {
bounds.setHeight(trackWidth);
bounds.setY(r.y() + r.height() / 2 - trackWidth / 2);
- } else if (o->style()->appearance() == SliderVerticalAppearance) {
+ } else if (o->style()->appearance() == SliderVerticalPart) {
bounds.setWidth(trackWidth);
bounds.setX(r.x() + r.width() / 2 - trackWidth / 2);
}
struct CGFunctionCallbacks mainCallbacks = { 0, TrackGradientInterpolate, NULL };
RetainPtr<CGFunctionRef> mainFunction(AdoptCF, CGFunctionCreate(NULL, 1, NULL, 4, NULL, &mainCallbacks));
RetainPtr<CGShadingRef> mainShading;
- if (o->style()->appearance() == SliderVerticalAppearance)
+ if (o->style()->appearance() == SliderVerticalPart)
mainShading.adoptCF(CGShadingCreateAxial(cspace.get(), CGPointMake(bounds.x(), bounds.bottom()), CGPointMake(bounds.right(), bounds.bottom()), mainFunction.get(), false, false));
else
mainShading.adoptCF(CGShadingCreateAxial(cspace.get(), CGPointMake(bounds.x(), bounds.y()), CGPointMake(bounds.x(), bounds.bottom()), mainFunction.get(), false, false));
void RenderThemeSafari::adjustSliderThumbSize(RenderObject* o) const
{
- if (o->style()->appearance() == SliderThumbHorizontalAppearance || o->style()->appearance() == SliderThumbVerticalAppearance) {
+ if (o->style()->appearance() == SliderThumbHorizontalPart || o->style()->appearance() == SliderThumbVerticalPart) {
o->style()->setWidth(Length(sliderThumbWidth, Fixed));
o->style()->setHeight(Length(sliderThumbHeight, Fixed));
- } else if (o->style()->appearance() == MediaSliderThumbAppearance) {
+ } else if (o->style()->appearance() == MediaSliderThumbPart) {
o->style()->setWidth(Length(mediaSliderThumbWidth, Fixed));
o->style()->setHeight(Length(mediaSliderThumbHeight, Fixed));
}
}
}
-bool RenderThemeWin::supportsFocus(EAppearance appearance)
+bool RenderThemeWin::supportsFocus(ControlPart appearance)
{
switch (appearance) {
- case PushButtonAppearance:
- case ButtonAppearance:
- case DefaultButtonAppearance:
- case TextFieldAppearance:
- case TextAreaAppearance:
+ case PushButtonPart:
+ case ButtonPart:
+ case DefaultButtonPart:
+ case TextFieldPart:
+ case TextAreaPart:
return true;
- case MenulistAppearance:
+ case MenulistPart:
return false;
default:
return false;
{
unsigned state = 0;
switch (o->style()->appearance()) {
- case PushButtonAppearance:
- case ButtonAppearance:
- case DefaultButtonAppearance:
+ case PushButtonPart:
+ case ButtonPart:
+ case DefaultButtonPart:
state = DFCS_BUTTONPUSH;
if (!isEnabled(o))
state |= DFCS_INACTIVE;
else if (isPressed(o))
state |= DFCS_PUSHED;
break;
- case RadioAppearance:
- case CheckboxAppearance:
- state = (o->style()->appearance() == RadioAppearance) ? DFCS_BUTTONRADIO : DFCS_BUTTONCHECK;
+ case RadioPart:
+ case CheckboxPart:
+ state = (o->style()->appearance() == RadioPart) ? DFCS_BUTTONRADIO : DFCS_BUTTONCHECK;
if (isChecked(o))
state |= DFCS_CHECKED;
if (!isEnabled(o))
else if (isPressed(o))
state |= DFCS_PUSHED;
break;
- case MenulistAppearance:
+ case MenulistPart:
state = DFCS_SCROLLCOMBOBOX;
if (!isEnabled(o))
state |= DFCS_INACTIVE;
{
ThemeData result;
switch (o->style()->appearance()) {
- case PushButtonAppearance:
- case ButtonAppearance:
- case DefaultButtonAppearance:
- case CheckboxAppearance:
- case RadioAppearance:
+ case PushButtonPart:
+ case ButtonPart:
+ case DefaultButtonPart:
+ case CheckboxPart:
+ case RadioPart:
result.m_part = DFC_BUTTON;
result.m_state = determineClassicState(o);
break;
- case MenulistAppearance:
+ case MenulistPart:
result.m_part = DFC_SCROLL;
result.m_state = determineClassicState(o);
break;
- case TextFieldAppearance:
- case TextAreaAppearance:
+ case TextFieldPart:
+ case TextAreaPart:
result.m_part = TFP_TEXTFIELD;
result.m_state = determineState(o);
break;
- case SliderHorizontalAppearance:
+ case SliderHorizontalPart:
result.m_part = TKP_TRACK;
result.m_state = TS_NORMAL;
break;
- case SliderVerticalAppearance:
+ case SliderVerticalPart:
result.m_part = TKP_TRACKVERT;
result.m_state = TS_NORMAL;
break;
- case SliderThumbHorizontalAppearance:
+ case SliderThumbHorizontalPart:
result.m_part = TKP_THUMBBOTTOM;
result.m_state = determineSliderThumbState(o);
break;
- case SliderThumbVerticalAppearance:
+ case SliderThumbVerticalPart:
result.m_part = TKP_THUMBRIGHT;
result.m_state = determineSliderThumbState(o);
break;
ThemeData result;
switch (o->style()->appearance()) {
- case PushButtonAppearance:
- case ButtonAppearance:
- case DefaultButtonAppearance:
+ case PushButtonPart:
+ case ButtonPart:
+ case DefaultButtonPart:
result.m_part = BP_BUTTON;
result.m_state = determineButtonState(o);
break;
- case CheckboxAppearance:
+ case CheckboxPart:
result.m_part = BP_CHECKBOX;
result.m_state = determineState(o);
break;
- case MenulistAppearance:
- case MenulistButtonAppearance:
+ case MenulistPart:
+ case MenulistButtonPart:
result.m_part = CP_DROPDOWNBUTTON;
result.m_state = determineState(o);
break;
- case RadioAppearance:
+ case RadioPart:
result.m_part = BP_RADIO;
result.m_state = determineState(o);
break;
- case TextFieldAppearance:
- case TextAreaAppearance:
+ case TextFieldPart:
+ case TextAreaPart:
result.m_part = TFP_TEXTFIELD;
result.m_state = determineState(o);
break;
- case SliderHorizontalAppearance:
+ case SliderHorizontalPart:
result.m_part = TKP_TRACK;
result.m_state = TS_NORMAL;
break;
- case SliderVerticalAppearance:
+ case SliderVerticalPart:
result.m_part = TKP_TRACKVERT;
result.m_state = TS_NORMAL;
break;
- case SliderThumbHorizontalAppearance:
+ case SliderThumbHorizontalPart:
result.m_part = TKP_THUMBBOTTOM;
result.m_state = determineSliderThumbState(o);
break;
- case SliderThumbVerticalAppearance:
+ case SliderThumbVerticalPart:
result.m_part = TKP_THUMBRIGHT;
result.m_state = determineSliderThumbState(o);
break;
} else if (themeData.m_part == TKP_TRACK || themeData.m_part == TKP_TRACKVERT) {
::DrawEdge(hdc, &widgetRect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
::FillRect(hdc, &widgetRect, (HBRUSH)GetStockObject(GRAY_BRUSH));
- } else if ((o->style()->appearance() == SliderThumbHorizontalAppearance ||
- o->style()->appearance() == SliderThumbVerticalAppearance) &&
+ } else if ((o->style()->appearance() == SliderThumbHorizontalPart ||
+ o->style()->appearance() == SliderThumbVerticalPart) &&
(themeData.m_part == TKP_THUMBBOTTOM || themeData.m_part == TKP_THUMBTOP ||
themeData.m_part == TKP_THUMBLEFT || themeData.m_part == TKP_THUMBRIGHT)) {
::DrawEdge(hdc, &widgetRect, EDGE_RAISED, BF_RECT | BF_SOFT | BF_MIDDLE | BF_ADJUST);
}
} else {
// Push buttons, buttons, checkboxes and radios, and the dropdown arrow in menulists.
- if (o->style()->appearance() == DefaultButtonAppearance) {
+ if (o->style()->appearance() == DefaultButtonPart) {
HBRUSH brush = ::GetSysColorBrush(COLOR_3DDKSHADOW);
::FrameRect(hdc, &widgetRect, brush);
::InflateRect(&widgetRect, -1, -1);
{
IntRect bounds = r;
- if (o->style()->appearance() == SliderHorizontalAppearance) {
+ if (o->style()->appearance() == SliderHorizontalPart) {
bounds.setHeight(trackWidth);
bounds.setY(r.y() + r.height() / 2 - trackWidth / 2);
- } else if (o->style()->appearance() == SliderVerticalAppearance) {
+ } else if (o->style()->appearance() == SliderVerticalPart) {
bounds.setWidth(trackWidth);
bounds.setX(r.x() + r.width() / 2 - trackWidth / 2);
}
void RenderThemeWin::adjustSliderThumbSize(RenderObject* o) const
{
- if (o->style()->appearance() == SliderThumbVerticalAppearance) {
+ if (o->style()->appearance() == SliderThumbVerticalPart) {
o->style()->setWidth(Length(sliderThumbHeight, Fixed));
o->style()->setHeight(Length(sliderThumbWidth, Fixed));
- } else if (o->style()->appearance() == SliderThumbHorizontalAppearance) {
+ } else if (o->style()->appearance() == SliderThumbHorizontalPart) {
o->style()->setWidth(Length(sliderThumbWidth, Fixed));
o->style()->setHeight(Length(sliderThumbHeight, Fixed));
}
unsigned determineSliderThumbState(RenderObject*);
unsigned determineButtonState(RenderObject*);
- bool supportsFocus(EAppearance);
+ bool supportsFocus(ControlPart);
ThemeData getThemeData(RenderObject*);
ThemeData getClassicThemeData(RenderObject* o);
#include "StyleTransformData.h"
#include "StyleVisualData.h"
#include "TextDirection.h"
+#include "ThemeTypes.h"
#include "TimingFunction.h"
#include "TransformOperations.h"
#include <wtf/OwnPtr.h>
return background->m_background.hasImage();
}
bool hasFixedBackgroundImage() const { return background->m_background.hasFixedImage(); }
- bool hasAppearance() const { return appearance() != NoAppearance; }
+ bool hasAppearance() const { return appearance() != NoControlPart; }
bool visuallyOrdered() const { return inherited_flags._visuallyOrdered; }
void setVisuallyOrdered(bool b) { inherited_flags._visuallyOrdered = b; }
float textStrokeWidth() const { return rareInheritedData->textStrokeWidth; }
const Color& textFillColor() const { return rareInheritedData->textFillColor; }
float opacity() const { return rareNonInheritedData->opacity; }
- EAppearance appearance() const { return static_cast<EAppearance>(rareNonInheritedData->m_appearance); }
+ ControlPart appearance() const { return static_cast<ControlPart>(rareNonInheritedData->m_appearance); }
EBoxAlignment boxAlign() const { return static_cast<EBoxAlignment>(rareNonInheritedData->flexibleBox->align); }
EBoxDirection boxDirection() const { return static_cast<EBoxDirection>(inherited_flags._box_direction); }
float boxFlex() { return rareNonInheritedData->flexibleBox->flex; }
void setTextStrokeWidth(float w) { SET_VAR(rareInheritedData, textStrokeWidth, w) }
void setTextFillColor(const Color& c) { SET_VAR(rareInheritedData, textFillColor, c) }
void setOpacity(float f) { SET_VAR(rareNonInheritedData, opacity, f); }
- void setAppearance(EAppearance a) { SET_VAR(rareNonInheritedData, m_appearance, a); }
+ void setAppearance(ControlPart a) { SET_VAR(rareNonInheritedData, m_appearance, a); }
void setBoxAlign(EBoxAlignment a) { SET_VAR(rareNonInheritedData.access()->flexibleBox, align, a); }
void setBoxDirection(EBoxDirection d) { inherited_flags._box_direction = d; }
void setBoxFlex(float f) { SET_VAR(rareNonInheritedData.access()->flexibleBox, flex, f); }
static const AtomicString& initialHighlight() { return nullAtom; }
static EBorderFit initialBorderFit() { return BorderFitBorder; }
static EResize initialResize() { return RESIZE_NONE; }
- static EAppearance initialAppearance() { return NoAppearance; }
+ static ControlPart initialAppearance() { return NoControlPart; }
static bool initialVisuallyOrdered() { return false; }
static float initialTextStrokeWidth() { return 0; }
static unsigned short initialColumnCount() { return 1; }
RESIZE_NONE, RESIZE_BOTH, RESIZE_HORIZONTAL, RESIZE_VERTICAL
};
-enum EAppearance {
- NoAppearance, CheckboxAppearance, RadioAppearance, PushButtonAppearance, SquareButtonAppearance, ButtonAppearance,
- ButtonBevelAppearance, DefaultButtonAppearance, ListboxAppearance, ListItemAppearance,
- MediaFullscreenButtonAppearance, MediaMuteButtonAppearance, MediaPlayButtonAppearance,
- MediaSeekBackButtonAppearance, MediaSeekForwardButtonAppearance, MediaSliderAppearance, MediaSliderThumbAppearance,
- MenulistAppearance, MenulistButtonAppearance, MenulistTextAppearance, MenulistTextFieldAppearance,
- ScrollbarButtonUpAppearance, ScrollbarButtonDownAppearance,
- ScrollbarButtonLeftAppearance, ScrollbarButtonRightAppearance,
- ScrollbarTrackHorizontalAppearance, ScrollbarTrackVerticalAppearance,
- ScrollbarThumbHorizontalAppearance, ScrollbarThumbVerticalAppearance,
- ScrollbarGripperHorizontalAppearance, ScrollbarGripperVerticalAppearance,
- SliderHorizontalAppearance, SliderVerticalAppearance, SliderThumbHorizontalAppearance,
- SliderThumbVerticalAppearance, CaretAppearance, SearchFieldAppearance, SearchFieldDecorationAppearance,
- SearchFieldResultsDecorationAppearance, SearchFieldResultsButtonAppearance,
- SearchFieldCancelButtonAppearance, TextFieldAppearance, TextAreaAppearance
-};
-
enum EListStyleType {
DISC, CIRCLE, SQUARE, LDECIMAL, DECIMAL_LEADING_ZERO,
LOWER_ROMAN, UPPER_ROMAN, LOWER_GREEK,