Changeset 216902 in webkit
- Timestamp:
- May 15, 2017, 10:35:04 PM (8 years ago)
- Location:
- trunk/Source
- Files:
-
- 37 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r216901 r216902 1 2017-05-15 Antti Koivisto <antti@apple.com> 2 3 RenderTheme does not need to be per-page 4 https://bugs.webkit.org/show_bug.cgi?id=172116 5 <rdar://problem/30426457> 6 7 Reviewed by Zalan Bujtas. 8 9 There are no implementations of RenderTheme::themeForPage that actually care about the page. 10 It can be replaced with a singleton, simplifying a bunch of code. 11 12 * Modules/mediacontrols/MediaControlsHost.cpp: 13 (WebCore::MediaControlsHost::shadowRootCSSText): 14 (WebCore::MediaControlsHost::base64StringForIconNameAndType): 15 * css/CSSDefaultStyleSheets.cpp: 16 (WebCore::CSSDefaultStyleSheets::loadFullDefaultStyle): 17 (WebCore::CSSDefaultStyleSheets::ensureDefaultStyleSheetsForElement): 18 19 Fix a potential crash if we get here when page is null (though it doesn't appear to repro on trunk). 20 21 * css/StyleColor.cpp: 22 (WebCore::StyleColor::colorFromKeyword): 23 * css/StyleResolver.cpp: 24 (WebCore::StyleResolver::adjustRenderStyle): 25 * css/parser/CSSParser.cpp: 26 (WebCore::CSSParser::parseSystemColor): 27 * css/parser/CSSParser.h: 28 * css/parser/CSSPropertyParser.cpp: 29 (WebCore::CSSPropertyParser::consumeSystemFont): 30 * editing/FrameSelection.cpp: 31 (WebCore::FrameSelection::updateAppearance): 32 * html/HTMLMediaElement.cpp: 33 (WebCore::HTMLMediaElement::ensureMediaControlsInjectedScript): 34 * html/HTMLMeterElement.cpp: 35 (WebCore::HTMLMeterElement::createElementRenderer): 36 * html/HTMLSelectElement.cpp: 37 (WebCore::HTMLSelectElement::usesMenuList): 38 (WebCore::HTMLSelectElement::platformHandleKeydownEvent): 39 (WebCore::HTMLSelectElement::menuListDefaultEventHandler): 40 * html/HTMLTextFormControlElement.cpp: 41 (WebCore::HTMLTextFormControlElement::adjustInnerTextStyle): 42 * html/InputType.cpp: 43 (WebCore::InputType::themeSupportsDataListUI): 44 * html/TextFieldInputType.cpp: 45 (WebCore::TextFieldInputType::shouldHaveSpinButton): 46 (WebCore::TextFieldInputType::shouldHaveCapsLockIndicator): 47 * html/canvas/CanvasRenderingContext2D.cpp: 48 (WebCore::CanvasRenderingContext2D::setStrokeColor): 49 (WebCore::CanvasRenderingContext2D::setFillColor): 50 * html/canvas/CanvasStyle.cpp: 51 (WebCore::parseColor): 52 (WebCore::parseColorOrCurrentColor): 53 (WebCore::CanvasStyle::createFromString): 54 * html/canvas/CanvasStyle.h: 55 * html/shadow/MediaControlElements.cpp: 56 (WebCore::MediaControlPanelElement::startTimer): 57 (WebCore::MediaControlPanelElement::makeOpaque): 58 (WebCore::MediaControlPanelElement::makeTransparent): 59 * html/shadow/MediaControls.cpp: 60 (WebCore::MediaControls::reset): 61 (WebCore::MediaControls::reportedError): 62 (WebCore::MediaControls::updateCurrentTimeDisplay): 63 * html/shadow/mac/ImageControlsButtonElementMac.cpp: 64 (WebCore::ImageControlsButtonElementMac::tryCreate): 65 * page/MemoryRelease.cpp: 66 (WebCore::releaseNoncriticalMemory): 67 * page/Page.cpp: 68 (WebCore::Page::Page): 69 * page/Page.h: 70 (WebCore::Page::theme): Deleted. 71 * platform/wpe/RenderThemeWPE.cpp: 72 (WebCore::RenderTheme::singleton): 73 (WebCore::RenderTheme::themeForPage): Deleted. 74 * rendering/RenderEmbeddedObject.cpp: 75 (WebCore::RenderEmbeddedObject::getReplacementTextGeometry): 76 * rendering/RenderObject.cpp: 77 (WebCore::RenderObject::theme): 78 * rendering/RenderTheme.cpp: 79 (WebCore::RenderTheme::focusRingColor): 80 * rendering/RenderTheme.h: 81 (WebCore::RenderTheme::defaultTheme): Deleted. 82 * rendering/RenderThemeGtk.cpp: 83 (WebCore::RenderTheme::singleton): 84 (WebCore::RenderTheme::themeForPage): Deleted. 85 * rendering/RenderThemeIOS.mm: 86 (WebCore::RenderTheme::singleton): 87 (WebCore::RenderTheme::themeForPage): Deleted. 88 * rendering/RenderThemeMac.mm: 89 (WebCore::RenderTheme::singleton): 90 (WebCore::RenderTheme::themeForPage): Deleted. 91 * rendering/RenderThemeWin.cpp: 92 (WebCore::RenderTheme::singleton): 93 (WebCore::RenderTheme::themeForPage): Deleted. 94 * rendering/TextPaintStyle.cpp: 95 (WebCore::computeTextPaintStyle): 96 1 97 2017-05-15 Said Abou-Hallawa <sabouhallawa@apple.com> 2 98 -
trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp
r215922 r216902 281 281 String MediaControlsHost::shadowRootCSSText() const 282 282 { 283 Page* page = m_mediaElement->document().page(); 284 if (!page) 285 return emptyString(); 286 return RenderTheme::themeForPage(page)->modernMediaControlsStyleSheet(); 283 return RenderTheme::singleton().modernMediaControlsStyleSheet(); 287 284 } 288 285 289 286 String MediaControlsHost::base64StringForIconNameAndType(const String& iconName, const String& iconType) const 290 287 { 291 Page* page = m_mediaElement->document().page(); 292 if (!page) 293 return emptyString(); 294 return RenderTheme::themeForPage(page)->mediaControlsBase64StringForIconNameAndType(iconName, iconType); 288 289 return RenderTheme::singleton().mediaControlsBase64StringForIconNameAndType(iconName, iconType); 295 290 } 296 291 -
trunk/Source/WebCore/css/CSSDefaultStyleSheets.cpp
r216217 r216902 135 135 136 136 // Strict-mode rules. 137 String defaultRules = String(htmlUserAgentStyleSheet, sizeof(htmlUserAgentStyleSheet)) + RenderTheme:: defaultTheme()->extraDefaultStyleSheet();137 String defaultRules = String(htmlUserAgentStyleSheet, sizeof(htmlUserAgentStyleSheet)) + RenderTheme::singleton().extraDefaultStyleSheet(); 138 138 defaultStyleSheet = parseUASheet(defaultRules); 139 139 defaultStyle->addRulesFromSheet(*defaultStyleSheet, screenEval()); … … 141 141 142 142 // Quirks-mode rules. 143 String quirksRules = String(quirksUserAgentStyleSheet, sizeof(quirksUserAgentStyleSheet)) + RenderTheme:: defaultTheme()->extraQuirksStyleSheet();143 String quirksRules = String(quirksUserAgentStyleSheet, sizeof(quirksUserAgentStyleSheet)) + RenderTheme::singleton().extraQuirksStyleSheet(); 144 144 quirksStyleSheet = parseUASheet(quirksRules); 145 145 defaultQuirksStyle->addRulesFromSheet(*quirksStyleSheet, screenEval()); … … 171 171 if (is<HTMLElement>(element)) { 172 172 if (is<HTMLObjectElement>(element) || is<HTMLEmbedElement>(element)) { 173 if (!plugInsStyleSheet ) {174 String plugInsRules = RenderTheme:: themeForPage(element.document().page())->extraPlugInsStyleSheet() + element.document().page()->chrome().client().plugInExtraStyleSheet();173 if (!plugInsStyleSheet && element.document().page()) { 174 String plugInsRules = RenderTheme::singleton().extraPlugInsStyleSheet() + element.document().page()->chrome().client().plugInExtraStyleSheet(); 175 175 if (plugInsRules.isEmpty()) 176 176 plugInsRules = String(plugInsUserAgentStyleSheet, sizeof(plugInsUserAgentStyleSheet)); … … 183 183 else if (is<HTMLMediaElement>(element)) { 184 184 if (!mediaControlsStyleSheet) { 185 String mediaRules = RenderTheme:: themeForPage(element.document().page())->mediaControlsStyleSheet();185 String mediaRules = RenderTheme::singleton().mediaControlsStyleSheet(); 186 186 if (mediaRules.isEmpty()) 187 mediaRules = String(mediaControlsUserAgentStyleSheet, sizeof(mediaControlsUserAgentStyleSheet)) + RenderTheme:: themeForPage(element.document().page())->extraMediaControlsStyleSheet();187 mediaRules = String(mediaControlsUserAgentStyleSheet, sizeof(mediaControlsUserAgentStyleSheet)) + RenderTheme::singleton().extraMediaControlsStyleSheet(); 188 188 mediaControlsStyleSheet = parseUASheet(mediaRules); 189 189 defaultStyle->addRulesFromSheet(*mediaControlsStyleSheet, screenEval()); … … 196 196 else if (is<HTMLDivElement>(element) && element.isImageControlsRootElement()) { 197 197 if (!imageControlsStyleSheet) { 198 String imageControlsRules = RenderTheme:: themeForPage(element.document().page())->imageControlsStyleSheet();198 String imageControlsRules = RenderTheme::singleton().imageControlsStyleSheet(); 199 199 imageControlsStyleSheet = parseUASheet(imageControlsRules); 200 200 defaultStyle->addRulesFromSheet(*imageControlsStyleSheet, screenEval()); … … 227 227 #if ENABLE(FULLSCREEN_API) 228 228 if (!fullscreenStyleSheet && element.document().webkitIsFullScreen()) { 229 String fullscreenRules = String(fullscreenUserAgentStyleSheet, sizeof(fullscreenUserAgentStyleSheet)) + RenderTheme:: defaultTheme()->extraFullScreenStyleSheet();229 String fullscreenRules = String(fullscreenUserAgentStyleSheet, sizeof(fullscreenUserAgentStyleSheet)) + RenderTheme::singleton().extraFullScreenStyleSheet(); 230 230 fullscreenStyleSheet = parseUASheet(fullscreenRules); 231 231 defaultStyle->addRulesFromSheet(*fullscreenStyleSheet, screenEval()); -
trunk/Source/WebCore/css/StyleColor.cpp
r209318 r216902 44 44 return Color(namedColor->ARGBValue); 45 45 } 46 return RenderTheme:: defaultTheme()->systemColor(keyword);46 return RenderTheme::singleton().systemColor(keyword); 47 47 } 48 48 -
trunk/Source/WebCore/css/StyleResolver.cpp
r216083 r216902 999 999 // Let the theme also have a crack at adjusting the style. 1000 1000 if (style.hasAppearance()) 1001 RenderTheme:: defaultTheme()->adjustStyle(*this, style, element, m_state.hasUAAppearance(), m_state.borderData(), m_state.backgroundData(), m_state.backgroundColor());1001 RenderTheme::singleton().adjustStyle(*this, style, element, m_state.hasUAAppearance(), m_state.borderData(), m_state.backgroundData(), m_state.backgroundColor()); 1002 1002 1003 1003 // If we have first-letter pseudo style, do not share this style. -
trunk/Source/WebCore/css/parser/CSSParser.cpp
r216611 r216902 174 174 } 175 175 176 Color CSSParser::parseSystemColor(const String& string, Document* document) 177 { 178 if (!document || !document->page()) 179 return Color(); 180 176 Color CSSParser::parseSystemColor(const String& string) 177 { 181 178 CSSValueID id = cssValueKeywordID(string); 182 179 if (!StyleColor::isSystemColor(id)) 183 180 return Color(); 184 181 185 return document->page()->theme().systemColor(id);182 return RenderTheme::singleton().systemColor(id); 186 183 } 187 184 -
trunk/Source/WebCore/css/parser/CSSParser.h
r209838 r216902 79 79 80 80 static Color parseColor(const String&, bool strict = false); 81 static Color parseSystemColor(const String& , Document*);81 static Color parseSystemColor(const String&); 82 82 83 83 private: -
trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp
r216833 r216902 4430 4430 4431 4431 FontCascadeDescription fontDescription; 4432 RenderTheme:: defaultTheme()->systemFont(systemFontID, fontDescription);4432 RenderTheme::singleton().systemFont(systemFontID, fontDescription); 4433 4433 if (!fontDescription.isAbsoluteSize()) 4434 4434 return false; -
trunk/Source/WebCore/editing/FrameSelection.cpp
r215872 r216902 2058 2058 // already blinking in the right location. 2059 2059 if (shouldBlink && !m_caretBlinkTimer.isActive()) { 2060 if (Seconds blinkInterval = m_frame->page()->theme().caretBlinkInterval())2060 if (Seconds blinkInterval = RenderTheme::singleton().caretBlinkInterval()) 2061 2061 m_caretBlinkTimer.startRepeating(blinkInterval); 2062 2062 -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r216886 r216902 6699 6699 return false; 6700 6700 6701 String mediaControlsScript = RenderTheme:: themeForPage(page)->mediaControlsScript();6701 String mediaControlsScript = RenderTheme::singleton().mediaControlsScript(); 6702 6702 if (!mediaControlsScript.length()) 6703 6703 return false; -
trunk/Source/WebCore/html/HTMLMeterElement.cpp
r210828 r216902 61 61 RenderPtr<RenderElement> HTMLMeterElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&) 62 62 { 63 if (! document().page()->theme().supportsMeter(style.appearance()))63 if (!RenderTheme::singleton().supportsMeter(style.appearance())) 64 64 return RenderElement::createFor(*this, WTFMove(style)); 65 65 -
trunk/Source/WebCore/html/HTMLSelectElement.cpp
r216632 r216902 194 194 { 195 195 #if !PLATFORM(IOS) 196 if (RenderTheme:: themeForPage(document().page())->delegatesMenuListRendering())196 if (RenderTheme::singleton().delegatesMenuListRendering()) 197 197 return true; 198 198 … … 1086 1086 bool HTMLSelectElement::platformHandleKeydownEvent(KeyboardEvent* event) 1087 1087 { 1088 if (!RenderTheme:: themeForPage(document().page())->popsMenuByArrowKeys())1088 if (!RenderTheme::singleton().popsMenuByArrowKeys()) 1089 1089 return false; 1090 1090 … … 1119 1119 ASSERT(renderer()); 1120 1120 ASSERT(renderer()->isMenuList()); 1121 1122 RefPtr<RenderTheme> renderTheme = RenderTheme::themeForPage(document().page());1123 1121 1124 1122 if (event.type() == eventNames().keydownEvent) { … … 1189 1187 } 1190 1188 1191 if ( renderTheme->popsMenuBySpaceOrReturn()) {1189 if (RenderTheme::singleton().popsMenuBySpaceOrReturn()) { 1192 1190 if (keyCode == ' ' || keyCode == '\r') { 1193 1191 focus(); … … 1206 1204 handled = true; 1207 1205 } 1208 } else if ( renderTheme->popsMenuByArrowKeys()) {1206 } else if (RenderTheme::singleton().popsMenuByArrowKeys()) { 1209 1207 if (keyCode == ' ') { 1210 1208 focus(); -
trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp
r213355 r216902 806 806 807 807 if (isDisabledFormControl()) 808 textBlockStyle.setColor( document().page()->theme().disabledTextColor(textBlockStyle.visitedDependentColor(CSSPropertyColor), parentStyle.visitedDependentColor(CSSPropertyBackgroundColor)));808 textBlockStyle.setColor(RenderTheme::singleton().disabledTextColor(textBlockStyle.visitedDependentColor(CSSPropertyColor), parentStyle.visitedDependentColor(CSSPropertyBackgroundColor))); 809 809 #if PLATFORM(IOS) 810 810 if (textBlockStyle.textSecurity() != TSNONE && !textBlockStyle.isLeftToRightDirection()) { -
trunk/Source/WebCore/html/InputType.cpp
r215385 r216902 172 172 bool InputType::themeSupportsDataListUI(InputType* type) 173 173 { 174 Document& document = type->element().document(); 175 return RenderTheme::themeForPage(document.page())->supportsDataListUI(type->formControlType()); 174 return RenderTheme::singleton().supportsDataListUI(type->formControlType()); 176 175 } 177 176 -
trunk/Source/WebCore/html/TextFieldInputType.cpp
r209907 r216902 245 245 bool TextFieldInputType::shouldHaveSpinButton() const 246 246 { 247 return RenderTheme:: themeForPage(element().document().page())->shouldHaveSpinButton(element());247 return RenderTheme::singleton().shouldHaveSpinButton(element()); 248 248 } 249 249 250 250 bool TextFieldInputType::shouldHaveCapsLockIndicator() const 251 251 { 252 return RenderTheme:: themeForPage(element().document().page())->shouldHaveCapsLockIndicator(element());252 return RenderTheme::singleton().shouldHaveCapsLockIndicator(element()); 253 253 } 254 254 -
trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
r216217 r216902 840 840 841 841 realizeSaves(); 842 setStrokeStyle(CanvasStyle::createFromString(color , &canvas().document()));842 setStrokeStyle(CanvasStyle::createFromString(color)); 843 843 modifiableState().unparsedStrokeColor = color; 844 844 } … … 876 876 877 877 realizeSaves(); 878 setFillStyle(CanvasStyle::createFromString(color , &canvas().document()));878 setFillStyle(CanvasStyle::createFromString(color)); 879 879 modifiableState().unparsedFillColor = color; 880 880 } -
trunk/Source/WebCore/html/canvas/CanvasStyle.cpp
r211591 r216902 49 49 } 50 50 51 static Color parseColor(const String& colorString , Document* document = nullptr)51 static Color parseColor(const String& colorString) 52 52 { 53 53 Color color = CSSParser::parseColor(colorString); 54 54 if (color.isValid()) 55 55 return color; 56 return CSSParser::parseSystemColor(colorString , document);56 return CSSParser::parseSystemColor(colorString); 57 57 } 58 58 … … 72 72 return currentColor(canvas); 73 73 74 return parseColor(colorString , canvas ? &canvas->document() : nullptr);74 return parseColor(colorString); 75 75 } 76 76 … … 110 110 } 111 111 112 CanvasStyle CanvasStyle::createFromString(const String& colorString , Document* document)112 CanvasStyle CanvasStyle::createFromString(const String& colorString) 113 113 { 114 114 if (isCurrentColorString(colorString)) 115 115 return CurrentColor { std::nullopt }; 116 116 117 Color color = parseColor(colorString , document);117 Color color = parseColor(colorString); 118 118 if (!color.isValid()) 119 119 return { }; -
trunk/Source/WebCore/html/canvas/CanvasStyle.h
r210319 r216902 48 48 CanvasStyle(CanvasPattern&); 49 49 50 static CanvasStyle createFromString(const String& color , Document* = nullptr);50 static CanvasStyle createFromString(const String& color); 51 51 static CanvasStyle createFromStringWithOverrideAlpha(const String& color, float alpha); 52 52 -
trunk/Source/WebCore/html/shadow/MediaControlElements.cpp
r215173 r216902 138 138 // such that captions are correctly displayed at the bottom of the video 139 139 // at the end of the fadeout transition. 140 Seconds duration = document().page() ? document().page()->theme().mediaControlsFadeOutDuration() : 0_s;140 Seconds duration = RenderTheme::singleton().mediaControlsFadeOutDuration(); 141 141 m_transitionTimer.startOneShot(duration); 142 142 } … … 189 189 return; 190 190 191 double duration = document().page() ? document().page()->theme().mediaControlsFadeInDuration() : 0;191 double duration = RenderTheme::singleton().mediaControlsFadeInDuration(); 192 192 193 193 setInlineStyleProperty(CSSPropertyTransitionProperty, CSSPropertyOpacity); … … 206 206 return; 207 207 208 Seconds duration = document().page() ? document().page()->theme().mediaControlsFadeOutDuration() : 0_s;208 Seconds duration = RenderTheme::singleton().mediaControlsFadeOutDuration(); 209 209 210 210 setInlineStyleProperty(CSSPropertyTransitionProperty, CSSPropertyOpacity); -
trunk/Source/WebCore/html/shadow/MediaControls.cpp
r208658 r216902 88 88 void MediaControls::reset() 89 89 { 90 Page* page = document().page();91 if (!page)92 return;93 94 90 m_playButton->updateDisplayType(); 95 91 … … 97 93 98 94 double duration = m_mediaController->duration(); 99 if (std::isfinite(duration) || page->theme().hasOwnDisabledStateHandlingFor(MediaSliderPart)) {95 if (std::isfinite(duration) || RenderTheme::singleton().hasOwnDisabledStateHandlingFor(MediaSliderPart)) { 100 96 m_timeline->setDuration(duration); 101 97 m_timeline->setPosition(m_mediaController->currentTime()); 102 98 } 103 99 104 if (m_mediaController->hasAudio() || page->theme().hasOwnDisabledStateHandlingFor(MediaMuteButtonPart))100 if (m_mediaController->hasAudio() || RenderTheme::singleton().hasOwnDisabledStateHandlingFor(MediaMuteButtonPart)) 105 101 m_panelMuteButton->show(); 106 102 else … … 130 126 void MediaControls::reportedError() 131 127 { 132 Page* page = document().page(); 133 if (!page) 134 return; 135 136 if (!page->theme().hasOwnDisabledStateHandlingFor(MediaMuteButtonPart)) { 128 auto& theme = RenderTheme::singleton(); 129 if (!theme.hasOwnDisabledStateHandlingFor(MediaMuteButtonPart)) { 137 130 m_panelMuteButton->hide(); 138 131 m_volumeSlider->hide(); 139 132 } 140 133 141 if (m_toggleClosedCaptionsButton && ! page->theme().hasOwnDisabledStateHandlingFor(MediaToggleClosedCaptionsButtonPart))134 if (m_toggleClosedCaptionsButton && !theme.hasOwnDisabledStateHandlingFor(MediaToggleClosedCaptionsButtonPart)) 142 135 m_toggleClosedCaptionsButton->hide(); 143 136 144 if (m_fullScreenButton && ! page->theme().hasOwnDisabledStateHandlingFor(MediaEnterFullscreenButtonPart))137 if (m_fullScreenButton && !theme.hasOwnDisabledStateHandlingFor(MediaEnterFullscreenButtonPart)) 145 138 m_fullScreenButton->hide(); 146 139 } … … 219 212 { 220 213 double now = m_mediaController->currentTime(); 221 222 Page* page = document().page(); 223 if (!page) 224 return; 225 226 m_currentTimeDisplay->setInnerText(page->theme().formatMediaControlsTime(now)); 214 m_currentTimeDisplay->setInnerText(RenderTheme::singleton().formatMediaControlsTime(now)); 227 215 m_currentTimeDisplay->setCurrentValue(now); 228 216 } -
trunk/Source/WebCore/html/shadow/mac/ImageControlsButtonElementMac.cpp
r211033 r216902 98 98 button->setAttributeWithoutSynchronization(HTMLNames::classAttr, AtomicString("x-webkit-image-controls-button", AtomicString::ConstructFromLiteral)); 99 99 100 IntSize positionOffset = document.page()->theme().imageControlsButtonPositionOffset();100 IntSize positionOffset = RenderTheme::singleton().imageControlsButtonPositionOffset(); 101 101 button->setInlineStyleProperty(CSSPropertyTop, positionOffset.height(), CSSPrimitiveValue::CSS_PX); 102 102 -
trunk/Source/WebCore/page/MemoryRelease.cpp
r216770 r216902 58 58 static void releaseNoncriticalMemory() 59 59 { 60 RenderTheme:: defaultTheme()->purgeCaches();60 RenderTheme::singleton().purgeCaches(); 61 61 62 62 FontCache::singleton().purgeInactiveFontData(); -
trunk/Source/WebCore/page/Page.cpp
r216197 r216902 206 206 , m_backForwardController(std::make_unique<BackForwardController>(*this, *WTFMove(pageConfiguration.backForwardClient))) 207 207 , m_mainFrame(MainFrame::create(*this, pageConfiguration)) 208 , m_theme(RenderTheme::themeForPage(this))209 208 , m_editorClient(WTFMove(pageConfiguration.editorClient)) 210 209 , m_plugInClient(pageConfiguration.plugInClient) -
trunk/Source/WebCore/page/Page.h
r216197 r216902 167 167 void setNeedsRecalcStyleInAllFrames(); 168 168 169 RenderTheme& theme() const { return *m_theme; }170 171 169 WEBCORE_EXPORT ViewportArguments viewportArguments() const; 172 170 … … 666 664 667 665 RefPtr<PluginData> m_pluginData; 668 669 RefPtr<RenderTheme> m_theme;670 666 671 667 UniqueRef<EditorClient> m_editorClient; -
trunk/Source/WebCore/page/linux/ResourceUsageOverlayLinux.cpp
r215241 r216902 75 75 { 76 76 FontCascadeDescription fontDescription; 77 RenderTheme:: defaultTheme()->systemFont(CSSValueMessageBox, fontDescription);77 RenderTheme::singleton().systemFont(CSSValueMessageBox, fontDescription); 78 78 fontDescription.setComputedSize(gFontSize); 79 79 m_textFont = FontCascade(fontDescription, 0, 0); -
trunk/Source/WebCore/platform/win/PopupMenuWin.cpp
r213211 r216902 623 623 PopupMenuStyle itemStyle = client()->itemStyle(index); 624 624 if (index == focusedIndex()) { 625 optionBackgroundColor = RenderTheme:: defaultTheme()->activeListBoxSelectionBackgroundColor();626 optionTextColor = RenderTheme:: defaultTheme()->activeListBoxSelectionForegroundColor();625 optionBackgroundColor = RenderTheme::singleton().activeListBoxSelectionBackgroundColor(); 626 optionTextColor = RenderTheme::singleton().activeListBoxSelectionForegroundColor(); 627 627 } else { 628 628 optionBackgroundColor = itemStyle.backgroundColor(); … … 661 661 if (client()->menuStyle().textDirection() == LTR) { 662 662 textX = std::max<int>(0, client()->clientPaddingLeft() - client()->clientInsetLeft()); 663 if (RenderTheme:: defaultTheme()->popupOptionSupportsTextIndent())663 if (RenderTheme::singleton().popupOptionSupportsTextIndent()) 664 664 textX += minimumIntValueForLength(itemStyle.textIndent(), itemRect.width()); 665 665 } else { 666 666 textX = itemRect.width() - client()->menuStyle().font().width(textRun); 667 667 textX = std::min<int>(textX, textX - client()->clientPaddingRight() + client()->clientInsetRight()); 668 if (RenderTheme:: defaultTheme()->popupOptionSupportsTextIndent())668 if (RenderTheme::singleton().popupOptionSupportsTextIndent()) 669 669 textX -= minimumIntValueForLength(itemStyle.textIndent(), itemRect.width()); 670 670 } -
trunk/Source/WebCore/platform/wpe/RenderThemeWPE.cpp
r216497 r216902 34 34 namespace WebCore { 35 35 36 Re f<RenderTheme> RenderTheme::themeForPage(Page*)36 RenderTheme& RenderTheme::singleton() 37 37 { 38 static RenderTheme& theme = RenderThemeWPE::create().leakRef();39 return theme ;38 static NeverDestroyed<Ref<RenderTheme>> theme(RenderThemeWPE::create()); 39 return theme.get(); 40 40 } 41 41 -
trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp
r214173 r216902 358 358 359 359 FontCascadeDescription fontDescription; 360 RenderTheme:: defaultTheme()->systemFont(CSSValueWebkitSmallControl, fontDescription);360 RenderTheme::singleton().systemFont(CSSValueWebkitSmallControl, fontDescription); 361 361 fontDescription.setWeight(boldWeightValue()); 362 362 fontDescription.setRenderingMode(settings().fontRenderingMode()); -
trunk/Source/WebCore/rendering/RenderObject.cpp
r216047 r216902 142 142 RenderTheme& RenderObject::theme() const 143 143 { 144 return page().theme();144 return RenderTheme::singleton(); 145 145 } 146 146 -
trunk/Source/WebCore/rendering/RenderTheme.cpp
r215173 r216902 1279 1279 Color RenderTheme::tapHighlightColor() 1280 1280 { 1281 return defaultTheme()->platformTapHighlightColor();1281 return singleton().platformTapHighlightColor(); 1282 1282 } 1283 1283 #endif … … 1314 1314 Color RenderTheme::focusRingColor() 1315 1315 { 1316 return customFocusRingColor().isValid() ? customFocusRingColor() : defaultTheme()->platformFocusRingColor();1316 return customFocusRingColor().isValid() ? customFocusRingColor() : RenderTheme::singleton().platformFocusRingColor(); 1317 1317 } 1318 1318 -
trunk/Source/WebCore/rendering/RenderTheme.h
r215509 r216902 63 63 64 64 // This function is to be implemented in your platform-specific theme implementation to hand back the 65 // appropriate platform theme. When the theme is needed in non-page dependent code, a default theme is 66 // used as fallback, which is returned for a nulled page, so the platform code needs to account for this. 67 static Ref<RenderTheme> themeForPage(Page*); 68 69 // When the theme is needed in non-page dependent code, the defaultTheme() is used as fallback. 70 static inline Ref<RenderTheme> defaultTheme() 71 { 72 return themeForPage(nullptr); 73 }; 65 // appropriate platform theme. 66 static RenderTheme& singleton(); 74 67 75 68 virtual void purgeCaches() { } -
trunk/Source/WebCore/rendering/RenderThemeGtk.cpp
r215218 r216902 67 67 } 68 68 69 Re f<RenderTheme> RenderTheme::themeForPage(Page*)70 { 71 static RenderTheme& rt = RenderThemeGtk::create().leakRef();72 return rt;69 RenderTheme& RenderTheme::singleton() 70 { 71 static NeverDestroyed<Ref<RenderTheme>> theme(RenderThemeGtk::create()); 72 return theme.get(); 73 73 } 74 74 -
trunk/Source/WebCore/rendering/RenderThemeIOS.mm
r216544 r216902 296 296 } 297 297 298 Re f<RenderTheme> RenderTheme::themeForPage(Page*)299 { 300 static RenderTheme& renderTheme = RenderThemeIOS::create().leakRef();301 return renderTheme;298 RenderTheme& RenderTheme::singleton() 299 { 300 static NeverDestroyed<Ref<RenderTheme>> theme(RenderThemeIOS::create()); 301 return theme.get(); 302 302 } 303 303 -
trunk/Source/WebCore/rendering/RenderThemeMac.mm
r216544 r216902 196 196 }; 197 197 198 Re f<RenderTheme> RenderTheme::themeForPage(Page*)199 { 200 static RenderTheme& rt = RenderThemeMac::create().leakRef();201 return rt;198 RenderTheme& RenderTheme::singleton() 199 { 200 static NeverDestroyed<Ref<RenderTheme>> theme(RenderThemeMac::create()); 201 return theme.get(); 202 202 } 203 203 -
trunk/Source/WebCore/rendering/RenderThemeWin.cpp
r216702 r216902 189 189 } 190 190 191 Re f<RenderTheme> RenderTheme::themeForPage(Page* page)192 { 193 static RenderTheme& winTheme = RenderThemeWin::create().leakRef();194 return winTheme;191 RenderTheme& RenderTheme::singleton() 192 { 193 static NeverDestroyed<Ref<RenderTheme>> theme(RenderThemeWin::create()); 194 return theme.get(); 195 195 } 196 196 -
trunk/Source/WebCore/rendering/TextPaintStyle.cpp
r215261 r216902 85 85 Page* page = frame.page(); 86 86 if (page && page->focusController().isActive()) { 87 paintStyle.fillColor = page->theme().systemColor(CSSValueActivebuttontext);87 paintStyle.fillColor = RenderTheme::singleton().systemColor(CSSValueActivebuttontext); 88 88 return paintStyle; 89 89 } -
trunk/Source/WebKit/win/WebView.cpp
r216823 r216902 2726 2726 if (Frame* coreFrame = core(mainFrameImpl)) { 2727 2727 webView->deleteBackingStore(); 2728 coreFrame->page()->theme().themeChanged();2728 RenderTheme::singleton().themeChanged(); 2729 2729 ScrollbarTheme::theme().themeChanged(); 2730 2730 RECT windowRect;
Note:
See TracChangeset
for help on using the changeset viewer.