+2013-12-14 Andreas Kling <akling@apple.com>
+
+ Page::theme() should return a reference.
+ <https://webkit.org/b/125737>
+
+ There's always a RenderTheme, and not a single call site was checking
+ for null pointers anyway. Updated RenderObject::theme() as well.
+
+ Reviewed by Antti Koivisto.
+
2013-12-13 Sam Weinig <sam@webkit.org>
CTTE: Convert Element and RenderObject iterator usage to use range-based for loops
IntRect r = quads[i].enclosingBoundingBox();
if (!r.isEmpty()) {
if (obj->style().hasAppearance())
- obj->theme()->adjustRepaintRect(obj, r);
+ obj->theme().adjustRepaintRect(obj, r);
result.unite(r);
}
}
if (id <= 0)
return false;
- color = document->page()->theme()->systemColor(id).rgb();
+ color = document->page()->theme().systemColor(id).rgb();
return true;
}
if (reactsToPress)
setNeedsStyleRecalc();
- if (renderer()->style().hasAppearance() && renderer()->theme()->stateChanged(renderer(), PressedState))
+ if (renderer()->style().hasAppearance() && renderer()->theme().stateChanged(renderer(), PressedState))
reactsToPress = true;
// The rest of this function implements a feature that only works if the
setNeedsStyleRecalc();
if (renderer()->style().hasAppearance())
- renderer()->theme()->stateChanged(renderer(), HoverState);
+ renderer()->theme().stateChanged(renderer(), HoverState);
}
void Element::scrollIntoView(bool alignToTop)
element->setNeedsStyleRecalc();
if (RenderObject* renderer = element->renderer())
if (renderer && renderer->style().hasAppearance())
- renderer->theme()->stateChanged(renderer, FocusState);
+ renderer->theme().stateChanged(renderer, FocusState);
}
}
// Start blinking with a black caret. Be sure not to restart if we're
// already blinking in the right location.
if (shouldBlink && !m_caretBlinkTimer.isActive()) {
- if (double blinkInterval = m_frame->page()->theme()->caretBlinkInterval())
+ if (double blinkInterval = m_frame->page()->theme().caretBlinkInterval())
m_caretBlinkTimer.startRepeating(blinkInterval);
if (!m_caretPaint) {
setNeedsWillValidateCheck();
setNeedsStyleRecalc();
if (renderer() && renderer()->style().hasAppearance())
- renderer()->theme()->stateChanged(renderer(), ReadOnlyState);
+ renderer()->theme().stateChanged(renderer(), ReadOnlyState);
}
} else if (name == requiredAttr) {
bool wasRequired = m_isRequired;
setNeedsWillValidateCheck();
didAffectSelector(AffectedSelectorDisabled | AffectedSelectorEnabled);
if (renderer() && renderer()->style().hasAppearance())
- renderer()->theme()->stateChanged(renderer(), EnabledState);
+ renderer()->theme().stateChanged(renderer(), EnabledState);
}
void HTMLFormControlElement::requiredAttributeChanged()
if (CheckedRadioButtons* buttons = checkedRadioButtons())
buttons->updateCheckedState(this);
if (renderer() && renderer()->style().hasAppearance())
- renderer()->theme()->stateChanged(renderer(), CheckedState);
+ renderer()->theme().stateChanged(renderer(), CheckedState);
setNeedsValidityCheck();
// Ideally we'd do this from the render tree (matching
didAffectSelector(AffectedSelectorIndeterminate);
if (renderer() && renderer()->style().hasAppearance())
- renderer()->theme()->stateChanged(renderer(), CheckedState);
+ renderer()->theme().stateChanged(renderer(), CheckedState);
}
int HTMLInputElement::size() const
RenderElement* HTMLMeterElement::createRenderer(PassRef<RenderStyle> style)
{
- if (hasAuthorShadowRoot() || !document().page()->theme()->supportsMeter(style.get().appearance()))
+ if (hasAuthorShadowRoot() || !document().page()->theme().supportsMeter(style.get().appearance()))
return RenderElement::createFor(*this, std::move(style));
return new RenderMeter(*this, std::move(style));
if (oldDisabled != m_disabled) {
didAffectSelector(AffectedSelectorDisabled | AffectedSelectorEnabled);
if (renderer() && renderer()->style().hasAppearance())
- renderer()->theme()->stateChanged(renderer(), EnabledState);
+ renderer()->theme().stateChanged(renderer(), EnabledState);
}
} else if (name == selectedAttr) {
// FIXME: This doesn't match what the HTML specification says.
bool HTMLSelectElement::usesMenuList() const
{
const Page* page = document().page();
- RefPtr<RenderTheme> renderTheme = page ? page->theme() : RenderTheme::defaultTheme();
+ RefPtr<RenderTheme> renderTheme = page ? &page->theme() : RenderTheme::defaultTheme();
if (renderTheme->delegatesMenuListRendering())
return true;
bool HTMLSelectElement::platformHandleKeydownEvent(KeyboardEvent* event)
{
const Page* page = document().page();
- RefPtr<RenderTheme> renderTheme = page ? page->theme() : RenderTheme::defaultTheme();
+ RefPtr<RenderTheme> renderTheme = page ? &page->theme() : RenderTheme::defaultTheme();
if (!renderTheme->popsMenuByArrowKeys())
return false;
void HTMLSelectElement::menuListDefaultEventHandler(Event* event)
{
const Page* page = document().page();
- RefPtr<RenderTheme> renderTheme = page ? page->theme() : RenderTheme::defaultTheme();
+ RefPtr<RenderTheme> renderTheme = page ? &page->theme() : RenderTheme::defaultTheme();
if (event->type() == eventNames().keydownEvent) {
if (!renderer() || !event->isKeyboardEvent())
&& isEmptyValue()
&& isEmptySuggestedValue()
&& !isPlaceholderEmpty()
- && (document().focusedElement() != this || (renderer() && renderer()->theme()->shouldShowPlaceholderWhenFocused()))
+ && (document().focusedElement() != this || (renderer() && renderer()->theme().shouldShowPlaceholderWhenFocused()))
&& (!renderer() || renderer()->style().visibility() == VISIBLE);
}
bool InputType::themeSupportsDataListUI(InputType* type)
{
Document& document = type->element().document();
- RefPtr<RenderTheme> theme = document.page() ? document.page()->theme() : RenderTheme::defaultTheme();
+ RefPtr<RenderTheme> theme = document.page() ? &document.page()->theme() : RenderTheme::defaultTheme();
return theme->supportsDataListUI(type->formControlType());
}
bool TextFieldInputType::shouldHaveSpinButton() const
{
Document& document = element().document();
- RefPtr<RenderTheme> theme = document.page() ? document.page()->theme() : RenderTheme::defaultTheme();
+ RefPtr<RenderTheme> theme = document.page() ? &document.page()->theme() : RenderTheme::defaultTheme();
return theme->shouldHaveSpinButton(&element());
}
// The timer is required to set the property display:'none' on the panel,
// such that captions are correctly displayed at the bottom of the video
// at the end of the fadeout transition.
- double duration = document().page() ? document().page()->theme()->mediaControlsFadeOutDuration() : 0;
+ double duration = document().page() ? document().page()->theme().mediaControlsFadeOutDuration() : 0;
m_transitionTimer.startOneShot(duration);
}
if (m_opaque)
return;
- double duration = document().page() ? document().page()->theme()->mediaControlsFadeInDuration() : 0;
+ double duration = document().page() ? document().page()->theme().mediaControlsFadeInDuration() : 0;
setInlineStyleProperty(CSSPropertyWebkitTransitionProperty, CSSPropertyOpacity);
setInlineStyleProperty(CSSPropertyWebkitTransitionDuration, duration, CSSPrimitiveValue::CSS_S);
if (!m_opaque)
return;
- double duration = document().page() ? document().page()->theme()->mediaControlsFadeOutDuration() : 0;
+ double duration = document().page() ? document().page()->theme().mediaControlsFadeOutDuration() : 0;
setInlineStyleProperty(CSSPropertyWebkitTransitionProperty, CSSPropertyOpacity);
setInlineStyleProperty(CSSPropertyWebkitTransitionDuration, duration, CSSPrimitiveValue::CSS_S);
updateCurrentTimeDisplay();
double duration = m_mediaController->duration();
- if (std::isfinite(duration) || page->theme()->hasOwnDisabledStateHandlingFor(MediaSliderPart)) {
+ if (std::isfinite(duration) || page->theme().hasOwnDisabledStateHandlingFor(MediaSliderPart)) {
m_timeline->setDuration(duration);
m_timeline->setPosition(m_mediaController->currentTime());
}
- if (m_mediaController->hasAudio() || page->theme()->hasOwnDisabledStateHandlingFor(MediaMuteButtonPart))
+ if (m_mediaController->hasAudio() || page->theme().hasOwnDisabledStateHandlingFor(MediaMuteButtonPart))
m_panelMuteButton->show();
else
m_panelMuteButton->hide();
if (!page)
return;
- if (!page->theme()->hasOwnDisabledStateHandlingFor(MediaMuteButtonPart)) {
+ if (!page->theme().hasOwnDisabledStateHandlingFor(MediaMuteButtonPart)) {
m_panelMuteButton->hide();
m_volumeSlider->hide();
}
- if (m_toggleClosedCaptionsButton && !page->theme()->hasOwnDisabledStateHandlingFor(MediaToggleClosedCaptionsButtonPart))
+ if (m_toggleClosedCaptionsButton && !page->theme().hasOwnDisabledStateHandlingFor(MediaToggleClosedCaptionsButtonPart))
m_toggleClosedCaptionsButton->hide();
- if (m_fullScreenButton && !page->theme()->hasOwnDisabledStateHandlingFor(MediaEnterFullscreenButtonPart))
+ if (m_fullScreenButton && !page->theme().hasOwnDisabledStateHandlingFor(MediaEnterFullscreenButtonPart))
m_fullScreenButton->hide();
}
if (!page)
return;
- m_currentTimeDisplay->setInnerText(page->theme()->formatMediaControlsTime(now), IGNORE_EXCEPTION);
+ m_currentTimeDisplay->setInnerText(page->theme().formatMediaControlsTime(now), IGNORE_EXCEPTION);
m_currentTimeDisplay->setCurrentValue(now);
}
if (ec)
return 0;
- if (document.page()->theme()->usesMediaControlStatusDisplay()) {
+ if (document.page()->theme().usesMediaControlStatusDisplay()) {
RefPtr<MediaControlStatusDisplayElement> statusDisplay = MediaControlStatusDisplayElement::create(document);
controls->m_statusDisplay = statusDisplay.get();
panel->appendChild(statusDisplay.release(), ec, AttachLazily);
if (ec)
return 0;
- if (document.page()->theme()->supportsClosedCaptioning()) {
+ if (document.page()->theme().supportsClosedCaptioning()) {
RefPtr<MediaControlClosedCaptionsContainerElement> closedCaptionsContainer = MediaControlClosedCaptionsContainerElement::create(document);
RefPtr<MediaControlClosedCaptionsTrackListElement> closedCaptionsTrackList = MediaControlClosedCaptionsTrackListElement::create(document, controls.get());
// The mute button and the slider element should be in the same div.
RefPtr<HTMLDivElement> panelVolumeControlContainer = HTMLDivElement::create(document);
- if (document.page()->theme()->usesMediaControlVolumeSlider()) {
+ if (document.page()->theme().usesMediaControlVolumeSlider()) {
RefPtr<MediaControlVolumeSliderContainerElement> volumeSliderContainer = MediaControlVolumeSliderContainerElement::create(document);
RefPtr<MediaControlPanelVolumeSliderElement> slider = MediaControlPanelVolumeSliderElement::create(document);
m_fullScreenButton->hide();
double duration = m_mediaController->duration();
- if (std::isfinite(duration) || page->theme()->hasOwnDisabledStateHandlingFor(MediaSliderPart)) {
+ if (std::isfinite(duration) || page->theme().hasOwnDisabledStateHandlingFor(MediaSliderPart)) {
m_timeline->setDuration(duration);
m_timelineContainer->show();
m_timeline->setPosition(m_mediaController->currentTime());
} else
m_timelineContainer->hide();
- if (m_mediaController->hasAudio() || page->theme()->hasOwnDisabledStateHandlingFor(MediaMuteButtonPart))
+ if (m_mediaController->hasAudio() || page->theme().hasOwnDisabledStateHandlingFor(MediaMuteButtonPart))
m_panelMuteButton->show();
else
m_panelMuteButton->hide();
return;
// Allow the theme to format the time.
- m_currentTimeDisplay->setInnerText(page->theme()->formatMediaControlsCurrentTime(now, duration), IGNORE_EXCEPTION);
+ m_currentTimeDisplay->setInnerText(page->theme().formatMediaControlsCurrentTime(now, duration), IGNORE_EXCEPTION);
m_currentTimeDisplay->setCurrentValue(now);
- m_timeRemainingDisplay->setInnerText(page->theme()->formatMediaControlsRemainingTime(now, duration), IGNORE_EXCEPTION);
+ m_timeRemainingDisplay->setInnerText(page->theme().formatMediaControlsRemainingTime(now, duration), IGNORE_EXCEPTION);
m_timeRemainingDisplay->setCurrentValue(now - duration);
}
if (!page)
return;
- if (!page->theme()->hasOwnDisabledStateHandlingFor(MediaSliderPart))
+ if (!page->theme().hasOwnDisabledStateHandlingFor(MediaSliderPart))
m_timelineContainer->hide();
- if (!page->theme()->hasOwnDisabledStateHandlingFor(MediaMuteButtonPart))
+ if (!page->theme().hasOwnDisabledStateHandlingFor(MediaMuteButtonPart))
m_panelMuteButton->hide();
m_fullScreenButton->hide();
if (m_volumeSliderContainer)
m_volumeSliderContainer->hide();
- if (m_toggleClosedCaptionsButton && !page->theme()->hasOwnDisabledStateHandlingFor(MediaToggleClosedCaptionsButtonPart))
+ if (m_toggleClosedCaptionsButton && !page->theme().hasOwnDisabledStateHandlingFor(MediaToggleClosedCaptionsButtonPart))
m_toggleClosedCaptionsButton->hide();
if (m_closedCaptionsContainer)
hideClosedCaptionTrackList();
if (exceptionCode)
return false;
- if (document.page()->theme()->supportsClosedCaptioning()) {
+ if (document.page()->theme().supportsClosedCaptioning()) {
RefPtr<MediaControlClosedCaptionsContainerElement> closedCaptionsContainer = MediaControlClosedCaptionsContainerElement::create(document);
RefPtr<MediaControlClosedCaptionsTrackListElement> closedCaptionsTrackList = MediaControlClosedCaptionsTrackListElement::create(document, this);
return;
double duration = m_mediaController->duration();
- m_durationDisplay->setInnerText(page->theme()->formatMediaControlsTime(duration), ASSERT_NO_EXCEPTION);
+ m_durationDisplay->setInnerText(page->theme().formatMediaControlsTime(duration), ASSERT_NO_EXCEPTION);
m_durationDisplay->setCurrentValue(duration);
if (m_toggleClosedCaptionsButton) {
// Allow the theme to format the time.
ExceptionCode exceptionCode;
- m_currentTimeDisplay->setInnerText(page->theme()->formatMediaControlsCurrentTime(now, duration), exceptionCode);
+ m_currentTimeDisplay->setInnerText(page->theme().formatMediaControlsCurrentTime(now, duration), exceptionCode);
m_currentTimeDisplay->setCurrentValue(now);
}
bool MeterShadowElement::rendererIsNeeded(const RenderStyle& style)
{
auto render = meterElement()->renderer();
- return render && !render->theme()->supportsMeter(render->style().appearance()) && HTMLDivElement::rendererIsNeeded(style);
+ return render && !render->theme().supportsMeter(render->style().appearance()) && HTMLDivElement::rendererIsNeeded(style);
}
MeterInnerElement::MeterInnerElement(Document& document)
return HTMLDivElement::rendererIsNeeded(style);
auto render = meterElement()->renderer();
- return render && !render->theme()->supportsMeter(render->style().appearance()) && HTMLDivElement::rendererIsNeeded(style);
+ return render && !render->theme().supportsMeter(render->style().appearance()) && HTMLDivElement::rendererIsNeeded(style);
}
RenderElement* MeterInnerElement::createRenderer(PassRef<RenderStyle> style)
const RenderStyle& sliderStyle = input->renderer()->style();
#if ENABLE(VIDEO)
- if (sliderStyle.appearance() == MediaVolumeSliderPart && input->renderer()->theme()->usesVerticalVolumeSlider())
+ if (sliderStyle.appearance() == MediaVolumeSliderPart && input->renderer()->theme().usesVerticalVolumeSlider())
return true;
#endif
else if (parentStyle->appearance() == MediaFullScreenVolumeSliderPart)
style().setAppearance(MediaFullScreenVolumeSliderThumbPart);
if (style().hasAppearance())
- theme()->adjustSliderThumbSize(&style(), element());
+ theme().adjustSliderThumbSize(&style(), element());
}
bool RenderSliderThumb::isSliderThumb() const
#if ENABLE(DATALIST_ELEMENT)
if (input->renderer()->isSlider() && !isVertical && input->list()) {
- int offsetFromCenter = theme()->sliderTickOffsetFromTrackCenter();
+ int offsetFromCenter = theme().sliderTickOffsetFromTrackCenter();
LayoutUnit trackHeight = 0;
if (offsetFromCenter < 0)
trackHeight = -2 * offsetFromCenter;
else {
- int tickLength = theme()->sliderTickSize().height();
+ int tickLength = theme().sliderTickSize().height();
trackHeight = 2 * (offsetFromCenter + tickLength);
}
float zoomFactor = style().effectiveZoom();
Decimal value = stepRange.clampValue(stepRange.valueFromProportion(fraction));
#if ENABLE(DATALIST_ELEMENT)
- const LayoutUnit snappingThreshold = renderer()->theme()->sliderTickSnappingThreshold();
+ const LayoutUnit snappingThreshold = renderer()->theme().sliderTickSnappingThreshold();
if (snappingThreshold > 0) {
Decimal closest = input->findClosestTickMarkValue(value);
if (closest.isFinite()) {
return;
RenderView* renderView = this->renderView();
- if ((renderView && renderView->theme()->supportsControlTints()) || hasCustomScrollbars())
+ if ((renderView && renderView->theme().supportsControlTints()) || hasCustomScrollbars())
paintControlTints();
}
void setNeedsRecalcStyleInAllFrames();
- RenderTheme* theme() const { return m_theme.get(); }
+ RenderTheme& theme() const { return *m_theme; }
ViewportArguments viewportArguments() const;
void RenderThemeEfl::adjustCheckboxStyle(StyleResolver* styleResolver, RenderStyle* style, Element* element) const
{
if (!m_page && element && element->document().page()) {
- static_cast<RenderThemeEfl*>(element->document().page()->theme())->adjustCheckboxStyle(styleResolver, style, element);
+ static_cast<RenderThemeEfl&>(element->document().page()->theme()).adjustCheckboxStyle(styleResolver, style, element);
return;
}
void RenderThemeEfl::adjustRadioStyle(StyleResolver* styleResolver, RenderStyle* style, Element* element) const
{
if (!m_page && element && element->document().page()) {
- static_cast<RenderThemeEfl*>(element->document().page()->theme())->adjustRadioStyle(styleResolver, style, element);
+ static_cast<RenderThemeEfl&>(element->document().page()->theme()).adjustRadioStyle(styleResolver, style, element);
return;
}
void RenderThemeEfl::adjustButtonStyle(StyleResolver* styleResolver, RenderStyle* style, Element* element) const
{
if (!m_page && element && element->document().page()) {
- static_cast<RenderThemeEfl*>(element->document().page()->theme())->adjustButtonStyle(styleResolver, style, element);
+ static_cast<RenderThemeEfl&>(element->document().page()->theme()).adjustButtonStyle(styleResolver, style, element);
return;
}
void RenderThemeEfl::adjustMenuListStyle(StyleResolver* styleResolver, RenderStyle* style, Element* element) const
{
if (!m_page && element && element->document().page()) {
- static_cast<RenderThemeEfl*>(element->document().page()->theme())->adjustMenuListStyle(styleResolver, style, element);
+ static_cast<RenderThemeEfl&>(element->document().page()->theme()).adjustMenuListStyle(styleResolver, style, element);
return;
}
adjustSizeConstraints(style, ComboBox);
void RenderThemeEfl::adjustTextFieldStyle(StyleResolver* styleResolver, RenderStyle* style, Element* element) const
{
if (!m_page && element && element->document().page()) {
- static_cast<RenderThemeEfl*>(element->document().page()->theme())->adjustTextFieldStyle(styleResolver, style, element);
+ static_cast<RenderThemeEfl&>(element->document().page()->theme()).adjustTextFieldStyle(styleResolver, style, element);
return;
}
adjustSizeConstraints(style, TextField);
void RenderThemeEfl::adjustSearchFieldResultsButtonStyle(StyleResolver* styleResolver, RenderStyle* style, Element* element) const
{
if (!m_page && element && element->document().page()) {
- static_cast<RenderThemeEfl*>(element->document().page()->theme())->adjustSearchFieldResultsButtonStyle(styleResolver, style, element);
+ static_cast<RenderThemeEfl&>(element->document().page()->theme()).adjustSearchFieldResultsButtonStyle(styleResolver, style, element);
return;
}
adjustSizeConstraints(style, SearchFieldResultsButton);
void RenderThemeEfl::adjustSearchFieldResultsDecorationPartStyle(StyleResolver* styleResolver, RenderStyle* style, Element* element) const
{
if (!m_page && element && element->document().page()) {
- static_cast<RenderThemeEfl*>(element->document().page()->theme())->adjustSearchFieldResultsDecorationPartStyle(styleResolver, style, element);
+ static_cast<RenderThemeEfl&>(element->document().page()->theme()).adjustSearchFieldResultsDecorationPartStyle(styleResolver, style, element);
return;
}
adjustSizeConstraints(style, SearchFieldResultsDecoration);
void RenderThemeEfl::adjustSearchFieldCancelButtonStyle(StyleResolver* styleResolver, RenderStyle* style, Element* element) const
{
if (!m_page && element && element->document().page()) {
- static_cast<RenderThemeEfl*>(element->document().page()->theme())->adjustSearchFieldCancelButtonStyle(styleResolver, style, element);
+ static_cast<RenderThemeEfl&>(element->document().page()->theme()).adjustSearchFieldCancelButtonStyle(styleResolver, style, element);
return;
}
adjustSizeConstraints(style, SearchFieldCancelButton);
void RenderThemeEfl::adjustSearchFieldStyle(StyleResolver* styleResolver, RenderStyle* style, Element* element) const
{
if (!m_page && element && element->document().page()) {
- static_cast<RenderThemeEfl*>(element->document().page()->theme())->adjustSearchFieldStyle(styleResolver, style, element);
+ static_cast<RenderThemeEfl&>(element->document().page()->theme()).adjustSearchFieldStyle(styleResolver, style, element);
return;
}
adjustSizeConstraints(style, SearchField);
void RenderThemeEfl::adjustInnerSpinButtonStyle(StyleResolver* styleResolver, RenderStyle* style, Element* element) const
{
if (!m_page && element && element->document().page()) {
- static_cast<RenderThemeEfl*>(element->document().page()->theme())->adjustInnerSpinButtonStyle(styleResolver, style, element);
+ static_cast<RenderThemeEfl&>(element->document().page()->theme()).adjustInnerSpinButtonStyle(styleResolver, style, element);
return;
}
adjustSizeConstraints(style, Spinner);
if (!frame.page())
return;
- String theme = static_cast<RenderThemeEfl*>(frame.page()->theme())->themePath();
+ String theme = static_cast<RenderThemeEfl&>(frame.page()->theme()).themePath();
const char* group = (orientation() == HorizontalScrollbar) ? "scrollbar.horizontal" : "scrollbar.vertical";
if (theme.isEmpty()) {
// Optionally highlight the text
if (renderer().frame().editor().markedTextMatchesAreHighlighted()) {
- Color color = marker->activeMatch() ?
- renderer().theme()->platformActiveTextSearchHighlightColor() :
- renderer().theme()->platformInactiveTextSearchHighlightColor();
+ Color color = marker->activeMatch() ? renderer().theme().platformActiveTextSearchHighlightColor() : renderer().theme().platformInactiveTextSearchHighlightColor();
GraphicsContextStateSaver stateSaver(*pt);
updateGraphicsContext(*pt, TextPaintStyle(color, style.colorSpace())); // Don't draw text at all!
pt->clip(FloatRect(boxOrigin.x(), boxOrigin.y() - deltaY, m_logicalWidth, selHeight));
return;
IntRect inflatedRect = pixelSnappedBorderBoxRect();
- theme()->adjustRepaintRect(this, inflatedRect);
+ theme().adjustRepaintRect(this, inflatedRect);
addVisualOverflow(inflatedRect);
if (RenderFlowThread* flowThread = flowThreadContainingBlock())
// FIXME: Might be better to have a custom CSS property instead, so that if the theme
// is turned off, checkboxes/radios will still have decent baselines.
// FIXME: Need to patch form controls to deal with vertical lines.
- if (style().hasAppearance() && !theme()->isControlContainer(style().appearance()))
- return theme()->baselinePosition(this);
+ if (style().hasAppearance() && !theme().isControlContainer(style().appearance()))
+ return theme().baselinePosition(this);
// CSS2.1 states that the baseline of an inline block is the baseline of the last line box in
// the normal flow. We make an exception for marquees, since their baselines are meaningless
// If we have a native theme appearance, paint that before painting our background.
// The theme will tell us whether or not we should also paint the CSS background.
IntRect snappedPaintRect(pixelSnappedIntRect(paintRect));
- bool themePainted = style().hasAppearance() && !theme()->paint(this, paintInfo, snappedPaintRect);
+ bool themePainted = style().hasAppearance() && !theme().paint(this, paintInfo, snappedPaintRect);
if (!themePainted) {
if (bleedAvoidance == BackgroundBleedBackgroundOverBorder)
paintBorder(paintInfo, paintRect, &style(), bleedAvoidance);
paintBackground(paintInfo, paintRect, bleedAvoidance);
if (style().hasAppearance())
- theme()->paintDecorations(this, paintInfo, snappedPaintRect);
+ theme().paintDecorations(this, paintInfo, snappedPaintRect);
}
paintBoxShadow(paintInfo, paintRect, &style(), Inset);
// The theme will tell us whether or not we should also paint the CSS border.
- if (bleedAvoidance != BackgroundBleedBackgroundOverBorder && (!style().hasAppearance() || (!themePainted && theme()->paintBorderOnly(this, paintInfo, snappedPaintRect))) && style().hasBorder())
+ if (bleedAvoidance != BackgroundBleedBackgroundOverBorder && (!style().hasAppearance() || (!themePainted && theme().paintBorderOnly(this, paintInfo, snappedPaintRect))) && style().hasBorder())
paintBorder(paintInfo, paintRect, &style(), bleedAvoidance);
if (bleedAvoidance == BackgroundBleedUseTransparencyLayer)
if (m_inner) // RenderBlock handled updating the anonymous block's style.
setupInnerStyle(&m_inner->style());
- if (!m_default && theme()->isDefault(this)) {
+ if (!m_default && theme().isDefault(this)) {
if (!m_timer)
m_timer = adoptPtr(new Timer<RenderButton>(this, &RenderButton::timerFired));
m_timer->startRepeating(0.03);
m_default = true;
- } else if (m_default && !theme()->isDefault(this)) {
+ } else if (m_default && !theme().isDefault(this)) {
m_default = false;
m_timer.clear();
}
RenderFileUploadControl* renderer = const_cast<RenderFileUploadControl*>(this);
float minDefaultLabelWidth = defaultWidthNumChars * font.width(constructTextRun(renderer, font, characterAsString, style(), TextRun::AllowTrailingExpansion));
- const String label = theme()->fileListDefaultLabel(inputElement().multiple());
+ const String label = theme().fileListDefaultLabel(inputElement().multiple());
float defaultLabelWidth = font.width(constructTextRun(renderer, font, label, style(), TextRun::AllowTrailingExpansion));
if (HTMLInputElement* button = uploadButton())
if (RenderObject* buttonRenderer = button->renderer())
if (inputElement().files()->length())
return StringTruncator::rightTruncate(inputElement().displayString(), maxFilenameWidth(), style().font(), StringTruncator::EnableRoundingHacks);
#endif
- return theme()->fileListNameForWidth(inputElement().files(), style().font(), maxFilenameWidth(), inputElement().multiple());
+ return theme().fileListNameForWidth(inputElement().files(), style().font(), maxFilenameWidth(), inputElement().multiple());
}
} // namespace WebCore
borderBox = region->rectFlowPortionForBox(block, borderBox);
IntRect inflatedRect = pixelSnappedIntRect(borderBox);
- block->theme()->adjustRepaintRect(block, inflatedRect);
+ block->theme().adjustRepaintRect(block, inflatedRect);
region->addVisualOverflowForBox(block, inflatedRect);
if (region == endRegion)
RenderStyle& styleToUse = style();
if (styleToUse.outlineStyleIsAuto() || hasOutlineAnnotation()) {
- if (!theme()->supportsFocusRing(&styleToUse)) {
+ if (!theme().supportsFocusRing(&styleToUse)) {
// Only paint the focus ring by hand if the theme isn't able to draw the focus ring.
paintFocusRing(paintInfo, paintOffset, &styleToUse);
}
Color textColor = listItemElement->renderStyle() ? listItemElement->renderStyle()->visitedDependentColor(CSSPropertyColor) : style().visitedDependentColor(CSSPropertyColor);
if (isOptionElement && toHTMLOptionElement(listItemElement)->selected()) {
if (frame().selection().isFocusedAndActive() && document().focusedElement() == &selectElement())
- textColor = theme()->activeListBoxSelectionForegroundColor();
+ textColor = theme().activeListBoxSelectionForegroundColor();
// Honor the foreground color for disabled items
else if (!listItemElement->isDisabledFormControl() && !selectElement().isDisabledFormControl())
- textColor = theme()->inactiveListBoxSelectionForegroundColor();
+ textColor = theme().inactiveListBoxSelectionForegroundColor();
}
ColorSpace colorSpace = itemStyle->colorSpace();
Color backColor;
if (isHTMLOptionElement(listItemElement) && toHTMLOptionElement(listItemElement)->selected()) {
if (frame().selection().isFocusedAndActive() && document().focusedElement() == &selectElement())
- backColor = theme()->activeListBoxSelectionBackgroundColor();
+ backColor = theme().activeListBoxSelectionBackgroundColor();
else
- backColor = theme()->inactiveListBoxSelectionBackgroundColor();
+ backColor = theme().inactiveListBoxSelectionBackgroundColor();
} else
backColor = listItemElement->renderStyle() ? listItemElement->renderStyle()->visitedDependentColor(CSSPropertyBackgroundColor) : style().visitedDependentColor(CSSPropertyBackgroundColor);
if (hasCustomScrollbarStyle)
widget = RenderScrollbar::createCustomScrollbar(this, VerticalScrollbar, &selectElement());
else {
- widget = Scrollbar::createNativeScrollbar(this, VerticalScrollbar, theme()->scrollbarControlSizeForPart(ListboxPart));
+ widget = Scrollbar::createNativeScrollbar(this, VerticalScrollbar, theme().scrollbarControlSizeForPart(ListboxPart));
didAddScrollbar(widget.get(), VerticalScrollbar);
}
view().frameView().addChild(widget.get());
// If the slider would be rendered outside the page, it should be moved below the controls.
if (UNLIKELY(absoluteOffsetTop < 0))
- setY(buttonBox->offsetTop() + theme()->volumeSliderOffsetFromMuteButton(buttonBox, pixelSnappedSize()).y());
+ setY(buttonBox->offsetTop() + theme().volumeSliderOffsetFromMuteButton(buttonBox, pixelSnappedSize()).y());
}
// ----------------------------
innerStyle.setAlignSelf(AlignFlexStart);
}
- innerStyle.setPaddingLeft(Length(theme()->popupInternalPaddingLeft(&style()), Fixed));
- innerStyle.setPaddingRight(Length(theme()->popupInternalPaddingRight(&style()), Fixed));
- innerStyle.setPaddingTop(Length(theme()->popupInternalPaddingTop(&style()), Fixed));
- innerStyle.setPaddingBottom(Length(theme()->popupInternalPaddingBottom(&style()), Fixed));
+ innerStyle.setPaddingLeft(Length(theme().popupInternalPaddingLeft(&style()), Fixed));
+ innerStyle.setPaddingRight(Length(theme().popupInternalPaddingRight(&style()), Fixed));
+ innerStyle.setPaddingTop(Length(theme().popupInternalPaddingTop(&style()), Fixed));
+ innerStyle.setPaddingBottom(Length(theme().popupInternalPaddingBottom(&style()), Fixed));
if (document().page()->chrome().selectItemWritingDirectionIsNatural()) {
// Items in the popup will not respect the CSS text-align and direction properties,
String text = toHTMLOptionElement(element)->textIndentedToRespectGroupLabel();
applyTextTransform(style(), text, ' ');
- if (theme()->popupOptionSupportsTextIndent()) {
+ if (theme().popupOptionSupportsTextIndent()) {
// Add in the option's text indent. We can't calculate percentage values for now.
float optionWidth = 0;
if (RenderStyle* optionStyle = element->renderStyle())
void RenderMenuList::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const
{
- maxLogicalWidth = std::max(m_optionsWidth, theme()->minimumMenuListSize(&style())) + m_innerBlock->paddingLeft() + m_innerBlock->paddingRight();
+ maxLogicalWidth = std::max(m_optionsWidth, theme().minimumMenuListSize(&style())) + m_innerBlock->paddingLeft() + m_innerBlock->paddingRight();
if (!style().width().isPercent())
minLogicalWidth = maxLogicalWidth;
}
{
RenderBox::updateLogicalWidth();
- IntSize frameSize = theme()->meterSizeForBounds(this, pixelSnappedIntRect(frameRect()));
+ IntSize frameSize = theme().meterSizeForBounds(this, pixelSnappedIntRect(frameRect()));
setLogicalWidth(isHorizontalWritingMode() ? frameSize.width() : frameSize.height());
}
frame.setHeight(computedValues.m_extent);
else
frame.setWidth(computedValues.m_extent);
- IntSize frameSize = theme()->meterSizeForBounds(this, pixelSnappedIntRect(frame));
+ IntSize frameSize = theme().meterSizeForBounds(this, pixelSnappedIntRect(frame));
computedValues.m_extent = isHorizontalWritingMode() ? frameSize.height() : frameSize.width();
}
view().didDestroyRenderer();
}
-RenderTheme* RenderObject::theme() const
+RenderTheme& RenderObject::theme() const
{
ASSERT(document().page());
-
return document().page()->theme();
}
int outlineOffset = styleToUse.outlineOffset();
if (styleToUse.outlineStyleIsAuto() || hasOutlineAnnotation()) {
- if (!theme()->supportsFocusRing(&styleToUse)) {
+ if (!theme().supportsFocusRing(&styleToUse)) {
// Only paint the focus ring by hand if the theme isn't able to draw the focus ring.
paintFocusRing(paintInfo, paintRect.location(), &styleToUse);
}
if (pseudoStyle && pseudoStyle->visitedDependentColor(CSSPropertyBackgroundColor).isValid())
color = pseudoStyle->visitedDependentColor(CSSPropertyBackgroundColor).blendWithWhite();
else
- color = frame().selection().isFocusedAndActive() ? theme()->activeSelectionBackgroundColor() : theme()->inactiveSelectionBackgroundColor();
+ color = frame().selection().isFocusedAndActive() ? theme().activeSelectionBackgroundColor() : theme().inactiveSelectionBackgroundColor();
}
}
if (!color.isValid())
color = pseudoStyle->visitedDependentColor(CSSPropertyColor);
} else
- color = frame().selection().isFocusedAndActive() ?
- theme()->activeSelectionForegroundColor() :
- theme()->inactiveSelectionForegroundColor();
+ color = frame().selection().isFocusedAndActive() ? theme().activeSelectionForegroundColor() : theme().inactiveSelectionForegroundColor();
return color;
}
explicit RenderObject(Node&);
virtual ~RenderObject();
- RenderTheme* theme() const;
+ RenderTheme& theme() const;
virtual const char* renderName() const = 0;
frame.setHeight(computedValues.m_extent);
else
frame.setWidth(computedValues.m_extent);
- IntSize frameSize = theme()->progressBarRectForBounds(this, pixelSnappedIntRect(frame)).size();
+ IntSize frameSize = theme().progressBarRectForBounds(this, pixelSnappedIntRect(frame)).size();
computedValues.m_extent = isHorizontalWritingMode() ? frameSize.height() : frameSize.width();
}
void RenderProgress::updateAnimationState()
{
- m_animationDuration = theme()->animationDurationForProgressBar(this);
- m_animationRepeatInterval = theme()->animationRepeatIntervalForProgressBar(this);
+ m_animationDuration = theme().animationDurationForProgressBar(this);
+ m_animationRepeatInterval = theme().animationRepeatIntervalForProgressBar(this);
bool animating = style().hasAppearance() && m_animationDuration > 0;
if (animating == m_animating)
bool disabled = updateUserModifyProperty(textFormControlElement(), textBlockStyle);
if (disabled)
- textBlockStyle->setColor(theme()->disabledTextColor(textBlockStyle->visitedDependentColor(CSSPropertyColor), startStyle->visitedDependentColor(CSSPropertyBackgroundColor)));
+ textBlockStyle->setColor(theme().disabledTextColor(textBlockStyle->visitedDependentColor(CSSPropertyColor), startStyle->visitedDependentColor(CSSPropertyBackgroundColor)));
#if PLATFORM(IOS)
if (textBlockStyle->textSecurity() != TSNONE && !textBlockStyle->isLeftToRightDirection()) {
// Preserve the alignment but force the direction to LTR so that the last-typed, unmasked character
// Convert the rect into the coords used for painting the content
contentsRect.moveBy(paintOffset + location());
- theme()->paintCapsLockIndicator(this, paintInfo, pixelSnappedIntRect(contentsRect));
+ theme().paintCapsLockIndicator(this, paintInfo, pixelSnappedIntRect(contentsRect));
}
}
if (!eina_stringshare_replace(&priv->settings.theme, path))
return;
- WebCore::RenderThemeEfl* theme = static_cast<WebCore::RenderThemeEfl*>(priv->page->theme());
- theme->setThemePath(path);
+ WebCore::RenderThemeEfl& theme = static_cast<WebCore::RenderThemeEfl&>(priv->page->theme());
+ theme.setThemePath(path);
}
const char* ewk_view_theme_get(const Evas_Object* ewkView)
case WM_XP_THEMECHANGED:
if (Frame* coreFrame = core(mainFrameImpl)) {
webView->deleteBackingStore();
- coreFrame->page()->theme()->themeChanged();
+ coreFrame->page()->theme().themeChanged();
ScrollbarTheme::theme()->themeChanged();
RECT windowRect;
::GetClientRect(hWnd, &windowRect);
void WebPage::setThemePath(const String& themePath)
{
- WebCore::RenderThemeEfl* theme = static_cast<WebCore::RenderThemeEfl*>(m_page->theme());
- theme->setThemePath(themePath);
+ WebCore::RenderThemeEfl& theme = static_cast<WebCore::RenderThemeEfl&>(m_page->theme());
+ theme.setThemePath(themePath);
}
static Frame* targetFrameForEditing(WebPage* page)