WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
wcore-gtk-theme.diff (text/plain), 216.23 KB, created by
Carlos Garcia Campos
on 2020-02-24 04:45:04 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Carlos Garcia Campos
Created:
2020-02-24 04:45:04 PST
Size:
216.23 KB
patch
obsolete
>diff --git a/ChangeLog b/ChangeLog >index 62786ef3dd3..5cb2f5b04c9 100644 >--- a/ChangeLog >+++ b/ChangeLog >@@ -1,3 +1,14 @@ >+2020-02-24 Carlos Garcia Campos <cgarcia@igalia.com> >+ >+ [GTK] Stop using gtk foreign drawing API to style form controls >+ https://bugs.webkit.org/show_bug.cgi?id=208129 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add a test case for datalist element. >+ >+ * ManualTests/gtk/theme.html: >+ > 2020-02-20 Carlos Alberto Lopez Perez <clopez@igalia.com> > > [GTK][WPE] Not set ccache compiler prefix if ccache its already the compiler binary in path. >diff --git a/ManualTests/gtk/theme.html b/ManualTests/gtk/theme.html >index 643865a1848..c141239b78f 100644 >--- a/ManualTests/gtk/theme.html >+++ b/ManualTests/gtk/theme.html >@@ -147,6 +147,16 @@ > </html>"> > </iframe> > >+ <h1>Datalist</h1> >+ <input list="ports" name="port"> >+ <datalist id="ports"> >+ <option value="WebKitGTK"> >+ <option value="WPEWebKit"> >+ <option value="PlayStation"> >+ <option value="macOS"> >+ <option value="iOS"> >+ </datalist> >+ > <h1>Media controls</h1> > <video controls></video> > </body> >diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index 407a38ab007..ed3f05cb3a0 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,14 @@ >+2020-02-24 Carlos Garcia Campos <cgarcia@igalia.com> >+ >+ [GTK] Stop using gtk foreign drawing API to style form controls >+ https://bugs.webkit.org/show_bug.cgi?id=208129 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Enable USE_NEW_THEME for the GTK port. >+ >+ * wtf/PlatformUse.h: >+ > 2020-02-23 Yusuke Suzuki <ysuzuki@apple.com> > > [JSC] Shrink Structure >diff --git a/Source/WTF/wtf/PlatformUse.h b/Source/WTF/wtf/PlatformUse.h >index c47dc16a1a4..00110211386 100644 >--- a/Source/WTF/wtf/PlatformUse.h >+++ b/Source/WTF/wtf/PlatformUse.h >@@ -291,7 +291,7 @@ > #define USE_CFNETWORK_CONTENT_ENCODING_SNIFFING_OVERRIDE 1 > #endif > >-#if PLATFORM(MAC) || PLATFORM(WPE) >+#if PLATFORM(MAC) || PLATFORM(WPE) || PLATFORM(GTK) > /* FIXME: This really needs a descriptive name, this "new theme" was added in 2008. */ > #define USE_NEW_THEME 1 > #endif >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 4014ab8999d..c7c2cbf73be 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,116 @@ >+2020-02-24 Carlos Garcia Campos <cgarcia@igalia.com> >+ >+ [GTK] Stop using gtk foreign drawing API to style form controls >+ https://bugs.webkit.org/show_bug.cgi?id=208129 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ It causes layout issues in some websites, it doesn't really work with all GTK themes and it won't be possible >+ with GTK4 because foreign drawing APIs have been removed. Instead, we can use the new custom style used by WPE >+ port, which is based on adwaita, but simplified to avoid the huge minimum control sizes, the usage of gradients >+ and transparencies, etc. We can still use the GTK API to get the selection colors, to keep some consistency with >+ the actual GTK theme, but that won't be possible with GTK4 either. This also means we won't be rendering >+ directly to the cairo context anymore (which was required by GTK foreign drawing), so we can use things like >+ threaded rendering in the GTK port now. This patch renames ScrollbarThemeWPE, RenderThemeWPE and ThemeWPE as >+ ScrollbarThemeAdwaita, RenderThemeAdwaita and ThemeAdwaita and adds ThemeGtk. GTK media controls CSS and >+ JavaScript files have been removed in favor of using the adwaita ones. >+ >+ * Modules/mediacontrols/mediaControlsGtk.js: Removed. >+ * PlatformGTK.cmake: >+ * PlatformWPE.cmake: >+ * SourcesGTK.txt: >+ * SourcesWPE.txt: >+ * css/mediaControlsGtk.css: Removed. >+ * platform/adwaita/ScrollbarThemeAdwaita.cpp: Renamed from Source/WebCore/platform/wpe/ScrollbarThemeWPE.cpp. >+ (WebCore::ScrollbarThemeAdwaita::usesOverlayScrollbars const): >+ (WebCore::ScrollbarThemeAdwaita::scrollbarThickness): >+ (WebCore::ScrollbarThemeAdwaita::minimumThumbLength): >+ (WebCore::ScrollbarThemeAdwaita::hasButtons): >+ (WebCore::ScrollbarThemeAdwaita::hasThumb): >+ (WebCore::ScrollbarThemeAdwaita::backButtonRect): >+ (WebCore::ScrollbarThemeAdwaita::forwardButtonRect): >+ (WebCore::ScrollbarThemeAdwaita::trackRect): >+ (WebCore::ScrollbarThemeAdwaita::paint): >+ (WebCore::ScrollbarThemeAdwaita::handleMousePressEvent): >+ (WebCore::ScrollbarTheme::nativeTheme): >+ * platform/adwaita/ScrollbarThemeAdwaita.h: Copied from Source/WebCore/platform/wpe/ScrollbarThemeWPE.h. >+ * platform/adwaita/ThemeAdwaita.cpp: Renamed from Source/WebCore/platform/wpe/ThemeWPE.cpp. >+ (WebCore::Theme::singleton): >+ (WebCore::ThemeAdwaita::activeSelectionForegroundColor const): >+ (WebCore::ThemeAdwaita::activeSelectionBackgroundColor const): >+ (WebCore::ThemeAdwaita::inactiveSelectionForegroundColor const): >+ (WebCore::ThemeAdwaita::inactiveSelectionBackgroundColor const): >+ (WebCore::ThemeAdwaita::focusColor): >+ (WebCore::ThemeAdwaita::paintFocus): >+ (WebCore::ThemeAdwaita::paintArrow): >+ (WebCore::ThemeAdwaita::controlSize const): >+ (WebCore::ThemeAdwaita::paint): >+ (WebCore::ThemeAdwaita::paintCheckbox): >+ (WebCore::ThemeAdwaita::paintRadio): >+ (WebCore::ThemeAdwaita::paintButton): >+ (WebCore::ThemeAdwaita::paintSpinButton): >+ * platform/adwaita/ThemeAdwaita.h: Renamed from Source/WebCore/platform/wpe/ThemeWPE.h. >+ (WebCore::ThemeAdwaita::platformColorsDidChange): >+ * platform/graphics/cairo/CairoOperations.cpp: >+ (WebCore::Cairo::drawFocusRing): >+ * platform/graphics/cairo/GraphicsContextCairo.cpp: >+ (WebCore::GraphicsContext::drawFocusRing): >+ * platform/gtk/RenderThemeGadget.cpp: Removed. >+ * platform/gtk/RenderThemeGadget.h: Removed. >+ * platform/gtk/RenderThemeWidget.cpp: Removed. >+ * platform/gtk/RenderThemeWidget.h: Removed. >+ * platform/gtk/ScrollbarThemeGtk.cpp: Removed. >+ * platform/gtk/ScrollbarThemeGtk.h: Removed. >+ * platform/gtk/ThemeGtk.cpp: Added. >+ (WebCore::Theme::singleton): >+ (WebCore::ThemeGtk::ensurePlatformColors const): >+ (WebCore::ThemeGtk::platformColorsDidChange): >+ (WebCore::ThemeGtk::activeSelectionForegroundColor const): >+ (WebCore::ThemeGtk::activeSelectionBackgroundColor const): >+ (WebCore::ThemeGtk::inactiveSelectionForegroundColor const): >+ (WebCore::ThemeGtk::inactiveSelectionBackgroundColor const): >+ * platform/gtk/ThemeGtk.h: Renamed from Source/WebCore/platform/wpe/ScrollbarThemeWPE.h. >+ * rendering/RenderThemeAdwaita.cpp: Renamed from Source/WebCore/platform/wpe/RenderThemeWPE.cpp. >+ (WebCore::RenderTheme::singleton): >+ (WebCore::RenderThemeAdwaita::supportsFocusRing const): >+ (WebCore::RenderThemeAdwaita::shouldHaveCapsLockIndicator const): >+ (WebCore::RenderThemeAdwaita::platformActiveSelectionBackgroundColor const): >+ (WebCore::RenderThemeAdwaita::platformInactiveSelectionBackgroundColor const): >+ (WebCore::RenderThemeAdwaita::platformActiveSelectionForegroundColor const): >+ (WebCore::RenderThemeAdwaita::platformInactiveSelectionForegroundColor const): >+ (WebCore::RenderThemeAdwaita::platformActiveListBoxSelectionBackgroundColor const): >+ (WebCore::RenderThemeAdwaita::platformInactiveListBoxSelectionBackgroundColor const): >+ (WebCore::RenderThemeAdwaita::platformActiveListBoxSelectionForegroundColor const): >+ (WebCore::RenderThemeAdwaita::platformInactiveListBoxSelectionForegroundColor const): >+ (WebCore::RenderThemeAdwaita::platformFocusRingColor const): >+ (WebCore::RenderThemeAdwaita::platformColorsDidChange): >+ (WebCore::RenderThemeAdwaita::extraDefaultStyleSheet): >+ (WebCore::RenderThemeAdwaita::extraMediaControlsStyleSheet): >+ (WebCore::RenderThemeAdwaita::mediaControlsScript): >+ (WebCore::RenderThemeAdwaita::paintTextField): >+ (WebCore::RenderThemeAdwaita::paintTextArea): >+ (WebCore::RenderThemeAdwaita::paintSearchField): >+ (WebCore::RenderThemeAdwaita::popupInternalPaddingBox const): >+ (WebCore::RenderThemeAdwaita::paintMenuList): >+ (WebCore::RenderThemeAdwaita::paintMenuListButtonDecorations): >+ (WebCore::RenderThemeAdwaita::animationRepeatIntervalForProgressBar const): >+ (WebCore::RenderThemeAdwaita::animationDurationForProgressBar const): >+ (WebCore::RenderThemeAdwaita::progressBarRectForBounds const): >+ (WebCore::RenderThemeAdwaita::paintProgressBar): >+ (WebCore::RenderThemeAdwaita::paintSliderTrack): >+ (WebCore::RenderThemeAdwaita::adjustSliderThumbSize const): >+ (WebCore::RenderThemeAdwaita::paintSliderThumb): >+ (WebCore::RenderThemeAdwaita::paintMediaSliderTrack): >+ (WebCore::RenderThemeAdwaita::paintMediaVolumeSliderTrack): >+ (WebCore::RenderThemeAdwaita::sliderTickSize const): >+ (WebCore::RenderThemeAdwaita::sliderTickOffsetFromTrackCenter const): >+ (WebCore::RenderThemeAdwaita::adjustListButtonStyle const): >+ * rendering/RenderThemeAdwaita.h: Renamed from Source/WebCore/platform/wpe/RenderThemeWPE.h. >+ * rendering/RenderThemeGtk.cpp: >+ (WebCore::RenderThemeGtk::updateCachedSystemFontDescription const): >+ (WebCore::RenderThemeGtk::caretBlinkInterval const): >+ * rendering/RenderThemeGtk.h: >+ > 2020-02-24 Philippe Normand <pnormand@igalia.com> > > [GStreamer][WPE] Add GstGLMemoryEGL support for the video-plane-display >diff --git a/Source/WebCore/Modules/mediacontrols/mediaControlsGtk.js b/Source/WebCore/Modules/mediacontrols/mediaControlsGtk.js >deleted file mode 100644 >index 2fe8c588db2..00000000000 >--- a/Source/WebCore/Modules/mediacontrols/mediaControlsGtk.js >+++ /dev/null >@@ -1,261 +0,0 @@ >-function createControls(root, video, host) >-{ >- return new ControllerGtk(root, video, host); >-}; >- >-function ControllerGtk(root, video, host) >-{ >- Controller.call(this, root, video, host); >-}; >- >-function contains(list, obj) >-{ >- var i = list.length; >- while (i--) >- if (list[i] === obj) >- return true; >- return false; >-}; >- >-ControllerGtk.prototype = { >- >- createControls: function() >- { >- Controller.prototype.createControls.apply(this); >- >- this.controls.currentTime.classList.add(this.ClassNames.hidden); >- this.controls.remainingTime.classList.add(this.ClassNames.hidden); >- >- this.controls.volumeBox.classList.add(this.ClassNames.hiding); >- >- this.listenFor(this.controls.muteBox, 'mouseout', this.handleVolumeBoxMouseOut); >- this.listenFor(this.controls.muteButton, 'mouseover', this.handleMuteButtonMouseOver); >- this.listenFor(this.controls.volumeBox, 'mouseover', this.handleMuteButtonMouseOver); >- this.listenFor(this.controls.volume, 'mouseover', this.handleMuteButtonMouseOver); >- this.listenFor(this.controls.captionButton, 'mouseover', this.handleCaptionButtonMouseOver); >- this.listenFor(this.controls.captionButton, 'mouseout', this.handleCaptionButtonMouseOut); >- >- var enclosure = this.controls.enclosure = document.createElement('div'); >- enclosure.setAttribute('pseudo', '-webkit-media-controls-enclosure'); >- }, >- >- configureInlineControls: function() >- { >- this.controls.panel.appendChild(this.controls.playButton); >- this.controls.panel.appendChild(this.controls.timeline); >- this.controls.panel.appendChild(this.controls.currentTime); >- this.controls.panel.appendChild(this.controls.remainingTime); >- this.controls.panel.appendChild(this.controls.captionButton); >- this.controls.panel.appendChild(this.controls.fullscreenButton); >- this.controls.panel.appendChild(this.controls.muteBox); >- this.controls.muteBox.appendChild(this.controls.muteButton); >- this.controls.muteBox.appendChild(this.controls.volumeBox); >- this.controls.volumeBox.appendChild(this.controls.volume); >- this.controls.enclosure.appendChild(this.controls.panel); >- }, >- >- shouldHaveControls: function() >- { >- if (!this.isAudio() && !this.host.allowsInlineMediaPlayback) >- return true; >- >- return this.video.controls || this.isFullScreen(); >- }, >- >- reconnectControls: function() >- { >- Controller.prototype.disconnectControls.apply(this, arguments); >- >- this.configureInlineControls(); >- >- if (this.shouldHaveControls()) >- this.addControls(); >- }, >- >- setStatusHidden: function(hidden) >- { >- }, >- >- updateTime: function(forceUpdate) >- { >- if (!forceUpdate && this.controlsAreHidden()) >- return; >- >- var currentTime = this.video.currentTime; >- var duration = this.video.duration; >- >- this.controls.currentTime.innerText = this.formatTime(currentTime); >- this.controls.timeline.value = currentTime; >- if (duration === Infinity || duration === NaN) >- this.controls.remainingTime.classList.add(this.ClassNames.hidden); >- else { >- this.controls.currentTime.innerText += " / " + this.formatTime(duration); >- this.controls.remainingTime.innerText = this.formatTime(duration); >- if (this.controls.currentTime.classList.contains(this.ClassNames.hidden)) >- this.controls.remainingTime.classList.remove(this.ClassNames.hidden); >- } >- >- if (currentTime > 0) >- this.showCurrentTime(); >- }, >- >- showCurrentTime: function() >- { >- this.controls.currentTime.classList.remove(this.ClassNames.hidden); >- this.controls.remainingTime.classList.add(this.ClassNames.hidden); >- }, >- >- handlePlay: function(event) >- { >- Controller.prototype.handlePlay.apply(this, arguments); >- this.showCurrentTime(); >- if (!this.isLive) >- this.showCurrentTime(); >- }, >- >- handleTimeUpdate: function(event) >- { >- this.updateTime(); >- }, >- >- handleMuteButtonMouseOver: function(event) >- { >- if (this.video.offsetTop + this.controls.enclosure.offsetTop < 105) { >- this.controls.volumeBox.classList.add(this.ClassNames.down); >- this.controls.panel.classList.add(this.ClassNames.down); >- } else { >- this.controls.volumeBox.classList.remove(this.ClassNames.down); >- this.controls.panel.classList.remove(this.ClassNames.down); >- } >- this.controls.volumeBox.classList.remove(this.ClassNames.hiding); >- return true; >- }, >- >- handleVolumeBoxMouseOut: function(event) >- { >- this.controls.volumeBox.classList.add(this.ClassNames.hiding); >- return true; >- }, >- >- removeControls: function() >- { >- if (this.controls.enclosure.parentNode) >- this.controls.enclosure.parentNode.removeChild(this.controls.enclosure); >- this.destroyCaptionMenu(); >- }, >- >- addControls: function() >- { >- this.base.appendChild(this.controls.enclosure); >- }, >- >- updateReadyState: function() >- { >- if (this.host.supportsFullscreen && this.video.videoTracks.length) >- this.controls.fullscreenButton.classList.remove(this.ClassNames.hidden); >- else >- this.controls.fullscreenButton.classList.add(this.ClassNames.hidden); >- this.updateVolume(); >- }, >- >- updateDuration: function() >- { >- Controller.prototype.updateDuration.apply(this, arguments); >- if (this.isLive) >- this.controls.timeline.max = 0; >- }, >- >- setIsLive: function(live) >- { >- Controller.prototype.setIsLive.apply(this, arguments); >- this.controls.timeline.disabled = this.isLive; >- }, >- >- updatePlaying: function() >- { >- Controller.prototype.updatePlaying.apply(this, arguments); >- if (!this.canPlay()) >- this.showControls(); >- }, >- >- handleCaptionButtonClicked: function(event) >- { >- this.handleCaptionButtonShowMenu(event) >- return true; >- }, >- >- buildCaptionMenu: function() >- { >- Controller.prototype.buildCaptionMenu.apply(this, arguments); >- >- this.listenFor(this.captionMenu, 'mouseout', this.handleCaptionMouseOut); >- this.listenFor(this.captionMenu, 'transitionend', this.captionMenuTransitionEnd); >- >- this.captionMenu.captionMenuTreeElements = this.captionMenu.getElementsByTagName("*"); >- >- // Caption menu has to be centered to the caption button. >- var captionButtonCenter = this.controls.panel.offsetLeft + this.controls.captionButton.offsetLeft + >- this.controls.captionButton.offsetWidth / 2; >- var captionMenuLeft = (captionButtonCenter - this.captionMenu.offsetWidth / 2); >- if (captionMenuLeft + this.captionMenu.offsetWidth > this.controls.panel.offsetLeft + this.controls.panel.offsetWidth) >- this.captionMenu.classList.add(this.ClassNames.out); >- this.captionMenu.style.left = captionMenuLeft + 'px'; >- // As height is not in the css, it needs to be specified to animate it. >- this.captionMenu.height = this.captionMenu.offsetHeight; >- this.captionMenu.style.height = 0; >- }, >- >- destroyCaptionMenu: function() >- { >- this.hideCaptionMenu(); >- }, >- >- showCaptionMenu: function() >- { >- this.captionMenu.style.height = this.captionMenu.height + 'px'; >- }, >- >- hideCaptionMenu: function() >- { >- this.captionMenu.style.height = 0; >- }, >- >- captionMenuTransitionEnd: function(event) >- { >- if (this.captionMenu.offsetHeight === 0) >- Controller.prototype.destroyCaptionMenu.apply(this, arguments); >- }, >- >- handleCaptionButtonMouseOver: function(event) >- { >- this.handleCaptionButtonShowMenu(event); >- return true; >- }, >- >- handleCaptionButtonShowMenu: function(event) >- { >- if (!this.captionMenu) >- this.buildCaptionMenu(); >- if (!contains(this.captionMenu.captionMenuTreeElements, event.relatedTarget)) >- this.showCaptionMenu(); >- return true; >- }, >- >- handleCaptionButtonMouseOut: function(event) >- { >- if (this.captionMenu && !contains(this.captionMenu.captionMenuTreeElements, event.relatedTarget)) >- this.hideCaptionMenu(); >- return true; >- }, >- >- handleCaptionMouseOut: function(event) >- { >- if (event.relatedTarget != this.controls.captionButton && >- !contains(this.captionMenu.captionMenuTreeElements, event.relatedTarget)) >- this.hideCaptionMenu(); >- return true; >- }, >-}; >- >-Object.create(Controller.prototype).extend(ControllerGtk.prototype); >-Object.defineProperty(ControllerGtk.prototype, 'constructor', { enumerable:false, value:ControllerGtk }); >diff --git a/Source/WebCore/PlatformGTK.cmake b/Source/WebCore/PlatformGTK.cmake >index 2fb9e395b63..7781d0c58e7 100644 >--- a/Source/WebCore/PlatformGTK.cmake >+++ b/Source/WebCore/PlatformGTK.cmake >@@ -18,6 +18,7 @@ list(APPEND WebCore_PRIVATE_INCLUDE_DIRECTORIES > "${WEBCORE_DIR}/accessibility/atk" > "${WEBCORE_DIR}/editing/atk" > "${WEBCORE_DIR}/page/gtk" >+ "${WEBCORE_DIR}/platform/adwaita" > "${WEBCORE_DIR}/platform/generic" > "${WEBCORE_DIR}/platform/gtk" > "${WEBCORE_DIR}/platform/graphics/egl" >@@ -64,16 +65,17 @@ list(APPEND WebCore_PRIVATE_FRAMEWORK_HEADERS > ) > > list(APPEND WebCore_USER_AGENT_STYLE_SHEETS >- ${WEBCORE_DIR}/css/mediaControlsGtk.css >+ ${WEBCORE_DIR}/Modules/mediacontrols/mediaControlsAdwaita.css >+ ${WEBCORE_DIR}/css/themeAdwaita.css > ) > > set(WebCore_USER_AGENT_SCRIPTS > ${WEBCORE_DIR}/en.lproj/mediaControlsLocalizedStrings.js >+ ${WEBCORE_DIR}/Modules/mediacontrols/mediaControlsAdwaita.js > ${WEBCORE_DIR}/Modules/mediacontrols/mediaControlsBase.js >- ${WEBCORE_DIR}/Modules/mediacontrols/mediaControlsGtk.js > ) > >-set(WebCore_USER_AGENT_SCRIPTS_DEPENDENCIES ${WEBCORE_DIR}/platform/gtk/RenderThemeGtk.cpp) >+set(WebCore_USER_AGENT_SCRIPTS_DEPENDENCIES ${WEBCORE_DIR}/rendering/RenderThemeAdwaita.cpp) > > list(APPEND WebCore_LIBRARIES > ${ATK_LIBRARIES} >diff --git a/Source/WebCore/PlatformWPE.cmake b/Source/WebCore/PlatformWPE.cmake >index 1d23427a5bb..202ebacbbfd 100644 >--- a/Source/WebCore/PlatformWPE.cmake >+++ b/Source/WebCore/PlatformWPE.cmake >@@ -18,6 +18,7 @@ list(APPEND WebCore_UNIFIED_SOURCE_LIST_FILES > > list(APPEND WebCore_PRIVATE_INCLUDE_DIRECTORIES > "${WEBCORE_DIR}/accessibility/atk" >+ "${WEBCORE_DIR}/platform/adwaita" > "${WEBCORE_DIR}/platform/graphics/egl" > "${WEBCORE_DIR}/platform/graphics/epoxy" > "${WEBCORE_DIR}/platform/graphics/glx" >diff --git a/Source/WebCore/SourcesGTK.txt b/Source/WebCore/SourcesGTK.txt >index bcd8d9f2773..17b513b22b8 100644 >--- a/Source/WebCore/SourcesGTK.txt >+++ b/Source/WebCore/SourcesGTK.txt >@@ -65,6 +65,9 @@ page/scrolling/generic/ScrollingThreadGeneric.cpp > platform/ScrollAnimationKinetic.cpp > platform/UserAgentQuirks.cpp > >+platform/adwaita/ScrollbarThemeAdwaita.cpp >+platform/adwaita/ThemeAdwaita.cpp >+ > platform/generic/ScrollAnimatorGeneric.cpp > > platform/graphics/GLContext.cpp @no-unify >@@ -112,10 +115,8 @@ platform/gtk/PlatformMouseEventGtk.cpp > platform/gtk/PlatformPasteboardGtk.cpp > platform/gtk/PlatformScreenGtk.cpp > platform/gtk/PlatformWheelEventGtk.cpp >-platform/gtk/RenderThemeGadget.cpp >-platform/gtk/RenderThemeWidget.cpp >-platform/gtk/ScrollbarThemeGtk.cpp > platform/gtk/SelectionData.cpp >+platform/gtk/ThemeGtk.cpp > platform/gtk/WidgetGtk.cpp > > platform/text/Hyphenation.cpp >@@ -129,4 +130,5 @@ platform/unix/LoggingUnix.cpp > > platform/xdg/MIMETypeRegistryXdg.cpp > >+rendering/RenderThemeAdwaita.cpp > rendering/RenderThemeGtk.cpp >diff --git a/Source/WebCore/SourcesWPE.txt b/Source/WebCore/SourcesWPE.txt >index 97ecdac4922..ebfe2269cff 100644 >--- a/Source/WebCore/SourcesWPE.txt >+++ b/Source/WebCore/SourcesWPE.txt >@@ -62,6 +62,9 @@ page/scrolling/generic/ScrollingThreadGeneric.cpp > platform/ScrollAnimationKinetic.cpp > platform/UserAgentQuirks.cpp > >+platform/adwaita/ScrollbarThemeAdwaita.cpp >+platform/adwaita/ThemeAdwaita.cpp >+ > platform/generic/ScrollAnimatorGeneric.cpp > > platform/graphics/GLContext.cpp >@@ -91,8 +94,7 @@ platform/text/LocaleICU.cpp > platform/unix/LoggingUnix.cpp > > platform/wpe/PlatformScreenWPE.cpp >-platform/wpe/RenderThemeWPE.cpp >-platform/wpe/ScrollbarThemeWPE.cpp >-platform/wpe/ThemeWPE.cpp > > platform/xdg/MIMETypeRegistryXdg.cpp >+ >+rendering/RenderThemeAdwaita.cpp >diff --git a/Source/WebCore/css/mediaControlsGtk.css b/Source/WebCore/css/mediaControlsGtk.css >deleted file mode 100644 >index a688478fb41..00000000000 >--- a/Source/WebCore/css/mediaControlsGtk.css >+++ /dev/null >@@ -1,402 +0,0 @@ >-/* >- * Copyright (C) 2009 Apple Inc. All rights reserved. >- * Copyright (C) 2009 Google Inc. >- * Copyright (C) 2012 Zan Dobersek <zandobersek@gmail.com> >- * Copyright (C) 2012 Igalia S.L. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-/* These are based on the Chromium media controls */ >- >-video::-webkit-media-controls-panel *:active, >-video::-webkit-media-controls-panel *:focus, >-audio::-webkit-media-controls-panel *:active, >-audio::-webkit-media-controls-panel *:focus { >- background-image: linear-gradient(rgba(0, 0, 0, .05), rgba(255, 255, 255, .05)) !important; >-} >- >-audio::-webkit-media-controls-panel.down *:active, >-audio::-webkit-media-controls-panel.down *:focus { >- background-image: linear-gradient(rgba(255, 255, 255, .05), rgba(0, 0, 0, .05)) !important; >-} >- >-audio::-webkit-media-controls-panel.hidden, >-video::-webkit-media-controls-panel.hidden { >- display: none !important; >-} >- >-body:-webkit-full-page-media { >- background-color: rgb(0, 0, 0); >-} >- >-audio { >- width: 300px; >- height: 30px; >-} >- >-audio:-webkit-full-page-media, video:-webkit-full-page-media { >- max-height: 100%; >- max-width: 100%; >-} >- >-audio:-webkit-full-page-media::-webkit-media-controls-panel, >-video:-webkit-full-page-media::-webkit-media-controls-panel { >- bottom: 0px; >-} >- >-::-webkit-media-controls { >- display: flex; >- flex-direction: column; >- justify-content: flex-end; >- align-items: center; >-} >- >-audio::-webkit-media-controls-enclosure, video::-webkit-media-controls-enclosure { >- width: 100%; >- max-width: 800px; >- height: 30px; >- bottom: 0; >- text-indent: 0; >- padding: 0; >- box-sizing: border-box; >- overflow: visible; >-} >- >-video::-webkit-media-controls-enclosure { >- padding: 5px; >- height: 40px; >-} >- >-audio::-webkit-media-controls-panel, video::-webkit-media-controls-panel { >- display: flex; >- flex-direction: row; >- align-items: center; >- justify-content: flex-start; >- bottom: auto; >- height: 30px; >- background-color: rgba(20, 20, 20, 0.8); >- border-radius: 5px; >- overflow: visible; >- transition: opacity 0.25s linear; >-} >- >-video::-webkit-media-controls-panel { >- opacity: 0; >-} >- >-audio::-webkit-media-controls-panel, >-video:-webkit-full-page-media::-webkit-media-controls-panel.no-video, >-video::-webkit-media-controls-panel:hover, >-video::-webkit-media-controls-panel.show, >-video::-webkit-media-controls-panel.paused { >- opacity: 1; >-} >- >-video::-webkit-media-controls-panel div.mute-box, >-audio::-webkit-media-controls-panel div.mute-box { >- display: flex; >- flex: none; >- box-sizing: border-box; >- width: 30px; >- height: 30px; >- margin: 0 9px 0 -7px; >-} >- >-audio::-webkit-media-controls-panel div.mute-box.hidden, >-video::-webkit-media-controls-panel div.mute-box.hidden { >- display: none !important; >-} >- >-audio::-webkit-media-controls-mute-button, video::-webkit-media-controls-mute-button { >- -webkit-appearance: media-mute-button; >- display: flex; >- flex: none; >- border: none; >- box-sizing: border-box; >- width: 30px; >- height: 30px; >- line-height: 30px; >- outline: none; >-} >- >-audio::-webkit-media-controls-play-button, video::-webkit-media-controls-play-button { >- -webkit-appearance: media-play-button; >- display: flex; >- flex: none; >- border: none; >- box-sizing: border-box; >- width: 30px; >- height: 30px; >- line-height: 30px; >- margin: 0 9px; >- outline: none; >-} >- >-/* Paused classes for audio/video controls should be defined to make a difference in style from not having this class. Otherwise a repaint would not happen. */ >-audio::-webkit-media-controls-play-button.paused, >-video::-webkit-media-controls-play-button.paused { >- position: relative; >-} >- >-audio::-webkit-media-controls-current-time-display, video::-webkit-media-controls-current-time-display, >-audio::-webkit-media-controls-time-remaining-display, video::-webkit-media-controls-time-remaining-display { >- -webkit-appearance: media-current-time-display; >- -webkit-user-select: none; >- flex: none; >- display: block; >- border: none; >- cursor: default; >- >- height: 30px; >- margin: 0 15px 0 0; >- >- line-height: 30px; >- font-family: -webkit-small-control; >- font-size: 13px; >- font-weight: normal; >- font-style: normal; >- color: white; >- >- letter-spacing: normal; >- word-spacing: normal; >- text-transform: none; >- text-indent: 0; >- text-shadow: none; >- text-decoration: none; >-} >- >-audio::-webkit-media-controls-current-time-display.hidden, >-video::-webkit-media-controls-current-time-display.hidden, >-audio::-webkit-media-controls-time-remaining-display.hidden, >-video::-webkit-media-controls-time-remaining-display.hidden { >- display: none !important; >-} >- >-audio::-webkit-media-controls-timeline, video::-webkit-media-controls-timeline { >- -webkit-appearance: media-slider !important; >- display: flex !important; >- flex: 1 1 auto !important; >- height: 8px !important; >- margin: 0 15px 0 1px !important; >- padding: 0 !important; >- background-color: transparent !important; >- min-width: 25px !important; >- border-radius: 4px !important; >- color: rgba(230, 230, 230, 0.35) !important; >- outline: none !important; >-} >- >-audio::-webkit-media-controls-timeline[disabled], video::-webkit-media-controls-timeline[disabled] { >- opacity: 0.3 !important; >-} >- >-audio::-webkit-media-controls-timeline.hidden, >-video::-webkit-media-controls-timeline.hidden { >- display: none !important; >-} >- >-audio::-webkit-media-controls-volume-slider-container, video::-webkit-media-controls-volume-slider-container { >- -webkit-appearance: media-volume-slider-container; >- display: flex; >- overflow: hidden; >- position: absolute; >- padding: 0; >- height: 100px; >- width: 30px; >- bottom: 30px; >- z-index: 2; >- background-color: rgba(20, 20, 20, 0.8); >- right: 9px; >- border-radius: 5px 5px 0px 0px; >- transition: height 0.10s linear; >-} >- >-audio::-webkit-media-controls-volume-slider-container.hiding, >-video::-webkit-media-controls-volume-slider-container.hiding { >- height: 0; >-} >- >-audio::-webkit-media-controls-volume-slider-container.down, >-video::-webkit-media-controls-volume-slider-container.down { >- bottom: -100px; >- border-radius: 0px 0px 5px 5px; >- transition: height 0.10s linear, bottom 0.10s linear; >-} >- >-audio::-webkit-media-controls-panel .hiding.down, >-video::-webkit-media-controls-panel .hiding.down { >- bottom: 0; >-} >- >-audio::-webkit-media-controls-volume-slider, video::-webkit-media-controls-volume-slider { >- -webkit-appearance: media-volume-slider !important; >- display: flex !important; >- align-items: center !important; >- flex-direction: column !important; >- box-sizing: border-box !important; >- height: 80px !important; >- width: 8px !important; >- margin: 10px auto !important; >- border-radius: 4px !important; >- background-color: transparent !important; >- color: rgba(230, 230, 230, 0.35) !important; >- outline: none !important; >-} >- >-audio::-webkit-media-controls-volume-slider-container input[type="range"]::-webkit-media-slider-container > div, video::-webkit-media-controls-volume-slider-container input[type="range"]::-webkit-media-slider-container > div { >- margin: -7px 0; >-} >- >-audio::-webkit-media-controls-volume-slider-container input[type="range"]::-webkit-media-slider-thumb, video::-webkit-media-controls-volume-slider-container input[type="range"]::-webkit-media-slider-thumb { >- -webkit-appearance: media-volume-sliderthumb; >- width: 12px; >- height: 12px; >- border-radius: 3px; >- color: white; >- margin: 0; >-} >- >-input[type="range"]::-webkit-media-slider-container { >- display: flex; >- align-items: center; >- flex-direction: row; /* This property is updated by C++ code. */ >- box-sizing: border-box; >- height: 100%; >- width: 100%; >- border: 1px solid rgba(230, 230, 230, 0.35); >- border-radius: 4px; >- background-color: transparent; >-} >- >-/* The negative right margin causes the track to overflow its container. */ >-input[type="range"]::-webkit-media-slider-container > div { >- margin-right: -14px; >-} >- >-input[type="range"]::-webkit-media-slider-thumb { >- -webkit-appearance: media-sliderthumb; >- width: 12px; >- height: 12px; >- border-radius: 3px; >- color: white; >- margin-left: -7px; >- margin-right: -7px; >-} >- >-audio::-webkit-media-controls-toggle-closed-captions-button, video::-webkit-media-controls-toggle-closed-captions-button { >- -webkit-appearance: media-toggle-closed-captions-button; >- display: flex; >- flex: none; >- border: none; >- box-sizing: border-box; >- width: 30px; >- height: 30px; >- line-height: 30px; >- margin: 0 9px 0 -7px; >- outline: none; >-} >- >-audio::-webkit-media-controls-toggle-closed-captions-button.hidden, >-video::-webkit-media-controls-toggle-closed-captions-button.hidden { >- display: none !important; >-} >- >-video::-webkit-media-controls-closed-captions-container { >- -webkit-appearance: media-closed-captions-container; >- display: flex; >- position: absolute; >- bottom: 35px; >- z-index: 2; >- background-color: rgba(20, 20, 20, 0.8); >- border-radius: 5px 5px 0px 0px; >- overflow: hidden; >- max-width: -webkit-calc(100% - 48px); /* right + 10px */ >- max-height: -webkit-calc(100% - 35px); /* bottom + 10px */ >- cursor: default; >- font-family: -webkit-small-control; >- font-size: 10pt; >- font-weight: normal; >- font-style: normal; >- color: white; >- -webkit-user-select: none; >- transition: height 0.10s linear; >-} >- >-video::-webkit-media-controls-closed-captions-container.out { >- border-radius: 5px; >-} >- >-video::-webkit-media-controls-closed-captions-container.hidden { >- display: none !important; >-} >- >-video::-webkit-media-controls-closed-captions-container h3 { >- padding-top: 8px; >- margin: 0; >- padding-left: 17px; >- padding-right: 15px; >- font-size: 10pt; >- font-weight: bold; >- font-style: normal; >-} >- >-video::-webkit-media-controls-closed-captions-container ul { >- list-style-type: none; >- margin: 0 0 4px 0; >- padding: 4px 0 0 0; >-} >- >-video::-webkit-media-controls-closed-captions-container li { >- position: relative; >- color: white; >- margin: 0; >- padding-left: 17px; >- padding-right: 15px; >- padding-top: 0.15em; >- padding-bottom: 0.2em; >- box-sizing: border-box; >- overflow: hidden; >- white-space: nowrap; >- text-overflow: ellipsis; >- outline: none; >-} >-video::-webkit-media-controls-closed-captions-container li.selected { >- background-color: rgba(230, 230, 230, 0.15); >-} >- >-audio::-webkit-media-controls-fullscreen-button, video::-webkit-media-controls-fullscreen-button { >- -webkit-appearance: media-enter-fullscreen-button; >- display: flex; >- flex: none; >- border: none; >- box-sizing: border-box; >- width: 30px; >- height: 30px; >- line-height: 30px; >- margin: 0 9px 0 -7px; >- outline: none; >-} >- >-audio::-webkit-media-controls-fullscreen-button.hidden, >-video::-webkit-media-controls-fullscreen-button.hidden { >- display: none !important; >-} >diff --git a/Source/WebCore/platform/wpe/ScrollbarThemeWPE.cpp b/Source/WebCore/platform/adwaita/ScrollbarThemeAdwaita.cpp >similarity index 79% >rename from Source/WebCore/platform/wpe/ScrollbarThemeWPE.cpp >rename to Source/WebCore/platform/adwaita/ScrollbarThemeAdwaita.cpp >index a3962419f4d..4163e5ab485 100644 >--- a/Source/WebCore/platform/wpe/ScrollbarThemeWPE.cpp >+++ b/Source/WebCore/platform/adwaita/ScrollbarThemeAdwaita.cpp >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2014 Igalia S.L. >+ * Copyright (C) 2014, 2020 Igalia S.L. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -24,7 +24,7 @@ > */ > > #include "config.h" >-#include "ScrollbarThemeWPE.h" >+#include "ScrollbarThemeAdwaita.h" > > #include "Color.h" > #include "FloatRoundedRect.h" >@@ -32,6 +32,7 @@ > #include "PlatformMouseEvent.h" > #include "ScrollableArea.h" > #include "Scrollbar.h" >+#include "ThemeAdwaita.h" > > namespace WebCore { > >@@ -49,42 +50,52 @@ static const Color thumbHoveredColor = makeRGB(86, 91, 92); > static const Color thumbPressedColor = makeRGB(27, 106, 203); > static const Color thumbColor = makeRGB(126, 129, 130); > >-int ScrollbarThemeWPE::scrollbarThickness(ScrollbarControlSize, ScrollbarExpansionState) >+bool ScrollbarThemeAdwaita::usesOverlayScrollbars() const >+{ >+#if PLATFORM(GTK) >+ static bool shouldUuseOverlayScrollbars = g_strcmp0(g_getenv("GTK_OVERLAY_SCROLLING"), "0"); >+ return shouldUuseOverlayScrollbars; >+#else >+ return true; >+#endif >+} >+ >+int ScrollbarThemeAdwaita::scrollbarThickness(ScrollbarControlSize, ScrollbarExpansionState) > { > return scrollbarSize; > } > >-int ScrollbarThemeWPE::minimumThumbLength(Scrollbar&) >+int ScrollbarThemeAdwaita::minimumThumbLength(Scrollbar&) > { > return 0; > } > >-bool ScrollbarThemeWPE::hasButtons(Scrollbar&) >+bool ScrollbarThemeAdwaita::hasButtons(Scrollbar&) > { > return false; > } > >-bool ScrollbarThemeWPE::hasThumb(Scrollbar& scrollbar) >+bool ScrollbarThemeAdwaita::hasThumb(Scrollbar& scrollbar) > { > return thumbLength(scrollbar) > 0; > } > >-IntRect ScrollbarThemeWPE::backButtonRect(Scrollbar&, ScrollbarPart, bool) >+IntRect ScrollbarThemeAdwaita::backButtonRect(Scrollbar&, ScrollbarPart, bool) > { > return { }; > } > >-IntRect ScrollbarThemeWPE::forwardButtonRect(Scrollbar&, ScrollbarPart, bool) >+IntRect ScrollbarThemeAdwaita::forwardButtonRect(Scrollbar&, ScrollbarPart, bool) > { > return { }; > } > >-IntRect ScrollbarThemeWPE::trackRect(Scrollbar& scrollbar, bool) >+IntRect ScrollbarThemeAdwaita::trackRect(Scrollbar& scrollbar, bool) > { > return scrollbar.frameRect(); > } > >-bool ScrollbarThemeWPE::paint(Scrollbar& scrollbar, GraphicsContext& graphicsContext, const IntRect& damageRect) >+bool ScrollbarThemeAdwaita::paint(Scrollbar& scrollbar, GraphicsContext& graphicsContext, const IntRect& damageRect) > { > if (graphicsContext.paintingDisabled()) > return false; >@@ -96,7 +107,11 @@ bool ScrollbarThemeWPE::paint(Scrollbar& scrollbar, GraphicsContext& graphicsCon > if (!rect.intersects(damageRect)) > return true; > >- double opacity = scrollbar.hoveredPart() == NoPart ? scrollbar.opacity() : scrollbarOpacity; >+ double opacity; >+ if (usesOverlayScrollbars()) >+ opacity = scrollbar.hoveredPart() == NoPart ? scrollbar.opacity() : scrollbarOpacity; >+ else >+ opacity = 1; > if (!opacity) > return true; > >@@ -106,7 +121,7 @@ bool ScrollbarThemeWPE::paint(Scrollbar& scrollbar, GraphicsContext& graphicsCon > graphicsContext.beginTransparencyLayer(opacity); > } > >- if (scrollbar.hoveredPart() != NoPart) { >+ if (scrollbar.hoveredPart() != NoPart || !usesOverlayScrollbars()) { > graphicsContext.fillRect(rect, scrollbarBackgroundColor); > > IntRect frame = rect; >@@ -122,7 +137,7 @@ bool ScrollbarThemeWPE::paint(Scrollbar& scrollbar, GraphicsContext& graphicsCon > int thumbPos = thumbPosition(scrollbar); > int thumbLen = thumbLength(scrollbar); > IntRect thumb = rect; >- if (scrollbar.hoveredPart() == NoPart) { >+ if (scrollbar.hoveredPart() == NoPart && usesOverlayScrollbars()) { > if (scrollbar.orientation() == VerticalScrollbar) { > if (scrollbar.scrollableArea().shouldPlaceBlockDirectionScrollbarOnLeft()) > thumb.move(hoveredScrollbarBorderSize, thumbPos + thumbBorderSize); >@@ -152,7 +167,7 @@ bool ScrollbarThemeWPE::paint(Scrollbar& scrollbar, GraphicsContext& graphicsCon > > FloatSize corner(4, 4); > Path path; >- if (scrollbar.hoveredPart() == NoPart) { >+ if (scrollbar.hoveredPart() == NoPart && usesOverlayScrollbars()) { > path.addRoundedRect(thumb, corner); > thumb.inflate(-1); > path.addRoundedRect(thumb, corner); >@@ -164,10 +179,10 @@ bool ScrollbarThemeWPE::paint(Scrollbar& scrollbar, GraphicsContext& graphicsCon > > path.addRoundedRect(thumb, corner); > graphicsContext.setFillRule(WindRule::NonZero); >- if (scrollbar.hoveredPart() == NoPart) >+ if (scrollbar.hoveredPart() == NoPart && usesOverlayScrollbars()) > graphicsContext.setFillColor(overlayThumbColor); > else if (scrollbar.pressedPart() == ThumbPart) >- graphicsContext.setFillColor(thumbPressedColor); >+ graphicsContext.setFillColor(static_cast<ThemeAdwaita&>(Theme::singleton()).activeSelectionBackgroundColor()); > else if (scrollbar.hoveredPart() == ThumbPart) > graphicsContext.setFillColor(thumbHoveredColor); > else >@@ -180,7 +195,7 @@ bool ScrollbarThemeWPE::paint(Scrollbar& scrollbar, GraphicsContext& graphicsCon > return true; > } > >-ScrollbarButtonPressAction ScrollbarThemeWPE::handleMousePressEvent(Scrollbar&, const PlatformMouseEvent& event, ScrollbarPart pressedPart) >+ScrollbarButtonPressAction ScrollbarThemeAdwaita::handleMousePressEvent(Scrollbar&, const PlatformMouseEvent& event, ScrollbarPart pressedPart) > { > switch (pressedPart) { > case BackTrackPart: >@@ -207,7 +222,7 @@ ScrollbarButtonPressAction ScrollbarThemeWPE::handleMousePressEvent(Scrollbar&, > > ScrollbarTheme& ScrollbarTheme::nativeTheme() > { >- static ScrollbarThemeWPE theme; >+ static ScrollbarThemeAdwaita theme; > return theme; > } > >diff --git a/Source/WebCore/platform/wpe/ScrollbarThemeWPE.h b/Source/WebCore/platform/adwaita/ScrollbarThemeAdwaita.h >similarity index 86% >rename from Source/WebCore/platform/wpe/ScrollbarThemeWPE.h >rename to Source/WebCore/platform/adwaita/ScrollbarThemeAdwaita.h >index ae9d65911bd..2661de9e9b3 100644 >--- a/Source/WebCore/platform/wpe/ScrollbarThemeWPE.h >+++ b/Source/WebCore/platform/adwaita/ScrollbarThemeAdwaita.h >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2014 Igalia S.L. >+ * Copyright (C) 2014, 2020 Igalia S.L. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -29,13 +29,14 @@ > > namespace WebCore { > >-class ScrollbarThemeWPE final : public ScrollbarThemeComposite { >+class ScrollbarThemeAdwaita final : public ScrollbarThemeComposite { > public: >- ScrollbarThemeWPE() = default; >- virtual ~ScrollbarThemeWPE() = default; >+ ScrollbarThemeAdwaita() = default; >+ virtual ~ScrollbarThemeAdwaita() = default; > > private: >- bool usesOverlayScrollbars() const override { return true; } >+ bool usesOverlayScrollbars() const override; >+ bool invalidateOnMouseEnterExit() override { return usesOverlayScrollbars(); } > > bool paint(Scrollbar&, GraphicsContext&, const IntRect&) override; > ScrollbarButtonPressAction handleMousePressEvent(Scrollbar&, const PlatformMouseEvent&, ScrollbarPart) override; >diff --git a/Source/WebCore/platform/wpe/ThemeWPE.cpp b/Source/WebCore/platform/adwaita/ThemeAdwaita.cpp >similarity index 88% >rename from Source/WebCore/platform/wpe/ThemeWPE.cpp >rename to Source/WebCore/platform/adwaita/ThemeAdwaita.cpp >index c330b2d9568..61d604a84ae 100644 >--- a/Source/WebCore/platform/wpe/ThemeWPE.cpp >+++ b/Source/WebCore/platform/adwaita/ThemeAdwaita.cpp >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2015 Igalia S.L. >+ * Copyright (C) 2015, 2020 Igalia S.L. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -24,7 +24,7 @@ > */ > > #include "config.h" >-#include "ThemeWPE.h" >+#include "ThemeAdwaita.h" > > #include "Color.h" > #include "ControlStates.h" >@@ -41,7 +41,7 @@ static const unsigned arrowSize = 16; > static const Color arrowColor = makeRGB(46, 52, 54); > static const int buttonFocusOffset = -3; > static const unsigned buttonPadding = 5; >-static const int buttonBorderSize = 1; // Keep in sync with menuListButtonBorderSize in RenderThemeWPE. >+static const int buttonBorderSize = 1; // Keep in sync with menuListButtonBorderSize in RenderThemeAdwaita. > static const Color buttonBorderColor = makeRGB(205, 199, 194); > static const Color buttonBackgroundColor = makeRGB(244, 242, 241); > static const Color buttonBackgroundPressedColor = makeRGB(214, 209, 205); >@@ -59,18 +59,40 @@ static const Color spinButtonBackgroundColor = makeRGB(252, 252, 252); > static const Color spinButtonBackgroundHoveredColor = makeRGBA(46, 52, 54, 50); > static const Color spinButtonBackgroundPressedColor = makeRGBA(46, 52, 54, 70); > >+#if !PLATFORM(GTK) > Theme& Theme::singleton() > { >- static NeverDestroyed<ThemeWPE> theme; >+ static NeverDestroyed<ThemeAdwaita> theme; > return theme; > } >+#endif > >-Color ThemeWPE::focusColor() >+Color ThemeAdwaita::activeSelectionForegroundColor() const >+{ >+ return makeRGB(255, 255, 255); >+} >+ >+Color ThemeAdwaita::activeSelectionBackgroundColor() const >+{ >+ return makeRGB(52, 132, 228); >+} >+ >+Color ThemeAdwaita::inactiveSelectionForegroundColor() const >+{ >+ return makeRGB(252, 252, 252); >+} >+ >+Color ThemeAdwaita::inactiveSelectionBackgroundColor() const >+{ >+ return activeSelectionBackgroundColor(); >+} >+ >+Color ThemeAdwaita::focusColor() > { > return focusRingColor; > } > >-void ThemeWPE::paintFocus(GraphicsContext& graphicsContext, const FloatRect& rect, int offset) >+void ThemeAdwaita::paintFocus(GraphicsContext& graphicsContext, const FloatRect& rect, int offset) > { > FloatRect focusRect = rect; > focusRect.inflate(offset); >@@ -79,7 +101,7 @@ void ThemeWPE::paintFocus(GraphicsContext& graphicsContext, const FloatRect& rec > paintFocus(graphicsContext, path, focusRingColor); > } > >-void ThemeWPE::paintFocus(GraphicsContext& graphicsContext, const Path& path, const Color& color) >+void ThemeAdwaita::paintFocus(GraphicsContext& graphicsContext, const Path& path, const Color& color) > { > GraphicsContextStateSaver stateSaver(graphicsContext); > >@@ -97,7 +119,7 @@ void ThemeWPE::paintFocus(GraphicsContext& graphicsContext, const Path& path, co > graphicsContext.endTransparencyLayer(); > } > >-void ThemeWPE::paintFocus(GraphicsContext& graphicsContext, const Vector<FloatRect>& rects, const Color& color) >+void ThemeAdwaita::paintFocus(GraphicsContext& graphicsContext, const Vector<FloatRect>& rects, const Color& color) > { > FloatSize corner(2, 2); > Path path; >@@ -106,7 +128,7 @@ void ThemeWPE::paintFocus(GraphicsContext& graphicsContext, const Vector<FloatRe > paintFocus(graphicsContext, path, color); > } > >-void ThemeWPE::paintArrow(GraphicsContext& graphicsContext, ArrowDirection direction) >+void ThemeAdwaita::paintArrow(GraphicsContext& graphicsContext, ArrowDirection direction) > { > Path path; > switch (direction) { >@@ -127,7 +149,7 @@ void ThemeWPE::paintArrow(GraphicsContext& graphicsContext, ArrowDirection direc > graphicsContext.fillPath(path); > } > >-LengthSize ThemeWPE::controlSize(ControlPart part, const FontCascade& fontCascade, const LengthSize& zoomedSize, float zoomFactor) const >+LengthSize ThemeAdwaita::controlSize(ControlPart part, const FontCascade& fontCascade, const LengthSize& zoomedSize, float zoomFactor) const > { > if (!zoomedSize.width.isIntrinsicOrAuto() && !zoomedSize.height.isIntrinsicOrAuto()) > return Theme::controlSize(part, fontCascade, zoomedSize, zoomFactor); >@@ -151,7 +173,7 @@ LengthSize ThemeWPE::controlSize(ControlPart part, const FontCascade& fontCascad > return Theme::controlSize(part, fontCascade, zoomedSize, zoomFactor); > } > >-void ThemeWPE::paint(ControlPart part, ControlStates& states, GraphicsContext& context, const FloatRect& zoomedRect, float zoomFactor, ScrollView*, float, float, bool, bool) >+void ThemeAdwaita::paint(ControlPart part, ControlStates& states, GraphicsContext& context, const FloatRect& zoomedRect, float zoomFactor, ScrollView*, float, float, bool, bool) > { > switch (part) { > case CheckboxPart: >@@ -174,7 +196,7 @@ void ThemeWPE::paint(ControlPart part, ControlStates& states, GraphicsContext& c > } > } > >-void ThemeWPE::paintCheckbox(ControlStates& states, GraphicsContext& graphicsContext, const FloatRect& zoomedRect, float) >+void ThemeAdwaita::paintCheckbox(ControlStates& states, GraphicsContext& graphicsContext, const FloatRect& zoomedRect, float) > { > GraphicsContextStateSaver stateSaver(graphicsContext); > >@@ -228,7 +250,7 @@ void ThemeWPE::paintCheckbox(ControlStates& states, GraphicsContext& graphicsCon > paintFocus(graphicsContext, zoomedRect, toggleFocusOffset); > } > >-void ThemeWPE::paintRadio(ControlStates& states, GraphicsContext& graphicsContext, const FloatRect& zoomedRect, float) >+void ThemeAdwaita::paintRadio(ControlStates& states, GraphicsContext& graphicsContext, const FloatRect& zoomedRect, float) > { > GraphicsContextStateSaver stateSaver(graphicsContext); > FloatRect fieldRect = zoomedRect; >@@ -266,7 +288,7 @@ void ThemeWPE::paintRadio(ControlStates& states, GraphicsContext& graphicsContex > paintFocus(graphicsContext, zoomedRect, toggleFocusOffset); > } > >-void ThemeWPE::paintButton(ControlStates& states, GraphicsContext& graphicsContext, const FloatRect& zoomedRect, float) >+void ThemeAdwaita::paintButton(ControlStates& states, GraphicsContext& graphicsContext, const FloatRect& zoomedRect, float) > { > GraphicsContextStateSaver stateSaver(graphicsContext); > >@@ -297,7 +319,7 @@ void ThemeWPE::paintButton(ControlStates& states, GraphicsContext& graphicsConte > paintFocus(graphicsContext, zoomedRect, buttonFocusOffset); > } > >-void ThemeWPE::paintSpinButton(ControlStates& states, GraphicsContext& graphicsContext, const FloatRect& zoomedRect, float) >+void ThemeAdwaita::paintSpinButton(ControlStates& states, GraphicsContext& graphicsContext, const FloatRect& zoomedRect, float) > { > GraphicsContextStateSaver stateSaver(graphicsContext); > >diff --git a/Source/WebCore/platform/wpe/ThemeWPE.h b/Source/WebCore/platform/adwaita/ThemeAdwaita.h >similarity index 86% >rename from Source/WebCore/platform/wpe/ThemeWPE.h >rename to Source/WebCore/platform/adwaita/ThemeAdwaita.h >index 64de0c548b3..feb07e8712f 100644 >--- a/Source/WebCore/platform/wpe/ThemeWPE.h >+++ b/Source/WebCore/platform/adwaita/ThemeAdwaita.h >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2015 Igalia S.L. >+ * Copyright (C) 2015, 2020 Igalia S.L. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -32,7 +32,7 @@ namespace WebCore { > > class Path; > >-class ThemeWPE final : public Theme { >+class ThemeAdwaita : public Theme { > public: > static Color focusColor(); > static void paintFocus(GraphicsContext&, const FloatRect&, int offset); >@@ -41,9 +41,14 @@ public: > enum class ArrowDirection { Up, Down }; > static void paintArrow(GraphicsContext&, ArrowDirection); > >+ virtual Color activeSelectionForegroundColor() const; >+ virtual Color activeSelectionBackgroundColor() const; >+ virtual Color inactiveSelectionForegroundColor() const; >+ virtual Color inactiveSelectionBackgroundColor() const; >+ virtual void platformColorsDidChange() { }; >+ > private: > LengthSize controlSize(ControlPart, const FontCascade&, const LengthSize&, float) const final; >- > void paint(ControlPart, ControlStates&, GraphicsContext&, const FloatRect&, float, ScrollView*, float, float, bool, bool) final; > > void paintCheckbox(ControlStates&, GraphicsContext&, const FloatRect&, float); >diff --git a/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp b/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp >index cd8f1db359e..ad33265418e 100644 >--- a/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp >+++ b/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp >@@ -279,34 +279,6 @@ static inline void fillCurrentCairoPath(PlatformContextCairo& platformContext, c > cairo_restore(cr); > } > >-static inline void adjustFocusRingColor(Color& color) >-{ >-#if !PLATFORM(GTK) >- // Force the alpha to 50%. This matches what the Mac does with outline rings. >- color = Color(makeRGBA(color.red(), color.green(), color.blue(), 127)); >-#else >- UNUSED_PARAM(color); >-#endif >-} >- >-static inline void adjustFocusRingLineWidth(float& width) >-{ >-#if PLATFORM(GTK) >- width = 2; >-#else >- UNUSED_PARAM(width); >-#endif >-} >- >-static inline StrokeStyle focusRingStrokeStyle() >-{ >-#if PLATFORM(GTK) >- return DottedStroke; >-#else >- return SolidStroke; >-#endif >-} >- > static void drawGlyphsToContext(cairo_t* context, cairo_scaled_font_t* scaledFont, double syntheticBoldOffset, const Vector<cairo_glyph_t>& glyphs, FontSmoothingMode fontSmoothingMode) > { > cairo_matrix_t originalTransform; >@@ -1151,9 +1123,9 @@ void drawFocusRing(PlatformContextCairo& platformContext, const Path& path, floa > { > // FIXME: We should draw paths that describe a rectangle with rounded corners > // so as to be consistent with how we draw rectangular focus rings. >- Color ringColor = color; >- adjustFocusRingColor(ringColor); >- adjustFocusRingLineWidth(width); >+ >+ // Force the alpha to 50%. This matches what the Mac does with outline rings. >+ Color ringColor = makeRGBA(color.red(), color.green(), color.blue(), 127); > > cairo_t* cr = platformContext.cr(); > cairo_save(cr); >@@ -1162,7 +1134,6 @@ void drawFocusRing(PlatformContextCairo& platformContext, const Path& path, floa > appendWebCorePathToCairoContext(cr, path); > setSourceRGBAFromColor(cr, ringColor); > cairo_set_line_width(cr, width); >- Cairo::State::setStrokeStyle(platformContext, focusRingStrokeStyle()); > cairo_set_operator(cr, CAIRO_OPERATOR_OVER); > cairo_stroke_preserve(cr); > >@@ -1180,10 +1151,6 @@ void drawFocusRing(PlatformContextCairo& platformContext, const Path& path, floa > void drawFocusRing(PlatformContextCairo& platformContext, const Vector<FloatRect>& rects, float width, const Color& color) > { > Path path; >-#if PLATFORM(GTK) >- for (const auto& rect : rects) >- path.addRect(rect); >-#else > unsigned rectCount = rects.size(); > int radius = (width - 1) / 2; > Path subPath; >@@ -1193,7 +1160,6 @@ void drawFocusRing(PlatformContextCairo& platformContext, const Vector<FloatRect > subPath.addRoundedRect(rects[i], FloatSize(radius, radius)); > path.addPath(subPath, AffineTransform()); > } >-#endif > > drawFocusRing(platformContext, path, width, color); > } >diff --git a/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp b/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp >index 8f9a6d5c70f..a104656cb5d 100644 >--- a/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp >+++ b/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp >@@ -51,8 +51,8 @@ > #include <cairo-win32.h> > #endif > >-#if PLATFORM(WPE) >-#include "ThemeWPE.h" >+#if PLATFORM(WPE) || PLATFORM(GTK) >+#include "ThemeAdwaita.h" > #endif > > namespace WebCore { >@@ -292,8 +292,8 @@ void GraphicsContext::drawFocusRing(const Path& path, float width, float offset, > if (paintingDisabled()) > return; > >-#if PLATFORM(WPE) >- ThemeWPE::paintFocus(*this, path, color); >+#if PLATFORM(WPE) || PLATFORM(GTK) >+ ThemeAdwaita::paintFocus(*this, path, color); > UNUSED_PARAM(width); > UNUSED_PARAM(offset); > return; >@@ -314,8 +314,8 @@ void GraphicsContext::drawFocusRing(const Vector<FloatRect>& rects, float width, > if (paintingDisabled()) > return; > >-#if PLATFORM(WPE) >- ThemeWPE::paintFocus(*this, rects, color); >+#if PLATFORM(WPE) || PLATFORM(GTK) >+ ThemeAdwaita::paintFocus(*this, rects, color); > UNUSED_PARAM(width); > UNUSED_PARAM(offset); > return; >diff --git a/Source/WebCore/platform/gtk/RenderThemeGadget.cpp b/Source/WebCore/platform/gtk/RenderThemeGadget.cpp >deleted file mode 100644 >index 73e0758a6ed..00000000000 >--- a/Source/WebCore/platform/gtk/RenderThemeGadget.cpp >+++ /dev/null >@@ -1,400 +0,0 @@ >-/* >- * Copyright (C) 2016 Igalia S.L. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#include "config.h" >-#include "RenderThemeGadget.h" >- >-#include "FloatRect.h" >-#include "GRefPtrGtk.h" >- >-namespace WebCore { >- >-std::unique_ptr<RenderThemeGadget> RenderThemeGadget::create(const RenderThemeGadget::Info& info, RenderThemeGadget* parent, const Vector<RenderThemeGadget::Info> siblings, unsigned position) >-{ >- switch (info.type) { >- case RenderThemeGadget::Type::Generic: >- return makeUnique<RenderThemeGadget>(info, parent, siblings, position); >- case RenderThemeGadget::Type::TextField: >- return makeUnique<RenderThemeTextFieldGadget>(info, parent, siblings, position); >- case RenderThemeGadget::Type::Radio: >- case RenderThemeGadget::Type::Check: >- return makeUnique<RenderThemeToggleGadget>(info, parent, siblings, position); >- case RenderThemeGadget::Type::Arrow: >- return makeUnique<RenderThemeArrowGadget>(info, parent, siblings, position); >- case RenderThemeGadget::Type::Icon: >- return makeUnique<RenderThemeIconGadget>(info, parent, siblings, position); >- case RenderThemeGadget::Type::Scrollbar: >- return makeUnique<RenderThemeScrollbarGadget>(info, parent, siblings, position); >- case RenderThemeGadget::Type::Button: >- return makeUnique<RenderThemeButtonGadget>(info, parent, siblings, position); >- } >- >- ASSERT_NOT_REACHED(); >- return nullptr; >-} >- >-static GRefPtr<GtkStyleContext> createStyleContext(GtkWidgetPath* path, GtkStyleContext* parent) >-{ >- GRefPtr<GtkStyleContext> context = adoptGRef(gtk_style_context_new()); >- gtk_style_context_set_path(context.get(), path); >- gtk_style_context_set_parent(context.get(), parent); >- return context; >-} >- >-static void appendElementToPath(GtkWidgetPath* path, const RenderThemeGadget::Info& info) >-{ >- // Scrollbars need to use its GType to be able to get non-CSS style properties. >- gtk_widget_path_append_type(path, info.type == RenderThemeGadget::Type::Scrollbar ? GTK_TYPE_SCROLLBAR : G_TYPE_NONE); >- gtk_widget_path_iter_set_object_name(path, -1, info.name); >- for (const auto* className : info.classList) >- gtk_widget_path_iter_add_class(path, -1, className); >-} >- >-RenderThemeGadget::RenderThemeGadget(const RenderThemeGadget::Info& info, RenderThemeGadget* parent, const Vector<RenderThemeGadget::Info> siblings, unsigned position) >-{ >- GRefPtr<GtkWidgetPath> path = parent ? adoptGRef(gtk_widget_path_copy(gtk_style_context_get_path(parent->context()))) : adoptGRef(gtk_widget_path_new()); >- if (!siblings.isEmpty()) { >- GRefPtr<GtkWidgetPath> siblingsPath = adoptGRef(gtk_widget_path_new()); >- for (const auto& siblingInfo : siblings) >- appendElementToPath(siblingsPath.get(), siblingInfo); >- gtk_widget_path_append_with_siblings(path.get(), siblingsPath.get(), position); >- } else >- appendElementToPath(path.get(), info); >- m_context = createStyleContext(path.get(), parent ? parent->context() : nullptr); >-} >- >-RenderThemeGadget::~RenderThemeGadget() = default; >- >-GtkBorder RenderThemeGadget::marginBox() const >-{ >- GtkBorder returnValue; >- gtk_style_context_get_margin(m_context.get(), gtk_style_context_get_state(m_context.get()), &returnValue); >- return returnValue; >-} >- >-GtkBorder RenderThemeGadget::borderBox() const >-{ >- GtkBorder returnValue; >- gtk_style_context_get_border(m_context.get(), gtk_style_context_get_state(m_context.get()), &returnValue); >- return returnValue; >-} >- >-GtkBorder RenderThemeGadget::paddingBox() const >-{ >- GtkBorder returnValue; >- gtk_style_context_get_padding(m_context.get(), gtk_style_context_get_state(m_context.get()), &returnValue); >- return returnValue; >-} >- >-GtkBorder RenderThemeGadget::contentsBox() const >-{ >- auto margin = marginBox(); >- auto border = borderBox(); >- auto padding = paddingBox(); >- padding.left += margin.left + border.left; >- padding.right += margin.right + border.right; >- padding.top += margin.top + border.top; >- padding.bottom += margin.bottom + border.bottom; >- return padding; >-} >- >-Color RenderThemeGadget::color() const >-{ >- GdkRGBA returnValue; >- gtk_style_context_get_color(m_context.get(), gtk_style_context_get_state(m_context.get()), &returnValue); >- return returnValue; >-} >- >-Color RenderThemeGadget::backgroundColor() const >-{ >- GdkRGBA returnValue; >- gtk_style_context_get_background_color(m_context.get(), gtk_style_context_get_state(m_context.get()), &returnValue); >- return returnValue; >-} >- >-double RenderThemeGadget::opacity() const >-{ >- double returnValue; >- gtk_style_context_get(m_context.get(), gtk_style_context_get_state(m_context.get()), "opacity", &returnValue, nullptr); >- return returnValue; >-} >- >-GtkStateFlags RenderThemeGadget::state() const >-{ >- return gtk_style_context_get_state(m_context.get()); >-} >- >-void RenderThemeGadget::setState(GtkStateFlags state) >-{ >- gtk_style_context_set_state(m_context.get(), state); >-} >- >-IntSize RenderThemeGadget::minimumSize() const >-{ >- int width, height; >- gtk_style_context_get(m_context.get(), gtk_style_context_get_state(m_context.get()), "min-width", &width, "min-height", &height, nullptr); >- return IntSize(width, height); >-} >- >-IntSize RenderThemeGadget::preferredSize() const >-{ >- auto margin = marginBox(); >- auto border = borderBox(); >- auto padding = paddingBox(); >- auto minSize = minimumSize(); >- minSize.expand(margin.left + margin.right + border.left + border.right + padding.left + padding.right, >- margin.top + margin.bottom + border.top + border.bottom + padding.top + padding.bottom); >- return minSize; >-} >- >-bool RenderThemeGadget::render(cairo_t* cr, const FloatRect& paintRect, FloatRect* contentsRect) >-{ >- FloatRect rect = paintRect; >- >- auto margin = marginBox(); >- rect.move(margin.left, margin.top); >- rect.contract(margin.left + margin.right, margin.top + margin.bottom); >- >- auto minSize = minimumSize(); >- rect.setWidth(std::max<float>(rect.width(), minSize.width())); >- rect.setHeight(std::max<float>(rect.height(), minSize.height())); >- >- gtk_render_background(m_context.get(), cr, rect.x(), rect.y(), rect.width(), rect.height()); >- gtk_render_frame(m_context.get(), cr, rect.x(), rect.y(), rect.width(), rect.height()); >- >- if (contentsRect) { >- auto border = borderBox(); >- auto padding = paddingBox(); >- *contentsRect = rect; >- contentsRect->move(border.left + padding.left, border.top + padding.top); >- contentsRect->contract(border.left + border.right + padding.left + padding.right, border.top + border.bottom + padding.top + padding.bottom); >- } >- >- return true; >-} >- >-void RenderThemeGadget::renderFocus(cairo_t* cr, const FloatRect& focusRect) >-{ >- FloatRect rect = focusRect; >- auto margin = marginBox(); >- rect.move(margin.left, margin.top); >- rect.contract(margin.left + margin.right, margin.top + margin.bottom); >- gtk_render_focus(m_context.get(), cr, rect.x(), rect.y(), rect.width(), rect.height()); >-} >- >-RenderThemeBoxGadget::RenderThemeBoxGadget(const RenderThemeGadget::Info& info, GtkOrientation orientation, const Vector<RenderThemeGadget::Info> children, RenderThemeGadget* parent) >- : RenderThemeGadget(info, parent, Vector<RenderThemeGadget::Info>(), 0) >- , m_orientation(orientation) >-{ >- m_children.reserveCapacity(children.size()); >- unsigned index = 0; >- for (const auto& childInfo : children) >- m_children.uncheckedAppend(RenderThemeGadget::create(childInfo, this, children, index++)); >-} >- >-IntSize RenderThemeBoxGadget::preferredSize() const >-{ >- IntSize childrenSize; >- for (const auto& child : m_children) { >- IntSize childSize = child->preferredSize(); >- switch (m_orientation) { >- case GTK_ORIENTATION_HORIZONTAL: >- childrenSize.setWidth(childrenSize.width() + childSize.width()); >- childrenSize.setHeight(std::max(childrenSize.height(), childSize.height())); >- break; >- case GTK_ORIENTATION_VERTICAL: >- childrenSize.setWidth(std::max(childrenSize.width(), childSize.width())); >- childrenSize.setHeight(childrenSize.height() + childSize.height()); >- break; >- } >- } >- return RenderThemeGadget::preferredSize().expandedTo(childrenSize); >-} >- >-RenderThemeTextFieldGadget::RenderThemeTextFieldGadget(const RenderThemeGadget::Info& info, RenderThemeGadget* parent, const Vector<RenderThemeGadget::Info> siblings, unsigned position) >- : RenderThemeGadget(info, parent, siblings, position) >-{ >-} >- >-IntSize RenderThemeTextFieldGadget::minimumSize() const >-{ >- // We allow text fields smaller than the min size set on themes. >- return IntSize(); >-} >- >-RenderThemeToggleGadget::RenderThemeToggleGadget(const RenderThemeGadget::Info& info, RenderThemeGadget* parent, const Vector<RenderThemeGadget::Info> siblings, unsigned position) >- : RenderThemeGadget(info, parent, siblings, position) >- , m_type(info.type) >-{ >- ASSERT(m_type == RenderThemeGadget::Type::Radio || m_type == RenderThemeGadget::Type::Check); >-} >- >-bool RenderThemeToggleGadget::render(cairo_t* cr, const FloatRect& paintRect, FloatRect*) >-{ >- FloatRect contentsRect; >- RenderThemeGadget::render(cr, paintRect, &contentsRect); >- if (m_type == RenderThemeGadget::Type::Radio) >- gtk_render_option(m_context.get(), cr, contentsRect.x(), contentsRect.y(), contentsRect.width(), contentsRect.height()); >- else >- gtk_render_check(m_context.get(), cr, contentsRect.x(), contentsRect.y(), contentsRect.width(), contentsRect.height()); >- return true; >-} >- >-RenderThemeArrowGadget::RenderThemeArrowGadget(const RenderThemeGadget::Info& info, RenderThemeGadget* parent, const Vector<RenderThemeGadget::Info> siblings, unsigned position) >- : RenderThemeGadget(info, parent, siblings, position) >-{ >-} >- >-bool RenderThemeArrowGadget::render(cairo_t* cr, const FloatRect& paintRect, FloatRect*) >-{ >- FloatRect contentsRect; >- RenderThemeGadget::render(cr, paintRect, &contentsRect); >- IntSize minSize = minimumSize(); >- int arrowSize = std::min(minSize.width(), minSize.height()); >- FloatPoint arrowPosition(contentsRect.x(), contentsRect.y() + (contentsRect.height() - arrowSize) / 2); >- if (gtk_style_context_get_state(m_context.get()) & GTK_STATE_FLAG_DIR_LTR) >- arrowPosition.move(contentsRect.width() - arrowSize, 0); >- gtk_render_arrow(m_context.get(), cr, G_PI / 2, arrowPosition.x(), arrowPosition.y(), arrowSize); >- return true; >-} >- >-RenderThemeIconGadget::RenderThemeIconGadget(const RenderThemeGadget::Info& info, RenderThemeGadget* parent, const Vector<RenderThemeGadget::Info> siblings, unsigned position) >- : RenderThemeGadget(info, parent, siblings, position) >-{ >-} >- >-GtkIconSize RenderThemeIconGadget::gtkIconSizeForPixelSize(unsigned pixelSize) const >-{ >- if (pixelSize < IconSizeGtk::SmallToolbar) >- return GTK_ICON_SIZE_MENU; >- if (pixelSize >= IconSizeGtk::SmallToolbar && pixelSize < IconSizeGtk::Button) >- return GTK_ICON_SIZE_SMALL_TOOLBAR; >- if (pixelSize >= IconSizeGtk::Button && pixelSize < IconSizeGtk::LargeToolbar) >- return GTK_ICON_SIZE_BUTTON; >- if (pixelSize >= IconSizeGtk::LargeToolbar && pixelSize < IconSizeGtk::DragAndDrop) >- return GTK_ICON_SIZE_LARGE_TOOLBAR; >- if (pixelSize >= IconSizeGtk::DragAndDrop && pixelSize < IconSizeGtk::Dialog) >- return GTK_ICON_SIZE_DND; >- >- return GTK_ICON_SIZE_DIALOG; >-} >- >-bool RenderThemeIconGadget::render(cairo_t* cr, const FloatRect& paintRect, FloatRect*) >-{ >- ASSERT(!m_iconName.isNull()); >- GRefPtr<GIcon> icon = adoptGRef(g_themed_icon_new(m_iconName.data())); >- unsigned lookupFlags = GTK_ICON_LOOKUP_USE_BUILTIN | GTK_ICON_LOOKUP_FORCE_SIZE | GTK_ICON_LOOKUP_FORCE_SVG; >- GtkTextDirection direction = gtk_style_context_get_direction(m_context.get()); >- if (direction & GTK_TEXT_DIR_LTR) >- lookupFlags |= GTK_ICON_LOOKUP_DIR_LTR; >- else if (direction & GTK_TEXT_DIR_RTL) >- lookupFlags |= GTK_ICON_LOOKUP_DIR_RTL; >- int iconWidth, iconHeight; >- if (!gtk_icon_size_lookup(gtkIconSizeForPixelSize(m_iconSize), &iconWidth, &iconHeight)) >- iconWidth = iconHeight = m_iconSize; >- GRefPtr<GtkIconInfo> iconInfo = adoptGRef(gtk_icon_theme_lookup_by_gicon(gtk_icon_theme_get_default(), icon.get(), >- std::min(iconWidth, iconHeight), static_cast<GtkIconLookupFlags>(lookupFlags))); >- if (!iconInfo) >- return false; >- >- GRefPtr<GdkPixbuf> iconPixbuf = adoptGRef(gtk_icon_info_load_symbolic_for_context(iconInfo.get(), m_context.get(), nullptr, nullptr)); >- if (!iconPixbuf) >- return false; >- >- FloatSize pixbufSize(gdk_pixbuf_get_width(iconPixbuf.get()), gdk_pixbuf_get_height(iconPixbuf.get())); >- FloatRect contentsRect; >- RenderThemeGadget::render(cr, paintRect, &contentsRect); >- if (pixbufSize.width() > contentsRect.width() || pixbufSize.height() > contentsRect.height()) { >- iconWidth = iconHeight = std::min(contentsRect.width(), contentsRect.height()); >- pixbufSize = FloatSize(iconWidth, iconHeight); >- iconPixbuf = adoptGRef(gdk_pixbuf_scale_simple(iconPixbuf.get(), pixbufSize.width(), pixbufSize.height(), GDK_INTERP_BILINEAR)); >- } >- >- gtk_render_icon(m_context.get(), cr, iconPixbuf.get(), contentsRect.x() + (contentsRect.width() - pixbufSize.width()) / 2, >- contentsRect.y() + (contentsRect.height() - pixbufSize.height()) / 2); >- return true; >-} >- >-IntSize RenderThemeIconGadget::minimumSize() const >-{ >- if (m_iconSize < IconSizeGtk::Menu) >- return IntSize(m_iconSize, m_iconSize); >- >- int iconWidth, iconHeight; >- if (gtk_icon_size_lookup(gtkIconSizeForPixelSize(m_iconSize), &iconWidth, &iconHeight)) >- return IntSize(iconWidth, iconHeight); >- >- return IntSize(m_iconSize, m_iconSize); >-} >- >-RenderThemeScrollbarGadget::RenderThemeScrollbarGadget(const RenderThemeGadget::Info& info, RenderThemeGadget* parent, const Vector<RenderThemeGadget::Info> siblings, unsigned position) >- : RenderThemeGadget(info, parent, siblings, position) >-{ >- gboolean hasBackward, hasForward, hasSecondaryBackward, hasSecondaryForward; >- gtk_style_context_get_style(m_context.get(), "has-backward-stepper", &hasBackward, "has-forward-stepper", &hasForward, >- "has-secondary-backward-stepper", &hasSecondaryBackward, "has-secondary-forward-stepper", &hasSecondaryForward, nullptr); >- if (hasBackward) >- m_steppers.add(Steppers::Backward); >- if (hasForward) >- m_steppers.add(Steppers::Forward); >- if (hasSecondaryBackward) >- m_steppers.add(Steppers::SecondaryBackward); >- if (hasSecondaryForward) >- m_steppers.add(Steppers::SecondaryForward); >-} >- >-void RenderThemeScrollbarGadget::renderStepper(cairo_t* cr, const FloatRect& paintRect, RenderThemeGadget* stepperGadget, GtkOrientation orientation, Steppers stepper) >-{ >- FloatRect contentsRect; >- stepperGadget->render(cr, paintRect, &contentsRect); >- double angle; >- switch (stepper) { >- case Steppers::Backward: >- case Steppers::SecondaryBackward: >- angle = orientation == GTK_ORIENTATION_VERTICAL ? 0 : 3 * (G_PI / 2); >- break; >- case Steppers::Forward: >- case Steppers::SecondaryForward: >- angle = orientation == GTK_ORIENTATION_VERTICAL ? G_PI / 2 : G_PI; >- break; >- } >- >- int stepperSize = std::max(contentsRect.width(), contentsRect.height()); >- gtk_render_arrow(stepperGadget->context(), cr, angle, contentsRect.x() + (contentsRect.width() - stepperSize) / 2, >- contentsRect.y() + (contentsRect.height() - stepperSize) / 2, stepperSize); >-} >- >-RenderThemeButtonGadget::RenderThemeButtonGadget(const Info& info, RenderThemeGadget* parent, const Vector<RenderThemeGadget::Info> siblings, unsigned position) >- : RenderThemeGadget(info, parent, siblings, position) >-{ >-} >- >-IntSize RenderThemeButtonGadget::minimumSize() const >-{ >- // Allow buttons to be smaller than the minimum size >- return IntSize(); >-} >- >-} // namespace WebCore >diff --git a/Source/WebCore/platform/gtk/RenderThemeGadget.h b/Source/WebCore/platform/gtk/RenderThemeGadget.h >deleted file mode 100644 >index cc18f89d6eb..00000000000 >--- a/Source/WebCore/platform/gtk/RenderThemeGadget.h >+++ /dev/null >@@ -1,177 +0,0 @@ >-/* >- * Copyright (C) 2016 Igalia S.L. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#pragma once >- >-#include "Color.h" >-#include "IntSize.h" >-#include <gtk/gtk.h> >-#include <wtf/OptionSet.h> >-#include <wtf/Vector.h> >-#include <wtf/glib/GRefPtr.h> >-#include <wtf/text/CString.h> >- >-namespace WebCore { >-class FloatRect; >- >-class RenderThemeGadget { >- WTF_MAKE_FAST_ALLOCATED; >- WTF_MAKE_NONCOPYABLE(RenderThemeGadget); >-public: >- enum class Type { >- Generic, >- TextField, >- Check, >- Radio, >- Arrow, >- Icon, >- Scrollbar, >- Button >- }; >- >- struct Info { >- Type type; >- const char* name; >- Vector<const char*> classList; >- }; >- >- static std::unique_ptr<RenderThemeGadget> create(const Info&, RenderThemeGadget* parent = nullptr, const Vector<RenderThemeGadget::Info> siblings = Vector<RenderThemeGadget::Info>(), unsigned position = 0); >- RenderThemeGadget(const Info&, RenderThemeGadget* parent, const Vector<RenderThemeGadget::Info> siblings, unsigned position); >- virtual ~RenderThemeGadget(); >- >- virtual IntSize preferredSize() const; >- virtual bool render(cairo_t*, const FloatRect&, FloatRect* = nullptr); >- virtual IntSize minimumSize() const; >- >- void renderFocus(cairo_t*, const FloatRect&); >- >- GtkBorder contentsBox() const; >- Color color() const; >- Color backgroundColor() const; >- double opacity() const; >- >- GtkStyleContext* context() const { return m_context.get(); } >- >- GtkStateFlags state() const; >- void setState(GtkStateFlags); >- >-protected: >- GtkBorder marginBox() const; >- GtkBorder borderBox() const; >- GtkBorder paddingBox() const; >- >- GRefPtr<GtkStyleContext> m_context; >-}; >- >-class RenderThemeBoxGadget final : public RenderThemeGadget { >-public: >- RenderThemeBoxGadget(const RenderThemeGadget::Info&, GtkOrientation, const Vector<RenderThemeGadget::Info> children, RenderThemeGadget* parent = nullptr); >- >- IntSize preferredSize() const override; >- >- RenderThemeGadget* child(unsigned index) const { return m_children[index].get(); } >- >-private: >- Vector<std::unique_ptr<RenderThemeGadget>> m_children; >- GtkOrientation m_orientation { GTK_ORIENTATION_HORIZONTAL }; >-}; >- >-class RenderThemeTextFieldGadget final : public RenderThemeGadget { >-public: >- RenderThemeTextFieldGadget(const Info&, RenderThemeGadget* parent, const Vector<RenderThemeGadget::Info> siblings, unsigned position); >- >- IntSize minimumSize() const override; >-}; >- >-class RenderThemeToggleGadget final : public RenderThemeGadget { >-public: >- RenderThemeToggleGadget(const Info&, RenderThemeGadget* parent, const Vector<RenderThemeGadget::Info> siblings, unsigned position); >- >- bool render(cairo_t*, const FloatRect&, FloatRect* = nullptr) override; >- >-private: >- RenderThemeGadget::Type m_type; >-}; >- >-class RenderThemeArrowGadget final : public RenderThemeGadget { >-public: >- RenderThemeArrowGadget(const Info&, RenderThemeGadget* parent, const Vector<RenderThemeGadget::Info> siblings, unsigned position); >- >- bool render(cairo_t*, const FloatRect&, FloatRect* = nullptr) override; >-}; >- >-class RenderThemeIconGadget final : public RenderThemeGadget { >-public: >- RenderThemeIconGadget(const Info&, RenderThemeGadget* parent, const Vector<RenderThemeGadget::Info> siblings, unsigned position); >- >- bool render(cairo_t*, const FloatRect&, FloatRect* = nullptr) override; >- IntSize minimumSize() const override; >- >- void setIconName(const char* iconName) { m_iconName = iconName; } >- void setIconSize(unsigned iconSize) { m_iconSize = iconSize; } >- >- // Defined in GTK+ (gtk/gtkiconfactory.c). >- enum IconSizeGtk { >- Menu = 16, >- SmallToolbar = 18, >- Button = 20, >- LargeToolbar = 24, >- DragAndDrop = 32, >- Dialog = 48 >- }; >- >-private: >- GtkIconSize gtkIconSizeForPixelSize(unsigned) const; >- >- CString m_iconName; >- unsigned m_iconSize { 0 }; >-}; >- >-class RenderThemeScrollbarGadget final : public RenderThemeGadget { >-public: >- RenderThemeScrollbarGadget(const Info&, RenderThemeGadget* parent, const Vector<RenderThemeGadget::Info> siblings, unsigned position); >- >- enum class Steppers { >- Backward = 1 << 0, >- Forward = 1 << 1, >- SecondaryBackward = 1 << 2, >- SecondaryForward = 1 << 3 >- }; >- OptionSet<Steppers> steppers() const { return m_steppers; }; >- >- void renderStepper(cairo_t*, const FloatRect&, RenderThemeGadget*, GtkOrientation, Steppers); >- >-private: >- OptionSet<Steppers> m_steppers; >-}; >- >-class RenderThemeButtonGadget final : public RenderThemeGadget { >-public: >- RenderThemeButtonGadget(const Info&, RenderThemeGadget* parent, const Vector<RenderThemeGadget::Info> siblings, unsigned position); >- >- IntSize minimumSize() const override; >-}; >- >-} // namespace WebCore >diff --git a/Source/WebCore/platform/gtk/RenderThemeWidget.cpp b/Source/WebCore/platform/gtk/RenderThemeWidget.cpp >deleted file mode 100644 >index ca6ed918a50..00000000000 >--- a/Source/WebCore/platform/gtk/RenderThemeWidget.cpp >+++ /dev/null >@@ -1,301 +0,0 @@ >-/* >- * Copyright (C) 2017 Igalia S.L. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#include "config.h" >-#include "RenderThemeWidget.h" >- >-#include <wtf/HashMap.h> >-#include <wtf/NeverDestroyed.h> >- >-namespace WebCore { >- >-static HashMap<unsigned, std::unique_ptr<RenderThemeWidget>>& widgetMap() >-{ >- static NeverDestroyed<HashMap<unsigned, std::unique_ptr<RenderThemeWidget>>> map; >- return map; >-} >- >-RenderThemeWidget& RenderThemeWidget::getOrCreate(Type widgetType) >-{ >- auto addResult = widgetMap().ensure(static_cast<unsigned>(widgetType), [widgetType]() -> std::unique_ptr<RenderThemeWidget> { >- switch (widgetType) { >- case RenderThemeWidget::Type::VerticalScrollbarRight: >- return makeUnique<RenderThemeScrollbar>(GTK_ORIENTATION_VERTICAL, RenderThemeScrollbar::Mode::Full); >- case RenderThemeWidget::Type::VerticalScrollbarLeft: >- return makeUnique<RenderThemeScrollbar>(GTK_ORIENTATION_VERTICAL, RenderThemeScrollbar::Mode::Full, RenderThemeScrollbar::VerticalPosition::Left); >- case RenderThemeWidget::Type::HorizontalScrollbar: >- return makeUnique<RenderThemeScrollbar>(GTK_ORIENTATION_HORIZONTAL, RenderThemeScrollbar::Mode::Full); >- case RenderThemeWidget::Type::VerticalScrollIndicatorRight: >- return makeUnique<RenderThemeScrollbar>(GTK_ORIENTATION_VERTICAL, RenderThemeScrollbar::Mode::Indicator); >- case RenderThemeWidget::Type::VerticalScrollIndicatorLeft: >- return makeUnique<RenderThemeScrollbar>(GTK_ORIENTATION_VERTICAL, RenderThemeScrollbar::Mode::Indicator, RenderThemeScrollbar::VerticalPosition::Left); >- case RenderThemeWidget::Type::HorizontalScrollIndicator: >- return makeUnique<RenderThemeScrollbar>(GTK_ORIENTATION_HORIZONTAL, RenderThemeScrollbar::Mode::Indicator); >- case RenderThemeWidget::Type::CheckButton: >- return makeUnique<RenderThemeToggleButton>(RenderThemeToggleButton::Type::Check); >- case RenderThemeWidget::Type::RadioButton: >- return makeUnique<RenderThemeToggleButton>(RenderThemeToggleButton::Type::Radio); >- case RenderThemeWidget::Type::Button: >- return makeUnique<RenderThemeButton>(RenderThemeButton::Default::No); >- case RenderThemeWidget::Type::ButtonDefault: >- return makeUnique<RenderThemeButton>(RenderThemeButton::Default::Yes); >- case RenderThemeWidget::Type::ComboBox: >- return makeUnique<RenderThemeComboBox>(); >- case RenderThemeWidget::Type::Entry: >- return makeUnique<RenderThemeEntry>(); >- case RenderThemeWidget::Type::SelectedEntry: >- return makeUnique<RenderThemeEntry>(RenderThemeEntry::Selected::Yes); >- case RenderThemeWidget::Type::SearchEntry: >- return makeUnique<RenderThemeSearchEntry>(); >- case RenderThemeWidget::Type::SpinButton: >- return makeUnique<RenderThemeSpinButton>(); >- case RenderThemeWidget::Type::VerticalSlider: >- return makeUnique<RenderThemeSlider>(GTK_ORIENTATION_VERTICAL); >- case RenderThemeWidget::Type::HorizontalSlider: >- return makeUnique<RenderThemeSlider>(GTK_ORIENTATION_HORIZONTAL); >- case RenderThemeWidget::Type::ProgressBar: >- return makeUnique<RenderThemeProgressBar>(RenderThemeProgressBar::Mode::Determinate); >- case RenderThemeWidget::Type::IndeterminateProgressBar: >- return makeUnique<RenderThemeProgressBar>(RenderThemeProgressBar::Mode::Indeterminate); >- case RenderThemeWidget::Type::ListView: >- return makeUnique<RenderThemeListView>(); >- case RenderThemeWidget::Type::Icon: >- return makeUnique<RenderThemeIcon>(); >- case RenderThemeWidget::Type::Window: >- return makeUnique<RenderThemeWindow>(); >- } >- ASSERT_NOT_REACHED(); >- return nullptr; >- }); >- return *addResult.iterator->value; >-} >- >-void RenderThemeWidget::clearCache() >-{ >- widgetMap().clear(); >-} >- >-RenderThemeWidget::~RenderThemeWidget() = default; >- >-RenderThemeScrollbar::RenderThemeScrollbar(GtkOrientation orientation, Mode mode, VerticalPosition verticalPosition) >-{ >- RenderThemeGadget::Info info = { RenderThemeGadget::Type::Scrollbar, "scrollbar", { } }; >- if (orientation == GTK_ORIENTATION_VERTICAL) { >- info.classList.append("vertical"); >- info.classList.append(verticalPosition == VerticalPosition::Right ? "right" : "left"); >- } else { >- info.classList.append("horizontal"); >- info.classList.append("bottom"); >- } >- static bool usesOverlayScrollbars = g_strcmp0(g_getenv("GTK_OVERLAY_SCROLLING"), "0"); >- if (usesOverlayScrollbars) >- info.classList.append("overlay-indicator"); >- if (mode == Mode::Full) >- info.classList.append("hovering"); >- m_scrollbar = RenderThemeGadget::create(info); >- >- Vector<RenderThemeGadget::Info> children; >- auto steppers = static_cast<RenderThemeScrollbarGadget*>(m_scrollbar.get())->steppers(); >- if (steppers.contains(RenderThemeScrollbarGadget::Steppers::Backward)) { >- m_steppersPosition[0] = children.size(); >- children.append({ RenderThemeGadget::Type::Generic, "button", { "up" } }); >- } >- if (steppers.contains(RenderThemeScrollbarGadget::Steppers::SecondaryForward)) { >- m_steppersPosition[1] = children.size(); >- children.append({ RenderThemeGadget::Type::Generic, "button", { "down" } }); >- } >- m_troughPosition = children.size(); >- children.append({ RenderThemeGadget::Type::Generic, "trough", { } }); >- if (steppers.contains(RenderThemeScrollbarGadget::Steppers::SecondaryBackward)) { >- m_steppersPosition[2] = children.size(); >- children.append({ RenderThemeGadget::Type::Generic, "button", { "up" } }); >- } >- if (steppers.contains(RenderThemeScrollbarGadget::Steppers::Forward)) { >- m_steppersPosition[3] = children.size(); >- children.append({ RenderThemeGadget::Type::Generic, "button", { "down" } }); >- } >- info.type = RenderThemeGadget::Type::Generic; >- info.name = "contents"; >- info.classList.clear(); >- m_contents = makeUnique<RenderThemeBoxGadget>(info, GTK_ORIENTATION_VERTICAL, children, m_scrollbar.get()); >- info.name = "slider"; >- m_slider = RenderThemeGadget::create(info, m_contents->child(m_troughPosition)); >-} >- >-RenderThemeGadget* RenderThemeScrollbar::stepper(RenderThemeScrollbarGadget::Steppers scrollbarStepper) >-{ >- if (!static_cast<RenderThemeScrollbarGadget*>(m_scrollbar.get())->steppers().contains(scrollbarStepper)) >- return nullptr; >- >- switch (scrollbarStepper) { >- case RenderThemeScrollbarGadget::Steppers::Backward: >- return m_contents->child(m_steppersPosition[0]); >- case RenderThemeScrollbarGadget::Steppers::SecondaryForward: >- return m_contents->child(m_steppersPosition[1]); >- case RenderThemeScrollbarGadget::Steppers::SecondaryBackward: >- return m_contents->child(m_steppersPosition[2]); >- case RenderThemeScrollbarGadget::Steppers::Forward: >- return m_contents->child(m_steppersPosition[3]); >- default: >- break; >- } >- >- return nullptr; >-} >- >-RenderThemeToggleButton::RenderThemeToggleButton(Type toggleType) >-{ >- RenderThemeGadget::Info info = { RenderThemeGadget::Type::Generic, toggleType == Type::Check ? "checkbutton" : "radiobutton", { "text-button" } }; >- m_button = RenderThemeGadget::create(info); >- if (toggleType == Type::Check) { >- info.type = RenderThemeGadget::Type::Check; >- info.name = "check"; >- } else { >- info.type = RenderThemeGadget::Type::Radio; >- info.name = "radio"; >- } >- info.classList.clear(); >- m_toggle = RenderThemeGadget::create(info, m_button.get()); >-} >- >-RenderThemeButton::RenderThemeButton(Default isDefault) >-{ >- RenderThemeGadget::Info info = { RenderThemeGadget::Type::Button, "button", { "text-button" } }; >- if (isDefault == Default::Yes) >- info.classList.append("default"); >- m_button = RenderThemeGadget::create(info); >-} >- >-RenderThemeComboBox::RenderThemeComboBox() >-{ >- RenderThemeGadget::Info info = { RenderThemeGadget::Type::Generic, "combobox", { } }; >- m_comboBox = RenderThemeGadget::create(info); >- Vector<RenderThemeGadget::Info> children = { >- { RenderThemeGadget::Type::Generic, "button", { "combo" } } >- }; >- info.name = "box"; >- info.classList = { "horizontal", "linked" }; >- m_box = makeUnique<RenderThemeBoxGadget>(info, GTK_ORIENTATION_HORIZONTAL, children, m_comboBox.get()); >- RenderThemeGadget* button = m_box->child(0); >- info.classList.removeLast(); >- m_buttonBox = RenderThemeGadget::create(info, button); >- info.type = RenderThemeGadget::Type::Arrow; >- info.name = "arrow"; >- info.classList = { }; >- m_arrow = RenderThemeGadget::create(info, m_buttonBox.get()); >-} >- >-RenderThemeEntry::RenderThemeEntry(Selected isSelected) >-{ >- RenderThemeGadget::Info info = { RenderThemeGadget::Type::TextField, "entry", { } }; >- m_entry = RenderThemeGadget::create(info); >- if (isSelected == Selected::Yes) { >- info.type = RenderThemeGadget::Type::Generic; >- info.name = "selection"; >- m_selection = RenderThemeGadget::create(info, m_entry.get()); >- } >-} >- >-RenderThemeSearchEntry::RenderThemeSearchEntry() >-{ >- RenderThemeGadget::Info info = { RenderThemeGadget::Type::Icon, "image", { "left" } }; >- m_leftIcon = RenderThemeGadget::create(info, m_entry.get()); >- static_cast<RenderThemeIconGadget*>(m_leftIcon.get())->setIconName("edit-find-symbolic"); >- info.classList.clear(); >- info.classList.append("right"); >- m_rightIcon = RenderThemeGadget::create(info, m_entry.get()); >- static_cast<RenderThemeIconGadget*>(m_rightIcon.get())->setIconName("edit-clear-symbolic"); >-} >- >-RenderThemeSpinButton::RenderThemeSpinButton() >-{ >- RenderThemeGadget::Info info = { RenderThemeGadget::Type::Generic, "spinbutton", { "horizontal" } }; >- m_spinButton = RenderThemeGadget::create(info); >- info.type = RenderThemeGadget::Type::TextField; >- info.name = "entry"; >- info.classList.clear(); >- m_entry = RenderThemeGadget::create(info, m_spinButton.get()); >- info.type = RenderThemeGadget::Type::Icon; >- info.name = "button"; >- info.classList.append("up"); >- m_up = RenderThemeGadget::create(info, m_spinButton.get()); >- auto* upIcon = static_cast<RenderThemeIconGadget*>(m_up.get()); >- upIcon->setIconSize(RenderThemeIconGadget::IconSizeGtk::Menu); >- upIcon->setIconName("list-add-symbolic"); >- info.classList[0] = "down"; >- m_down = RenderThemeGadget::create(info, m_spinButton.get()); >- auto* downIcon = static_cast<RenderThemeIconGadget*>(m_down.get()); >- downIcon->setIconSize(RenderThemeIconGadget::IconSizeGtk::Menu); >- downIcon->setIconName("list-remove-symbolic"); >-} >- >-RenderThemeSlider::RenderThemeSlider(GtkOrientation orientation) >-{ >- RenderThemeGadget::Info info = { RenderThemeGadget::Type::Generic, "scale", { } }; >- if (orientation == GTK_ORIENTATION_VERTICAL) >- info.classList.append("vertical"); >- else >- info.classList.append("horizontal"); >- m_scale = RenderThemeGadget::create(info); >- info.name = "contents"; >- info.classList.clear(); >- m_contents = RenderThemeGadget::create(info, m_scale.get()); >- info.name = "trough"; >- m_trough = RenderThemeGadget::create(info, m_contents.get()); >- info.name = "slider"; >- m_slider = RenderThemeGadget::create(info, m_trough.get()); >- info.name = "highlight"; >- m_highlight = RenderThemeGadget::create(info, m_trough.get()); >-} >- >-RenderThemeProgressBar::RenderThemeProgressBar(Mode mode) >-{ >- RenderThemeGadget::Info info = { RenderThemeGadget::Type::Generic, "progressbar", { "horizontal" } }; >- m_progressBar = RenderThemeGadget::create(info); >- info.name = "trough"; >- info.classList.clear(); >- m_trough = RenderThemeGadget::create(info, m_progressBar.get()); >- info.name = "progress"; >- if (mode == Mode::Determinate) >- info.classList.append("pulse"); >- m_progress = RenderThemeGadget::create(info, m_trough.get()); >-} >- >-RenderThemeListView::RenderThemeListView() >- : m_treeview(RenderThemeGadget::create({ RenderThemeGadget::Type::Generic, "treeview", { "view" } })) >-{ >-} >- >-RenderThemeIcon::RenderThemeIcon() >- : m_icon(RenderThemeGadget::create({ RenderThemeGadget::Type::Icon, "image", { } })) >-{ >-} >- >-RenderThemeWindow::RenderThemeWindow() >- : m_window(RenderThemeGadget::create({ RenderThemeGadget::Type::Generic, "window", { "background" } })) >-{ >-} >- >-} // namepsace WebCore >diff --git a/Source/WebCore/platform/gtk/RenderThemeWidget.h b/Source/WebCore/platform/gtk/RenderThemeWidget.h >deleted file mode 100644 >index 433e0048f1e..00000000000 >--- a/Source/WebCore/platform/gtk/RenderThemeWidget.h >+++ /dev/null >@@ -1,247 +0,0 @@ >-/* >- * Copyright (C) 2017 Igalia S.L. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#pragma once >- >-#include <gtk/gtk.h> >- >-#include "RenderThemeGadget.h" >- >-namespace WebCore { >- >-class RenderThemeWidget { >- WTF_MAKE_FAST_ALLOCATED; >- WTF_MAKE_NONCOPYABLE(RenderThemeWidget); >-public: >- enum class Type { >- VerticalScrollbarRight = 1, >- VerticalScrollbarLeft, >- HorizontalScrollbar, >- VerticalScrollIndicatorRight, >- VerticalScrollIndicatorLeft, >- HorizontalScrollIndicator, >- CheckButton, >- RadioButton, >- Button, >- ButtonDefault, >- ComboBox, >- Entry, >- SelectedEntry, >- SearchEntry, >- SpinButton, >- VerticalSlider, >- HorizontalSlider, >- ProgressBar, >- IndeterminateProgressBar, >- ListView, >- Icon, >- Window, >- }; >- static RenderThemeWidget& getOrCreate(Type); >- static void clearCache(); >- >- RenderThemeWidget() = default; >- virtual ~RenderThemeWidget(); >-}; >- >-class RenderThemeScrollbar final : public RenderThemeWidget { >-public: >- enum class Mode { Full, Indicator }; >- enum class VerticalPosition { Right, Left }; >- RenderThemeScrollbar(GtkOrientation, Mode, VerticalPosition = VerticalPosition::Right); >- ~RenderThemeScrollbar() = default; >- >- RenderThemeGadget& scrollbar() const { return *m_scrollbar; } >- RenderThemeGadget& contents() const { return *m_contents; } >- RenderThemeGadget& slider() const { return *m_slider; } >- RenderThemeGadget& trough() const { return *m_contents->child(m_troughPosition); } >- RenderThemeGadget* stepper(RenderThemeScrollbarGadget::Steppers); >- >-private: >- std::unique_ptr<RenderThemeGadget> m_scrollbar; >- std::unique_ptr<RenderThemeBoxGadget> m_contents; >- std::unique_ptr<RenderThemeGadget> m_slider; >- unsigned m_troughPosition; >- unsigned m_steppersPosition[4]; >-}; >- >-class RenderThemeToggleButton final : public RenderThemeWidget { >-public: >- enum class Type { Check, Radio }; >- explicit RenderThemeToggleButton(Type); >- ~RenderThemeToggleButton() = default; >- >- RenderThemeGadget& button() const { return *m_button; } >- RenderThemeGadget& toggle() const { return *m_toggle; } >- >-private: >- std::unique_ptr<RenderThemeGadget> m_button; >- std::unique_ptr<RenderThemeGadget> m_toggle; >-}; >- >-class RenderThemeButton final : public RenderThemeWidget { >-public: >- enum class Default { No, Yes }; >- explicit RenderThemeButton(Default); >- ~RenderThemeButton() = default; >- >- RenderThemeGadget& button() const { return *m_button; } >- >-private: >- std::unique_ptr<RenderThemeGadget> m_button; >-}; >- >-class RenderThemeComboBox final : public RenderThemeWidget { >-public: >- RenderThemeComboBox(); >- ~RenderThemeComboBox() = default; >- >- RenderThemeGadget& comboBox() const { return *m_comboBox; } >- RenderThemeGadget& box() const { return *m_box; } >- RenderThemeGadget& button() const { return *m_box->child(0); } >- RenderThemeGadget& buttonBox() const { return *m_buttonBox; } >- RenderThemeGadget& arrow() const { return *m_arrow; } >- >-private: >- std::unique_ptr<RenderThemeGadget> m_comboBox; >- std::unique_ptr<RenderThemeBoxGadget> m_box; >- std::unique_ptr<RenderThemeGadget> m_buttonBox; >- std::unique_ptr<RenderThemeGadget> m_arrow; >-}; >- >-class RenderThemeEntry : public RenderThemeWidget { >-public: >- enum class Selected { No, Yes }; >- explicit RenderThemeEntry(Selected = Selected::No); >- ~RenderThemeEntry() = default; >- >- RenderThemeGadget& entry() const { return *m_entry; } >- RenderThemeGadget* selection() const { return m_selection.get(); } >- >-protected: >- std::unique_ptr<RenderThemeGadget> m_entry; >- std::unique_ptr<RenderThemeGadget> m_selection; >-}; >- >-class RenderThemeSearchEntry final : public RenderThemeEntry { >-public: >- RenderThemeSearchEntry(); >- ~RenderThemeSearchEntry() = default; >- >- RenderThemeGadget& leftIcon() const { return *m_leftIcon; } >- RenderThemeGadget& rightIcon() const { return *m_rightIcon; } >- >-private: >- std::unique_ptr<RenderThemeGadget> m_leftIcon; >- std::unique_ptr<RenderThemeGadget> m_rightIcon; >-}; >- >-class RenderThemeSpinButton final : public RenderThemeWidget { >-public: >- RenderThemeSpinButton(); >- ~RenderThemeSpinButton() = default; >- >- RenderThemeGadget& spinButton() const { return *m_spinButton; } >- RenderThemeGadget& entry() const { return *m_entry; } >- RenderThemeGadget& up() const { return *m_up; } >- RenderThemeGadget& down() const { return *m_down; } >- >-private: >- std::unique_ptr<RenderThemeGadget> m_spinButton; >- std::unique_ptr<RenderThemeGadget> m_entry; >- std::unique_ptr<RenderThemeGadget> m_up; >- std::unique_ptr<RenderThemeGadget> m_down; >-}; >- >-class RenderThemeSlider final : public RenderThemeWidget { >-public: >- explicit RenderThemeSlider(GtkOrientation); >- ~RenderThemeSlider() = default; >- >- RenderThemeGadget& scale() const { return *m_scale; } >- RenderThemeGadget& contents() const { return *m_contents; } >- RenderThemeGadget& trough() const { return *m_trough; } >- RenderThemeGadget& slider() const { return *m_slider; } >- RenderThemeGadget& highlight() const { return *m_highlight; } >- >-private: >- std::unique_ptr<RenderThemeGadget> m_scale; >- std::unique_ptr<RenderThemeGadget> m_contents; >- std::unique_ptr<RenderThemeGadget> m_trough; >- std::unique_ptr<RenderThemeGadget> m_slider; >- std::unique_ptr<RenderThemeGadget> m_highlight; >-}; >- >-class RenderThemeProgressBar final : public RenderThemeWidget { >-public: >- enum class Mode { Determinate, Indeterminate }; >- explicit RenderThemeProgressBar(Mode); >- ~RenderThemeProgressBar() = default; >- >- RenderThemeGadget& progressBar() const { return *m_progressBar; } >- RenderThemeGadget& trough() const { return *m_trough; } >- RenderThemeGadget& progress() const { return *m_progress; } >- >-private: >- std::unique_ptr<RenderThemeGadget> m_progressBar; >- std::unique_ptr<RenderThemeGadget> m_trough; >- std::unique_ptr<RenderThemeGadget> m_progress; >-}; >- >-class RenderThemeListView final : public RenderThemeWidget { >-public: >- RenderThemeListView(); >- ~RenderThemeListView() = default; >- >- RenderThemeGadget& treeview() const { return *m_treeview; } >- >-private: >- std::unique_ptr<RenderThemeGadget> m_treeview; >-}; >- >-class RenderThemeIcon final : public RenderThemeWidget { >-public: >- RenderThemeIcon(); >- ~RenderThemeIcon() = default; >- >- RenderThemeGadget& icon() const { return *m_icon; } >- >-private: >- std::unique_ptr<RenderThemeGadget> m_icon; >-}; >- >-class RenderThemeWindow final : public RenderThemeWidget { >-public: >- RenderThemeWindow(); >- ~RenderThemeWindow() = default; >- >- RenderThemeGadget& window() const { return *m_window; } >- >-private: >- std::unique_ptr<RenderThemeGadget> m_window; >- >-}; >- >-} // namespace WebCore >diff --git a/Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp b/Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp >deleted file mode 100644 >index 408b1b9f579..00000000000 >--- a/Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp >+++ /dev/null >@@ -1,517 +0,0 @@ >-/* >- * Copyright (C) 2016 Igalia S.L. >- * Copyright (C) 2008 Apple Inc. All Rights Reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#include "config.h" >-#include "ScrollbarThemeGtk.h" >- >-#include "GRefPtrGtk.h" >-#include "PlatformContextCairo.h" >-#include "PlatformMouseEvent.h" >-#include "RenderThemeWidget.h" >-#include "ScrollView.h" >-#include "Scrollbar.h" >-#include <cstdlib> >-#include <gtk/gtk.h> >- >-namespace WebCore { >- >-ScrollbarTheme& ScrollbarTheme::nativeTheme() >-{ >- static ScrollbarThemeGtk theme; >- return theme; >-} >- >-ScrollbarThemeGtk::~ScrollbarThemeGtk() = default; >- >-static void themeChangedCallback() >-{ >- ScrollbarTheme::theme().themeChanged(); >-} >- >-ScrollbarThemeGtk::ScrollbarThemeGtk() >-{ >- m_usesOverlayScrollbars = g_strcmp0(g_getenv("GTK_OVERLAY_SCROLLING"), "0"); >- >- static bool themeMonitorInitialized = false; >- if (!themeMonitorInitialized) { >- g_signal_connect(gtk_settings_get_default(), "notify::gtk-theme-name", G_CALLBACK(themeChangedCallback), nullptr); >- themeMonitorInitialized = true; >- updateThemeProperties(); >- } >-} >- >-void ScrollbarThemeGtk::themeChanged() >-{ >- RenderThemeWidget::clearCache(); >- updateThemeProperties(); >-} >- >-void ScrollbarThemeGtk::updateThemeProperties() >-{ >- auto& scrollbar = static_cast<RenderThemeScrollbar&>(RenderThemeWidget::getOrCreate(RenderThemeWidget::Type::VerticalScrollbarRight)); >- m_hasBackButtonStartPart = scrollbar.stepper(RenderThemeScrollbarGadget::Steppers::Backward); >- m_hasForwardButtonEndPart = scrollbar.stepper(RenderThemeScrollbarGadget::Steppers::Forward); >- m_hasBackButtonEndPart = scrollbar.stepper(RenderThemeScrollbarGadget::Steppers::SecondaryBackward); >- m_hasForwardButtonStartPart = scrollbar.stepper(RenderThemeScrollbarGadget::Steppers::SecondaryForward); >-} >- >-bool ScrollbarThemeGtk::hasButtons(Scrollbar& scrollbar) >-{ >- return scrollbar.enabled() && (m_hasBackButtonStartPart || m_hasForwardButtonEndPart || m_hasBackButtonEndPart || m_hasForwardButtonStartPart); >-} >- >-static GtkStateFlags scrollbarPartStateFlags(Scrollbar& scrollbar, ScrollbarPart part, bool painting = false) >-{ >- unsigned stateFlags = 0; >- switch (part) { >- case AllParts: >- if (!painting || scrollbar.hoveredPart() != NoPart) >- stateFlags |= GTK_STATE_FLAG_PRELIGHT; >- break; >- case BackTrackPart: >- case ForwardTrackPart: >- if (scrollbar.hoveredPart() == BackTrackPart || scrollbar.hoveredPart() == ForwardTrackPart) >- stateFlags |= GTK_STATE_FLAG_PRELIGHT; >- if (scrollbar.pressedPart() == BackTrackPart || scrollbar.pressedPart() == ForwardTrackPart) >- stateFlags |= GTK_STATE_FLAG_ACTIVE; >- break; >- case BackButtonStartPart: >- case ForwardButtonStartPart: >- case BackButtonEndPart: >- case ForwardButtonEndPart: >- if (((part == BackButtonStartPart || part == BackButtonEndPart) && !scrollbar.currentPos()) >- || ((part == ForwardButtonEndPart || part == ForwardButtonStartPart) && scrollbar.currentPos() == scrollbar.maximum())) { >- stateFlags |= GTK_STATE_FLAG_INSENSITIVE; >- break; >- } >- FALLTHROUGH; >- default: >- if (scrollbar.hoveredPart() == part) >- stateFlags |= GTK_STATE_FLAG_PRELIGHT; >- >- if (scrollbar.pressedPart() == part) >- stateFlags |= GTK_STATE_FLAG_ACTIVE; >- break; >- } >- >- return static_cast<GtkStateFlags>(stateFlags); >-} >- >-static RenderThemeWidget::Type widgetTypeForScrollbar(Scrollbar& scrollbar, GtkStateFlags scrollbarState) >-{ >- if (scrollbar.orientation() == VerticalScrollbar) { >- if (scrollbar.scrollableArea().shouldPlaceBlockDirectionScrollbarOnLeft()) >- return scrollbarState & GTK_STATE_FLAG_PRELIGHT ? RenderThemeWidget::Type::VerticalScrollbarLeft : RenderThemeWidget::Type::VerticalScrollIndicatorLeft; >- return scrollbarState & GTK_STATE_FLAG_PRELIGHT ? RenderThemeWidget::Type::VerticalScrollbarRight : RenderThemeWidget::Type::VerticalScrollIndicatorRight; >- } >- return scrollbarState & GTK_STATE_FLAG_PRELIGHT ? RenderThemeWidget::Type::HorizontalScrollbar : RenderThemeWidget::Type::HorizontalScrollIndicator; >-} >- >-static IntRect contentsRectangle(Scrollbar& scrollbar, RenderThemeScrollbar& scrollbarWidget) >-{ >- GtkBorder scrollbarContentsBox = scrollbarWidget.scrollbar().contentsBox(); >- GtkBorder contentsContentsBox = scrollbarWidget.contents().contentsBox(); >- GtkBorder padding; >- padding.left = scrollbarContentsBox.left + contentsContentsBox.left; >- padding.right = scrollbarContentsBox.right + contentsContentsBox.right; >- padding.top = scrollbarContentsBox.top + contentsContentsBox.top; >- padding.bottom = scrollbarContentsBox.bottom + contentsContentsBox.bottom; >- IntRect contentsRect = scrollbar.frameRect(); >- contentsRect.move(padding.left, padding.top); >- contentsRect.contract(padding.left + padding.right, padding.top + padding.bottom); >- return contentsRect; >-} >- >-IntRect ScrollbarThemeGtk::trackRect(Scrollbar& scrollbar, bool /*painting*/) >-{ >- auto scrollbarState = scrollbarPartStateFlags(scrollbar, AllParts); >- auto& scrollbarWidget = static_cast<RenderThemeScrollbar&>(RenderThemeWidget::getOrCreate(widgetTypeForScrollbar(scrollbar, scrollbarState))); >- scrollbarWidget.scrollbar().setState(scrollbarState); >- >- IntRect rect = contentsRectangle(scrollbar, scrollbarWidget); >- if (auto* backwardStepper = scrollbarWidget.stepper(RenderThemeScrollbarGadget::Steppers::Backward)) { >- backwardStepper->setState(scrollbarPartStateFlags(scrollbar, BackButtonStartPart)); >- IntSize stepperSize = backwardStepper->preferredSize(); >- if (scrollbar.orientation() == VerticalScrollbar) { >- rect.move(0, stepperSize.height()); >- rect.contract(0, stepperSize.height()); >- } else { >- rect.move(stepperSize.width(), 0); >- rect.contract(stepperSize.width(), 0); >- } >- } >- if (auto* secondaryForwardStepper = scrollbarWidget.stepper(RenderThemeScrollbarGadget::Steppers::SecondaryForward)) { >- secondaryForwardStepper->setState(scrollbarPartStateFlags(scrollbar, ForwardButtonStartPart)); >- IntSize stepperSize = secondaryForwardStepper->preferredSize(); >- if (scrollbar.orientation() == VerticalScrollbar) { >- rect.move(0, stepperSize.height()); >- rect.contract(0, stepperSize.height()); >- } else { >- rect.move(stepperSize.width(), 0); >- rect.contract(stepperSize.width(), 0); >- } >- } >- if (auto* secondaryBackwardStepper = scrollbarWidget.stepper(RenderThemeScrollbarGadget::Steppers::SecondaryBackward)) { >- secondaryBackwardStepper->setState(scrollbarPartStateFlags(scrollbar, BackButtonEndPart)); >- if (scrollbar.orientation() == VerticalScrollbar) >- rect.contract(0, secondaryBackwardStepper->preferredSize().height()); >- else >- rect.contract(secondaryBackwardStepper->preferredSize().width(), 0); >- } >- if (auto* forwardStepper = scrollbarWidget.stepper(RenderThemeScrollbarGadget::Steppers::Forward)) { >- forwardStepper->setState(scrollbarPartStateFlags(scrollbar, ForwardButtonEndPart)); >- if (scrollbar.orientation() == VerticalScrollbar) >- rect.contract(0, forwardStepper->preferredSize().height()); >- else >- rect.contract(forwardStepper->preferredSize().width(), 0); >- } >- >- if (scrollbar.orientation() == VerticalScrollbar) >- return scrollbar.height() < rect.height() ? IntRect() : rect; >- >- return scrollbar.width() < rect.width() ? IntRect() : rect; >-} >- >-bool ScrollbarThemeGtk::hasThumb(Scrollbar& scrollbar) >-{ >- // This method is just called as a paint-time optimization to see if >- // painting the thumb can be skipped. We don't have to be exact here. >- return thumbLength(scrollbar) > 0; >-} >- >-IntRect ScrollbarThemeGtk::backButtonRect(Scrollbar& scrollbar, ScrollbarPart part, bool /*painting*/) >-{ >- ASSERT(part == BackButtonStartPart || part == BackButtonEndPart); >- if ((part == BackButtonEndPart && !m_hasBackButtonEndPart) || (part == BackButtonStartPart && !m_hasBackButtonStartPart)) >- return IntRect(); >- >- auto scrollbarState = scrollbarPartStateFlags(scrollbar, AllParts); >- auto& scrollbarWidget = static_cast<RenderThemeScrollbar&>(RenderThemeWidget::getOrCreate(widgetTypeForScrollbar(scrollbar, scrollbarState))); >- scrollbarWidget.scrollbar().setState(scrollbarState); >- >- IntRect rect = contentsRectangle(scrollbar, scrollbarWidget); >- if (part == BackButtonStartPart) { >- auto* backwardStepper = scrollbarWidget.stepper(RenderThemeScrollbarGadget::Steppers::Backward); >- ASSERT(backwardStepper); >- backwardStepper->setState(scrollbarPartStateFlags(scrollbar, BackButtonStartPart)); >- return IntRect(rect.location(), backwardStepper->preferredSize()); >- } >- >- if (auto* secondaryForwardStepper = scrollbarWidget.stepper(RenderThemeScrollbarGadget::Steppers::SecondaryForward)) { >- secondaryForwardStepper->setState(scrollbarPartStateFlags(scrollbar, ForwardButtonStartPart)); >- IntSize preferredSize = secondaryForwardStepper->preferredSize(); >- if (scrollbar.orientation() == VerticalScrollbar) { >- rect.move(0, preferredSize.height()); >- rect.contract(0, preferredSize.height()); >- } else { >- rect.move(preferredSize.width(), 0); >- rect.contract(0, preferredSize.width()); >- } >- } >- >- if (auto* secondaryBackwardStepper = scrollbarWidget.stepper(RenderThemeScrollbarGadget::Steppers::SecondaryBackward)) { >- secondaryBackwardStepper->setState(scrollbarPartStateFlags(scrollbar, BackButtonEndPart)); >- if (scrollbar.orientation() == VerticalScrollbar) >- rect.contract(0, secondaryBackwardStepper->preferredSize().height()); >- else >- rect.contract(secondaryBackwardStepper->preferredSize().width(), 0); >- } >- >- auto* forwardStepper = scrollbarWidget.stepper(RenderThemeScrollbarGadget::Steppers::Forward); >- ASSERT(forwardStepper); >- forwardStepper->setState(scrollbarPartStateFlags(scrollbar, ForwardButtonEndPart)); >- IntSize preferredSize = forwardStepper->preferredSize(); >- if (scrollbar.orientation() == VerticalScrollbar) >- rect.move(0, rect.height() - preferredSize.height()); >- else >- rect.move(rect.width() - preferredSize.width(), 0); >- >- return IntRect(rect.location(), preferredSize); >-} >- >-IntRect ScrollbarThemeGtk::forwardButtonRect(Scrollbar& scrollbar, ScrollbarPart part, bool /*painting*/) >-{ >- ASSERT(part == ForwardButtonStartPart || part == ForwardButtonEndPart); >- if ((part == ForwardButtonStartPart && !m_hasForwardButtonStartPart) || (part == ForwardButtonEndPart && !m_hasForwardButtonEndPart)) >- return IntRect(); >- >- auto scrollbarState = scrollbarPartStateFlags(scrollbar, AllParts); >- auto& scrollbarWidget = static_cast<RenderThemeScrollbar&>(RenderThemeWidget::getOrCreate(widgetTypeForScrollbar(scrollbar, scrollbarState))); >- scrollbarWidget.scrollbar().setState(scrollbarState); >- >- IntRect rect = contentsRectangle(scrollbar, scrollbarWidget); >- if (auto* backwardStepper = scrollbarWidget.stepper(RenderThemeScrollbarGadget::Steppers::Backward)) { >- backwardStepper->setState(scrollbarPartStateFlags(scrollbar, BackButtonStartPart)); >- IntSize preferredSize = backwardStepper->preferredSize(); >- if (scrollbar.orientation() == VerticalScrollbar) { >- rect.move(0, preferredSize.height()); >- rect.contract(0, preferredSize.height()); >- } else { >- rect.move(preferredSize.width(), 0); >- rect.contract(preferredSize.width(), 0); >- } >- } >- >- if (auto* secondaryForwardStepper = scrollbarWidget.stepper(RenderThemeScrollbarGadget::Steppers::SecondaryForward)) { >- secondaryForwardStepper->setState(scrollbarPartStateFlags(scrollbar, ForwardButtonStartPart)); >- IntSize preferredSize = secondaryForwardStepper->preferredSize(); >- if (part == ForwardButtonStartPart) >- return IntRect(rect.location(), preferredSize); >- >- if (scrollbar.orientation() == VerticalScrollbar) { >- rect.move(0, preferredSize.height()); >- rect.contract(0, preferredSize.height()); >- } else { >- rect.move(preferredSize.width(), 0); >- rect.contract(preferredSize.width(), 0); >- } >- } >- >- auto* forwardStepper = scrollbarWidget.stepper(RenderThemeScrollbarGadget::Steppers::Forward); >- ASSERT(forwardStepper); >- forwardStepper->setState(scrollbarPartStateFlags(scrollbar, ForwardButtonEndPart)); >- IntSize preferredSize = forwardStepper->preferredSize(); >- if (scrollbar.orientation() == VerticalScrollbar) >- rect.move(0, rect.height() - preferredSize.height()); >- else >- rect.move(rect.width() - preferredSize.width(), 0); >- >- return IntRect(rect.location(), preferredSize); >-} >- >-bool ScrollbarThemeGtk::paint(Scrollbar& scrollbar, GraphicsContext& graphicsContext, const IntRect& damageRect) >-{ >- if (graphicsContext.paintingDisabled()) >- return false; >- >- if (!scrollbar.enabled()) >- return true; >- >- double opacity = scrollbar.hoveredPart() == NoPart ? scrollbar.opacity() : 1; >- if (!opacity) >- return true; >- >- IntRect rect = scrollbar.frameRect(); >- if (!rect.intersects(damageRect)) >- return true; >- >- auto scrollbarState = scrollbarPartStateFlags(scrollbar, AllParts, true); >- auto& scrollbarWidget = static_cast<RenderThemeScrollbar&>(RenderThemeWidget::getOrCreate(widgetTypeForScrollbar(scrollbar, scrollbarState))); >- auto& scrollbarGadget = scrollbarWidget.scrollbar(); >- scrollbarGadget.setState(scrollbarState); >- if (m_usesOverlayScrollbars) >- opacity *= scrollbarGadget.opacity(); >- if (!opacity) >- return true; >- >- auto& trough = scrollbarWidget.trough(); >- trough.setState(scrollbarPartStateFlags(scrollbar, BackTrackPart)); >- >- auto* backwardStepper = scrollbarWidget.stepper(RenderThemeScrollbarGadget::Steppers::Backward); >- if (backwardStepper) >- backwardStepper->setState(scrollbarPartStateFlags(scrollbar, BackButtonStartPart)); >- auto* secondaryForwardStepper = scrollbarWidget.stepper(RenderThemeScrollbarGadget::Steppers::SecondaryForward); >- if (secondaryForwardStepper) >- secondaryForwardStepper->setState(scrollbarPartStateFlags(scrollbar, ForwardButtonStartPart)); >- auto* secondaryBackwardStepper = scrollbarWidget.stepper(RenderThemeScrollbarGadget::Steppers::SecondaryBackward); >- if (secondaryBackwardStepper) >- secondaryBackwardStepper->setState(scrollbarPartStateFlags(scrollbar, BackButtonEndPart)); >- auto* forwardStepper = scrollbarWidget.stepper(RenderThemeScrollbarGadget::Steppers::Forward); >- if (forwardStepper) >- forwardStepper->setState(scrollbarPartStateFlags(scrollbar, ForwardButtonEndPart)); >- >- IntSize preferredSize = scrollbarWidget.contents().preferredSize(); >- int thumbSize = thumbLength(scrollbar); >- if (thumbSize) { >- scrollbarWidget.slider().setState(scrollbarPartStateFlags(scrollbar, ThumbPart)); >- preferredSize = preferredSize.expandedTo(scrollbarWidget.slider().preferredSize()); >- } >- preferredSize += scrollbarGadget.preferredSize() - scrollbarGadget.minimumSize(); >- >- FloatRect contentsRect(rect); >- // When using overlay scrollbars we always claim the size of the scrollbar when hovered, so when >- // drawing the indicator we need to adjust the rectangle to its actual size in indicator mode. >- if (scrollbar.orientation() == VerticalScrollbar) { >- if (rect.width() != preferredSize.width()) { >- if (!scrollbar.scrollableArea().shouldPlaceBlockDirectionScrollbarOnLeft()) >- contentsRect.move(std::abs(rect.width() - preferredSize.width()), 0); >- contentsRect.setWidth(preferredSize.width()); >- } >- } else { >- if (rect.height() != preferredSize.height()) { >- contentsRect.move(0, std::abs(rect.height() - preferredSize.height())); >- contentsRect.setHeight(preferredSize.height()); >- } >- } >- >- if (opacity != 1) { >- graphicsContext.save(); >- graphicsContext.clip(damageRect); >- graphicsContext.beginTransparencyLayer(opacity); >- } >- >- scrollbarGadget.render(graphicsContext.platformContext()->cr(), contentsRect, &contentsRect); >- scrollbarWidget.contents().render(graphicsContext.platformContext()->cr(), contentsRect, &contentsRect); >- >- if (backwardStepper) { >- FloatRect buttonRect = contentsRect; >- if (scrollbar.orientation() == VerticalScrollbar) >- buttonRect.setHeight(backwardStepper->preferredSize().height()); >- else >- buttonRect.setWidth(backwardStepper->preferredSize().width()); >- static_cast<RenderThemeScrollbarGadget&>(scrollbarGadget).renderStepper(graphicsContext.platformContext()->cr(), buttonRect, backwardStepper, >- scrollbar.orientation() == VerticalScrollbar ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL, RenderThemeScrollbarGadget::Steppers::Backward); >- if (scrollbar.orientation() == VerticalScrollbar) { >- contentsRect.move(0, buttonRect.height()); >- contentsRect.contract(0, buttonRect.height()); >- } else { >- contentsRect.move(buttonRect.width(), 0); >- contentsRect.contract(buttonRect.width(), 0); >- } >- } >- if (secondaryForwardStepper) { >- FloatRect buttonRect = contentsRect; >- if (scrollbar.orientation() == VerticalScrollbar) >- buttonRect.setHeight(secondaryForwardStepper->preferredSize().height()); >- else >- buttonRect.setWidth(secondaryForwardStepper->preferredSize().width()); >- static_cast<RenderThemeScrollbarGadget&>(scrollbarGadget).renderStepper(graphicsContext.platformContext()->cr(), buttonRect, secondaryForwardStepper, >- scrollbar.orientation() == VerticalScrollbar ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL, RenderThemeScrollbarGadget::Steppers::SecondaryForward); >- if (scrollbar.orientation() == VerticalScrollbar) { >- contentsRect.move(0, buttonRect.height()); >- contentsRect.contract(0, buttonRect.height()); >- } else { >- contentsRect.move(buttonRect.width(), 0); >- contentsRect.contract(buttonRect.width(), 0); >- } >- } >- if (secondaryBackwardStepper) { >- FloatRect buttonRect = contentsRect; >- if (scrollbar.orientation() == VerticalScrollbar) { >- buttonRect.setHeight(secondaryBackwardStepper->preferredSize().height()); >- buttonRect.move(0, contentsRect.height() - buttonRect.height()); >- } else { >- buttonRect.setWidth(secondaryBackwardStepper->preferredSize().width()); >- buttonRect.move(contentsRect.width() - buttonRect.width(), 0); >- } >- static_cast<RenderThemeScrollbarGadget&>(scrollbarGadget).renderStepper(graphicsContext.platformContext()->cr(), buttonRect, secondaryBackwardStepper, >- scrollbar.orientation() == VerticalScrollbar ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL, RenderThemeScrollbarGadget::Steppers::SecondaryBackward); >- if (scrollbar.orientation() == VerticalScrollbar) >- contentsRect.contract(0, buttonRect.height()); >- else >- contentsRect.contract(buttonRect.width(), 0); >- } >- if (forwardStepper) { >- FloatRect buttonRect = contentsRect; >- if (scrollbar.orientation() == VerticalScrollbar) { >- buttonRect.setHeight(forwardStepper->preferredSize().height()); >- buttonRect.move(0, contentsRect.height() - buttonRect.height()); >- } else { >- buttonRect.setWidth(forwardStepper->preferredSize().width()); >- buttonRect.move(contentsRect.width() - buttonRect.width(), 0); >- } >- static_cast<RenderThemeScrollbarGadget&>(scrollbarGadget).renderStepper(graphicsContext.platformContext()->cr(), buttonRect, forwardStepper, >- scrollbar.orientation() == VerticalScrollbar ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL, RenderThemeScrollbarGadget::Steppers::Forward); >- if (scrollbar.orientation() == VerticalScrollbar) >- contentsRect.contract(0, buttonRect.height()); >- else >- contentsRect.contract(buttonRect.width(), 0); >- } >- >- trough.render(graphicsContext.platformContext()->cr(), contentsRect, &contentsRect); >- >- if (thumbSize) { >- if (scrollbar.orientation() == VerticalScrollbar) { >- contentsRect.move(0, thumbPosition(scrollbar)); >- contentsRect.setWidth(scrollbarWidget.slider().preferredSize().width()); >- contentsRect.setHeight(thumbSize); >- } else { >- contentsRect.move(thumbPosition(scrollbar), 0); >- contentsRect.setWidth(thumbSize); >- contentsRect.setHeight(scrollbarWidget.slider().preferredSize().height()); >- } >- if (contentsRect.intersects(damageRect)) >- scrollbarWidget.slider().render(graphicsContext.platformContext()->cr(), contentsRect); >- } >- >- if (opacity != 1) { >- graphicsContext.endTransparencyLayer(); >- graphicsContext.restore(); >- } >- >- return true; >-} >- >-ScrollbarButtonPressAction ScrollbarThemeGtk::handleMousePressEvent(Scrollbar&, const PlatformMouseEvent& event, ScrollbarPart pressedPart) >-{ >- gboolean warpSlider = FALSE; >- switch (pressedPart) { >- case BackTrackPart: >- case ForwardTrackPart: >- g_object_get(gtk_settings_get_default(), >- "gtk-primary-button-warps-slider", >- &warpSlider, nullptr); >- // The shift key or middle/right button reverses the sense. >- if (event.shiftKey() || event.button() != LeftButton) >- warpSlider = !warpSlider; >- return warpSlider ? >- ScrollbarButtonPressAction::CenterOnThumb: >- ScrollbarButtonPressAction::Scroll; >- case ThumbPart: >- if (event.button() != RightButton) >- return ScrollbarButtonPressAction::StartDrag; >- break; >- case BackButtonStartPart: >- case ForwardButtonStartPart: >- case BackButtonEndPart: >- case ForwardButtonEndPart: >- return ScrollbarButtonPressAction::Scroll; >- default: >- break; >- } >- >- return ScrollbarButtonPressAction::None; >-} >- >-int ScrollbarThemeGtk::scrollbarThickness(ScrollbarControlSize, ScrollbarExpansionState) >-{ >- auto& scrollbarWidget = static_cast<RenderThemeScrollbar&>(RenderThemeWidget::getOrCreate(RenderThemeWidget::Type::VerticalScrollbarRight)); >- scrollbarWidget.scrollbar().setState(GTK_STATE_FLAG_PRELIGHT); >- IntSize contentsPreferredSize = scrollbarWidget.contents().preferredSize(); >- contentsPreferredSize = contentsPreferredSize.expandedTo(scrollbarWidget.slider().preferredSize()); >- IntSize preferredSize = contentsPreferredSize + scrollbarWidget.scrollbar().preferredSize() - scrollbarWidget.scrollbar().minimumSize(); >- return preferredSize.width(); >-} >- >-int ScrollbarThemeGtk::minimumThumbLength(Scrollbar& scrollbar) >-{ >- auto& scrollbarWidget = static_cast<RenderThemeScrollbar&>(RenderThemeWidget::getOrCreate(RenderThemeWidget::Type::VerticalScrollbarRight)); >- scrollbarWidget.scrollbar().setState(GTK_STATE_FLAG_PRELIGHT); >- IntSize minSize = scrollbarWidget.slider().minimumSize(); >- return scrollbar.orientation() == VerticalScrollbar ? minSize.height() : minSize.width(); >-} >- >-} // namespace WebCore >diff --git a/Source/WebCore/platform/gtk/ScrollbarThemeGtk.h b/Source/WebCore/platform/gtk/ScrollbarThemeGtk.h >deleted file mode 100644 >index 31ab63fe653..00000000000 >--- a/Source/WebCore/platform/gtk/ScrollbarThemeGtk.h >+++ /dev/null >@@ -1,70 +0,0 @@ >-/* >- * Copyright (C) 2008 Apple Inc. All Rights Reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#pragma once >- >-#include "ScrollbarThemeComposite.h" >- >-namespace WebCore { >- >-class Scrollbar; >- >-class ScrollbarThemeGtk final : public ScrollbarThemeComposite { >-public: >- virtual ~ScrollbarThemeGtk(); >- >- bool hasButtons(Scrollbar&) override; >- bool hasThumb(Scrollbar&) override; >- IntRect backButtonRect(Scrollbar&, ScrollbarPart, bool) override; >- IntRect forwardButtonRect(Scrollbar&, ScrollbarPart, bool) override; >- IntRect trackRect(Scrollbar&, bool) override; >- >- ScrollbarThemeGtk(); >- >- bool paint(Scrollbar&, GraphicsContext&, const IntRect& damageRect) override; >- ScrollbarButtonPressAction handleMousePressEvent(Scrollbar&, const PlatformMouseEvent&, ScrollbarPart) override; >- int scrollbarThickness(ScrollbarControlSize, ScrollbarExpansionState = ScrollbarExpansionState::Expanded) override; >- int minimumThumbLength(Scrollbar&) override; >- >- // TODO: These are the default GTK+ values. At some point we should pull these from the theme itself. >- Seconds initialAutoscrollTimerDelay() override { return 200_ms; } >- Seconds autoscrollTimerDelay() override { return 20_ms; } >- void themeChanged() override; >- bool usesOverlayScrollbars() const override { return m_usesOverlayScrollbars; } >- // When using overlay scrollbars, always invalidate the whole scrollbar when entering/leaving. >- bool invalidateOnMouseEnterExit() override { return m_usesOverlayScrollbars; } >- >-private: >- void updateThemeProperties(); >- >- bool m_hasForwardButtonStartPart : 1; >- bool m_hasForwardButtonEndPart : 1; >- bool m_hasBackButtonStartPart : 1; >- bool m_hasBackButtonEndPart : 1; >- bool m_usesOverlayScrollbars { false }; >-}; >- >-} >- >diff --git a/Source/WebCore/platform/gtk/ThemeGtk.cpp b/Source/WebCore/platform/gtk/ThemeGtk.cpp >new file mode 100644 >index 00000000000..f0eda60b4b7 >--- /dev/null >+++ b/Source/WebCore/platform/gtk/ThemeGtk.cpp >@@ -0,0 +1,107 @@ >+/* >+ * Copyright (C) 2020 Igalia S.L. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "ThemeGtk.h" >+ >+#include "GRefPtrGtk.h" >+#include <gtk/gtk.h> >+#include <wtf/NeverDestroyed.h> >+#include <wtf/glib/GUniquePtr.h> >+ >+namespace WebCore { >+ >+Theme& Theme::singleton() >+{ >+ static NeverDestroyed<ThemeGtk> theme; >+ return theme; >+} >+ >+void ThemeGtk::ensurePlatformColors() const >+{ >+ if (m_activeSelectionBackgroundColor.isValid()) >+ return; >+ >+ GRefPtr<GtkWidgetPath> entryPath = adoptGRef(gtk_widget_path_new()); >+ gtk_widget_path_append_type(entryPath.get(), G_TYPE_NONE); >+ gtk_widget_path_iter_set_object_name(entryPath.get(), -1, "entry"); >+ GRefPtr<GtkStyleContext> entryContext = adoptGRef(gtk_style_context_new()); >+ gtk_style_context_set_path(entryContext.get(), entryPath.get()); >+ >+ GRefPtr<GtkWidgetPath> selectionPath = adoptGRef(gtk_widget_path_copy(gtk_style_context_get_path(entryContext.get()))); >+ gtk_widget_path_append_type(selectionPath.get(), G_TYPE_NONE); >+ gtk_widget_path_iter_set_object_name(selectionPath.get(), -1, "selection"); >+ GRefPtr<GtkStyleContext> selectionContext = adoptGRef(gtk_style_context_new()); >+ gtk_style_context_set_path(selectionContext.get(), selectionPath.get()); >+ gtk_style_context_set_parent(selectionContext.get(), entryContext.get()); >+ >+ gtk_style_context_set_state(selectionContext.get(), static_cast<GtkStateFlags>(GTK_STATE_FLAG_SELECTED | GTK_STATE_FLAG_FOCUSED)); >+ >+ GdkRGBA color; >+ gtk_style_context_get_background_color(selectionContext.get(), gtk_style_context_get_state(selectionContext.get()), &color); >+ m_activeSelectionBackgroundColor = color; >+ >+ gtk_style_context_get_color(selectionContext.get(), gtk_style_context_get_state(selectionContext.get()), &color); >+ m_ativeSelectionForegroundColor = color; >+ >+ gtk_style_context_set_state(selectionContext.get(), GTK_STATE_FLAG_SELECTED); >+ >+ gtk_style_context_get_background_color(selectionContext.get(), gtk_style_context_get_state(selectionContext.get()), &color); >+ m_inactiveSelectionBackgroundColor = color; >+ >+ gtk_style_context_get_color(selectionContext.get(), gtk_style_context_get_state(selectionContext.get()), &color); >+ m_inactiveSelectionForegroundColor = color; >+} >+ >+void ThemeGtk::platformColorsDidChange() >+{ >+ m_activeSelectionBackgroundColor = { }; >+} >+ >+Color ThemeGtk::activeSelectionForegroundColor() const >+{ >+ ensurePlatformColors(); >+ return m_ativeSelectionForegroundColor; >+} >+ >+Color ThemeGtk::activeSelectionBackgroundColor() const >+{ >+ ensurePlatformColors(); >+ return m_activeSelectionBackgroundColor; >+} >+ >+Color ThemeGtk::inactiveSelectionForegroundColor() const >+{ >+ ensurePlatformColors(); >+ return m_inactiveSelectionForegroundColor; >+} >+ >+Color ThemeGtk::inactiveSelectionBackgroundColor() const >+{ >+ ensurePlatformColors(); >+ return m_inactiveSelectionBackgroundColor; >+} >+ >+} // namespace WebCore >diff --git a/Source/WebCore/platform/gtk/ThemeGtk.h b/Source/WebCore/platform/gtk/ThemeGtk.h >new file mode 100644 >index 00000000000..5cf29e4cf1d >--- /dev/null >+++ b/Source/WebCore/platform/gtk/ThemeGtk.h >@@ -0,0 +1,49 @@ >+/* >+ * Copyright (C) 2020 Igalia S.L. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include "Color.h" >+#include "ThemeAdwaita.h" >+ >+namespace WebCore { >+ >+class ThemeGtk final : public ThemeAdwaita { >+private: >+ Color activeSelectionForegroundColor() const override; >+ Color activeSelectionBackgroundColor() const override; >+ Color inactiveSelectionForegroundColor() const override; >+ Color inactiveSelectionBackgroundColor() const override; >+ void platformColorsDidChange() override; >+ >+ void ensurePlatformColors() const; >+ >+ mutable Color m_activeSelectionBackgroundColor; >+ mutable Color m_ativeSelectionForegroundColor; >+ mutable Color m_inactiveSelectionBackgroundColor; >+ mutable Color m_inactiveSelectionForegroundColor; >+}; >+ >+} // namespace WebCore >diff --git a/Source/WebCore/platform/wpe/RenderThemeWPE.cpp b/Source/WebCore/rendering/RenderThemeAdwaita.cpp >similarity index 73% >rename from Source/WebCore/platform/wpe/RenderThemeWPE.cpp >rename to Source/WebCore/rendering/RenderThemeAdwaita.cpp >index e849306c7ae..c08a437beae 100644 >--- a/Source/WebCore/platform/wpe/RenderThemeWPE.cpp >+++ b/Source/WebCore/rendering/RenderThemeAdwaita.cpp >@@ -24,7 +24,7 @@ > */ > > #include "config.h" >-#include "RenderThemeWPE.h" >+#include "RenderThemeAdwaita.h" > > #include "Color.h" > #include "FloatRoundedRect.h" >@@ -32,13 +32,12 @@ > #include "HTMLInputElement.h" > #include "HTMLMediaElement.h" > #include "MediaControlElements.h" >-#include "NotImplemented.h" > #include "PaintInfo.h" > #include "RenderBox.h" > #include "RenderObject.h" > #include "RenderProgress.h" > #include "RenderStyle.h" >-#include "ThemeWPE.h" >+#include "ThemeAdwaita.h" > #include "TimeRanges.h" > #include "UserAgentScripts.h" > #include "UserAgentStyleSheets.h" >@@ -54,7 +53,7 @@ static const Color textFieldBackgroundDisabledColor = makeRGB(252, 252, 252); > static const unsigned menuListButtonArrowSize = 16; > static const int menuListButtonFocusOffset = -3; > static const unsigned menuListButtonPadding = 5; >-static const int menuListButtonBorderSize = 1; // Keep in sync with buttonBorderSize in ThemeWPE. >+static const int menuListButtonBorderSize = 1; // Keep in sync with buttonBorderSize in ThemeAdwaita. > static const unsigned progressActivityBlocks = 5; > static const unsigned progressAnimationFrameCount = 75; > static const Seconds progressAnimationFrameRate = 33_ms; // 30fps. >@@ -78,13 +77,15 @@ static const Color mediaSliderTrackBufferedColor = makeRGB(173, 173, 173); > static const Color mediaSliderTrackActiveColor = makeRGB(252, 252, 252); > #endif > >+#if !PLATFORM(GTK) > RenderTheme& RenderTheme::singleton() > { >- static NeverDestroyed<RenderThemeWPE> theme; >+ static NeverDestroyed<RenderThemeAdwaita> theme; > return theme; > } >+#endif > >-bool RenderThemeWPE::supportsFocusRing(const RenderStyle& style) const >+bool RenderThemeAdwaita::supportsFocusRing(const RenderStyle& style) const > { > switch (style.appearance()) { > case PushButtonPart: >@@ -105,68 +106,74 @@ bool RenderThemeWPE::supportsFocusRing(const RenderStyle& style) const > return false; > } > >-void RenderThemeWPE::updateCachedSystemFontDescription(CSSValueID, FontCascadeDescription&) const >+bool RenderThemeAdwaita::shouldHaveCapsLockIndicator(const HTMLInputElement& element) const > { >- notImplemented(); >+ return element.isPasswordField(); > } > >-Color RenderThemeWPE::platformFocusRingColor(OptionSet<StyleColor::Options>) const >+Color RenderThemeAdwaita::platformActiveSelectionBackgroundColor(OptionSet<StyleColor::Options>) const > { >- return ThemeWPE::focusColor(); >+ return static_cast<ThemeAdwaita&>(Theme::singleton()).activeSelectionBackgroundColor(); > } > >-Color RenderThemeWPE::platformActiveSelectionBackgroundColor(OptionSet<StyleColor::Options>) const >+Color RenderThemeAdwaita::platformInactiveSelectionBackgroundColor(OptionSet<StyleColor::Options>) const > { >- return makeRGB(52, 132, 228); >+ return static_cast<ThemeAdwaita&>(Theme::singleton()).inactiveSelectionBackgroundColor(); > } > >-Color RenderThemeWPE::platformInactiveSelectionBackgroundColor(OptionSet<StyleColor::Options> options) const >+Color RenderThemeAdwaita::platformActiveSelectionForegroundColor(OptionSet<StyleColor::Options>) const > { >- return platformActiveSelectionBackgroundColor(options); >+ return static_cast<ThemeAdwaita&>(Theme::singleton()).activeSelectionForegroundColor(); > } > >-Color RenderThemeWPE::platformActiveSelectionForegroundColor(OptionSet<StyleColor::Options>) const >+Color RenderThemeAdwaita::platformInactiveSelectionForegroundColor(OptionSet<StyleColor::Options>) const > { >- return makeRGB(255, 255, 255); >+ return static_cast<ThemeAdwaita&>(Theme::singleton()).inactiveSelectionForegroundColor(); > } > >-Color RenderThemeWPE::platformInactiveSelectionForegroundColor(OptionSet<StyleColor::Options>) const >+Color RenderThemeAdwaita::platformActiveListBoxSelectionBackgroundColor(OptionSet<StyleColor::Options>) const > { >- return makeRGB(252, 252, 252); >+ return static_cast<ThemeAdwaita&>(Theme::singleton()).activeSelectionBackgroundColor(); > } > >-Color RenderThemeWPE::platformActiveListBoxSelectionBackgroundColor(OptionSet<StyleColor::Options> options) const >+Color RenderThemeAdwaita::platformInactiveListBoxSelectionBackgroundColor(OptionSet<StyleColor::Options>) const > { >- return platformActiveSelectionBackgroundColor(options); >+ return static_cast<ThemeAdwaita&>(Theme::singleton()).inactiveSelectionBackgroundColor(); > } > >-Color RenderThemeWPE::platformInactiveListBoxSelectionBackgroundColor(OptionSet<StyleColor::Options> options) const >+Color RenderThemeAdwaita::platformActiveListBoxSelectionForegroundColor(OptionSet<StyleColor::Options>) const > { >- return platformInactiveSelectionBackgroundColor(options); >+ return static_cast<ThemeAdwaita&>(Theme::singleton()).activeSelectionForegroundColor(); > } > >-Color RenderThemeWPE::platformActiveListBoxSelectionForegroundColor(OptionSet<StyleColor::Options> options) const >+Color RenderThemeAdwaita::platformInactiveListBoxSelectionForegroundColor(OptionSet<StyleColor::Options>) const > { >- return platformActiveSelectionForegroundColor(options); >+ return static_cast<ThemeAdwaita&>(Theme::singleton()).inactiveSelectionForegroundColor(); > } > >-Color RenderThemeWPE::platformInactiveListBoxSelectionForegroundColor(OptionSet<StyleColor::Options> options) const >+Color RenderThemeAdwaita::platformFocusRingColor(OptionSet<StyleColor::Options>) const > { >- return platformInactiveSelectionForegroundColor(options); >+ return ThemeAdwaita::focusColor(); > } > >-String RenderThemeWPE::extraDefaultStyleSheet() >+void RenderThemeAdwaita::platformColorsDidChange() >+{ >+ static_cast<ThemeAdwaita&>(Theme::singleton()).platformColorsDidChange(); >+ RenderTheme::platformColorsDidChange(); >+} >+ >+String RenderThemeAdwaita::extraDefaultStyleSheet() > { > return String(themeAdwaitaUserAgentStyleSheet, sizeof(themeAdwaitaUserAgentStyleSheet)); > } > > #if ENABLE(VIDEO) >-String RenderThemeWPE::extraMediaControlsStyleSheet() >+String RenderThemeAdwaita::extraMediaControlsStyleSheet() > { > return String(mediaControlsAdwaitaUserAgentStyleSheet, sizeof(mediaControlsAdwaitaUserAgentStyleSheet)); > } > >-String RenderThemeWPE::mediaControlsScript() >+String RenderThemeAdwaita::mediaControlsScript() > { > StringBuilder scriptBuilder; > scriptBuilder.appendCharacters(mediaControlsLocalizedStringsJavaScript, sizeof(mediaControlsLocalizedStringsJavaScript)); >@@ -176,7 +183,7 @@ String RenderThemeWPE::mediaControlsScript() > } > #endif > >-bool RenderThemeWPE::paintTextField(const RenderObject& renderObject, const PaintInfo& paintInfo, const FloatRect& rect) >+bool RenderThemeAdwaita::paintTextField(const RenderObject& renderObject, const PaintInfo& paintInfo, const FloatRect& rect) > { > auto& graphicsContext = paintInfo.context(); > GraphicsContextStateSaver stateSaver(graphicsContext); >@@ -209,20 +216,37 @@ bool RenderThemeWPE::paintTextField(const RenderObject& renderObject, const Pain > graphicsContext.setFillColor(textFieldBackgroundColor); > graphicsContext.fillPath(path); > >+#if ENABLE(DATALIST_ELEMENT) >+ if (is<HTMLInputElement>(renderObject.generatingNode()) && downcast<HTMLInputElement>(*(renderObject.generatingNode())).list()) { >+ FloatRect arrowRect = rect; >+ if (renderObject.style().direction() == TextDirection::LTR) >+ arrowRect.move(arrowRect.width() - (menuListButtonArrowSize + textFieldBorderSize * 2), (arrowRect.height() / 2.) - (menuListButtonArrowSize / 2.)); >+ else >+ fieldRect.move(textFieldBorderSize * 2, (arrowRect.height() / 2.) - (menuListButtonArrowSize / 2.)); >+ arrowRect.setWidth(menuListButtonArrowSize); >+ arrowRect.setHeight(menuListButtonArrowSize); >+ { >+ GraphicsContextStateSaver arrowStateSaver(graphicsContext); >+ graphicsContext.translate(arrowRect.x(), arrowRect.y()); >+ ThemeAdwaita::paintArrow(graphicsContext, ThemeAdwaita::ArrowDirection::Down); >+ } >+ } >+#endif >+ > return false; > } > >-bool RenderThemeWPE::paintTextArea(const RenderObject& renderObject, const PaintInfo& paintInfo, const FloatRect& rect) >+bool RenderThemeAdwaita::paintTextArea(const RenderObject& renderObject, const PaintInfo& paintInfo, const FloatRect& rect) > { > return paintTextField(renderObject, paintInfo, rect); > } > >-bool RenderThemeWPE::paintSearchField(const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect) >+bool RenderThemeAdwaita::paintSearchField(const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect) > { > return paintTextField(renderObject, paintInfo, rect); > } > >-LengthBox RenderThemeWPE::popupInternalPaddingBox(const RenderStyle& style) const >+LengthBox RenderThemeAdwaita::popupInternalPaddingBox(const RenderStyle& style) const > { > if (style.appearance() == NoControlPart) > return { }; >@@ -233,7 +257,7 @@ LengthBox RenderThemeWPE::popupInternalPaddingBox(const RenderStyle& style) cons > return { menuListButtonPadding, rightPadding, menuListButtonPadding, leftPadding }; > } > >-bool RenderThemeWPE::paintMenuList(const RenderObject& renderObject, const PaintInfo& paintInfo, const FloatRect& rect) >+bool RenderThemeAdwaita::paintMenuList(const RenderObject& renderObject, const PaintInfo& paintInfo, const FloatRect& rect) > { > auto& graphicsContext = paintInfo.context(); > GraphicsContextStateSaver stateSaver(graphicsContext); >@@ -259,36 +283,36 @@ bool RenderThemeWPE::paintMenuList(const RenderObject& renderObject, const Paint > { > GraphicsContextStateSaver arrowStateSaver(graphicsContext); > graphicsContext.translate(fieldRect.x(), fieldRect.y()); >- ThemeWPE::paintArrow(graphicsContext, ThemeWPE::ArrowDirection::Down); >+ ThemeAdwaita::paintArrow(graphicsContext, ThemeAdwaita::ArrowDirection::Down); > } > > if (isFocused(renderObject)) >- ThemeWPE::paintFocus(graphicsContext, rect, menuListButtonFocusOffset); >+ ThemeAdwaita::paintFocus(graphicsContext, rect, menuListButtonFocusOffset); > > return false; > } > >-bool RenderThemeWPE::paintMenuListButtonDecorations(const RenderBox& renderObject, const PaintInfo& paintInfo, const FloatRect& rect) >+bool RenderThemeAdwaita::paintMenuListButtonDecorations(const RenderBox& renderObject, const PaintInfo& paintInfo, const FloatRect& rect) > { > return paintMenuList(renderObject, paintInfo, rect); > } > >-Seconds RenderThemeWPE::animationRepeatIntervalForProgressBar(RenderProgress&) const >+Seconds RenderThemeAdwaita::animationRepeatIntervalForProgressBar(RenderProgress&) const > { > return progressAnimationFrameRate; > } > >-Seconds RenderThemeWPE::animationDurationForProgressBar(RenderProgress&) const >+Seconds RenderThemeAdwaita::animationDurationForProgressBar(RenderProgress&) const > { > return progressAnimationFrameRate * progressAnimationFrameCount; > } > >-IntRect RenderThemeWPE::progressBarRectForBounds(const RenderObject&, const IntRect& bounds) const >+IntRect RenderThemeAdwaita::progressBarRectForBounds(const RenderObject&, const IntRect& bounds) const > { > return { bounds.x(), bounds.y(), bounds.width(), progressBarSize }; > } > >-bool RenderThemeWPE::paintProgressBar(const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect) >+bool RenderThemeAdwaita::paintProgressBar(const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect) > { > if (!renderObject.isProgress()) > return true; >@@ -345,7 +369,7 @@ bool RenderThemeWPE::paintProgressBar(const RenderObject& renderObject, const Pa > return false; > } > >-bool RenderThemeWPE::paintSliderTrack(const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect) >+bool RenderThemeAdwaita::paintSliderTrack(const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect) > { > auto& graphicsContext = paintInfo.context(); > GraphicsContextStateSaver stateSaver(graphicsContext); >@@ -410,12 +434,12 @@ bool RenderThemeWPE::paintSliderTrack(const RenderObject& renderObject, const Pa > graphicsContext.fillPath(path); > > if (isFocused(renderObject)) >- ThemeWPE::paintFocus(graphicsContext, fieldRect, sliderTrackFocusOffset); >+ ThemeAdwaita::paintFocus(graphicsContext, fieldRect, sliderTrackFocusOffset); > > return false; > } > >-void RenderThemeWPE::adjustSliderThumbSize(RenderStyle& style, const Element*) const >+void RenderThemeAdwaita::adjustSliderThumbSize(RenderStyle& style, const Element*) const > { > ControlPart part = style.appearance(); > if (part != SliderThumbHorizontalPart && part != SliderThumbVerticalPart) >@@ -425,7 +449,7 @@ void RenderThemeWPE::adjustSliderThumbSize(RenderStyle& style, const Element*) c > style.setHeight(Length(sliderThumbSize, Fixed)); > } > >-bool RenderThemeWPE::paintSliderThumb(const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect) >+bool RenderThemeAdwaita::paintSliderThumb(const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect) > { > auto& graphicsContext = paintInfo.context(); > GraphicsContextStateSaver stateSaver(graphicsContext); >@@ -459,7 +483,7 @@ bool RenderThemeWPE::paintSliderThumb(const RenderObject& renderObject, const Pa > } > > #if ENABLE(VIDEO) >-bool RenderThemeWPE::paintMediaSliderTrack(const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect) >+bool RenderThemeAdwaita::paintMediaSliderTrack(const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect) > { > auto mediaElement = parentMediaElement(renderObject); > if (!mediaElement) >@@ -507,7 +531,7 @@ bool RenderThemeWPE::paintMediaSliderTrack(const RenderObject& renderObject, con > return false; > } > >-bool RenderThemeWPE::paintMediaVolumeSliderTrack(const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect) >+bool RenderThemeAdwaita::paintMediaVolumeSliderTrack(const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect) > { > auto mediaElement = parentMediaElement(renderObject); > if (!mediaElement) >@@ -538,4 +562,27 @@ bool RenderThemeWPE::paintMediaVolumeSliderTrack(const RenderObject& renderObjec > } > #endif // ENABLE(VIDEO) > >+#if ENABLE(DATALIST_ELEMENT) >+IntSize RenderThemeAdwaita::sliderTickSize() const >+{ >+ // FIXME: We need to set this to the size of one tick mark. >+ return IntSize(0, 0); >+} >+ >+int RenderThemeAdwaita::sliderTickOffsetFromTrackCenter() const >+{ >+ // FIXME: We need to set this to the position of the tick marks. >+ return 0; >+} >+ >+void RenderThemeAdwaita::adjustListButtonStyle(RenderStyle& style, const Element*) const >+{ >+ // Add a margin to place the button at end of the input field. >+ if (style.isLeftToRightDirection()) >+ style.setMarginRight(Length(-2, Fixed)); >+ else >+ style.setMarginLeft(Length(-2, Fixed)); >+} >+#endif // ENABLE(DATALIST_ELEMENT) >+ > } // namespace WebCore >diff --git a/Source/WebCore/platform/wpe/RenderThemeWPE.h b/Source/WebCore/rendering/RenderThemeAdwaita.h >similarity index 68% >rename from Source/WebCore/platform/wpe/RenderThemeWPE.h >rename to Source/WebCore/rendering/RenderThemeAdwaita.h >index 2998ffb09b3..e21cc27510b 100644 >--- a/Source/WebCore/platform/wpe/RenderThemeWPE.h >+++ b/Source/WebCore/rendering/RenderThemeAdwaita.h >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2014 Igalia S.L. >+ * Copyright (C) 2020 Igalia S.L. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -29,60 +29,62 @@ > > namespace WebCore { > >-class RenderThemeWPE final : public RenderTheme { >+class RenderThemeAdwaita : public RenderTheme { > public: >- friend NeverDestroyed<RenderThemeWPE>; >+ virtual ~RenderThemeAdwaita() = default; > >- String extraDefaultStyleSheet() override; >+private: >+ String extraDefaultStyleSheet() final; > #if ENABLE(VIDEO) >- String extraMediaControlsStyleSheet() override; >- String mediaControlsScript() override; >+ String extraMediaControlsStyleSheet() final; >+ String mediaControlsScript() final; > #endif > >-private: >- RenderThemeWPE() = default; >- virtual ~RenderThemeWPE() = default; >- >- bool supportsHover(const RenderStyle&) const override { return true; } >- bool supportsFocusRing(const RenderStyle&) const override; >- >- void updateCachedSystemFontDescription(CSSValueID, FontCascadeDescription&) const override; >- >- Color platformFocusRingColor(OptionSet<StyleColor::Options>) const override; >- >- Color platformActiveSelectionBackgroundColor(OptionSet<StyleColor::Options>) const override; >- Color platformInactiveSelectionBackgroundColor(OptionSet<StyleColor::Options>) const override; >- Color platformActiveSelectionForegroundColor(OptionSet<StyleColor::Options>) const override; >- Color platformInactiveSelectionForegroundColor(OptionSet<StyleColor::Options>) const override; >- >- Color platformActiveListBoxSelectionBackgroundColor(OptionSet<StyleColor::Options>) const override; >- Color platformActiveListBoxSelectionForegroundColor(OptionSet<StyleColor::Options>) const override; >- Color platformInactiveListBoxSelectionBackgroundColor(OptionSet<StyleColor::Options>) const override; >- Color platformInactiveListBoxSelectionForegroundColor(OptionSet<StyleColor::Options>) const override; >- >- bool paintTextField(const RenderObject&, const PaintInfo&, const FloatRect&) override; >- bool paintTextArea(const RenderObject&, const PaintInfo&, const FloatRect&) override; >- bool paintSearchField(const RenderObject&, const PaintInfo&, const IntRect&) override; >- >- bool popsMenuBySpaceOrReturn() const override { return true; } >- LengthBox popupInternalPaddingBox(const RenderStyle&) const override; >- bool paintMenuList(const RenderObject&, const PaintInfo&, const FloatRect&) override; >- bool paintMenuListButtonDecorations(const RenderBox&, const PaintInfo&, const FloatRect&) override; >- >- Seconds animationRepeatIntervalForProgressBar(RenderProgress&) const override; >- Seconds animationDurationForProgressBar(RenderProgress&) const override; >- IntRect progressBarRectForBounds(const RenderObject&, const IntRect&) const override; >- bool paintProgressBar(const RenderObject&, const PaintInfo&, const IntRect&) override; >- >- bool paintSliderTrack(const RenderObject&, const PaintInfo&, const IntRect&) override; >- void adjustSliderThumbSize(RenderStyle&, const Element*) const override; >- bool paintSliderThumb(const RenderObject&, const PaintInfo&, const IntRect&) override; >+ bool supportsHover(const RenderStyle&) const final { return true; } >+ bool supportsFocusRing(const RenderStyle&) const final; >+ bool shouldHaveCapsLockIndicator(const HTMLInputElement&) const final; >+ >+ void updateCachedSystemFontDescription(CSSValueID, FontCascadeDescription&) const override { }; >+ >+ Color platformActiveSelectionBackgroundColor(OptionSet<StyleColor::Options>) const final; >+ Color platformInactiveSelectionBackgroundColor(OptionSet<StyleColor::Options>) const final; >+ Color platformActiveSelectionForegroundColor(OptionSet<StyleColor::Options>) const final; >+ Color platformInactiveSelectionForegroundColor(OptionSet<StyleColor::Options>) const final; >+ Color platformActiveListBoxSelectionBackgroundColor(OptionSet<StyleColor::Options>) const final; >+ Color platformActiveListBoxSelectionForegroundColor(OptionSet<StyleColor::Options>) const final; >+ Color platformInactiveListBoxSelectionBackgroundColor(OptionSet<StyleColor::Options>) const final; >+ Color platformInactiveListBoxSelectionForegroundColor(OptionSet<StyleColor::Options>) const final; >+ Color platformFocusRingColor(OptionSet<StyleColor::Options>) const final; >+ void platformColorsDidChange() final; >+ >+ bool paintTextField(const RenderObject&, const PaintInfo&, const FloatRect&) final; >+ bool paintTextArea(const RenderObject&, const PaintInfo&, const FloatRect&) final; >+ bool paintSearchField(const RenderObject&, const PaintInfo&, const IntRect&) final; >+ >+ bool popsMenuBySpaceOrReturn() const final { return true; } >+ LengthBox popupInternalPaddingBox(const RenderStyle&) const final; >+ bool paintMenuList(const RenderObject&, const PaintInfo&, const FloatRect&) final; >+ bool paintMenuListButtonDecorations(const RenderBox&, const PaintInfo&, const FloatRect&) final; >+ >+ Seconds animationRepeatIntervalForProgressBar(RenderProgress&) const final; >+ Seconds animationDurationForProgressBar(RenderProgress&) const final; >+ IntRect progressBarRectForBounds(const RenderObject&, const IntRect&) const final; >+ bool paintProgressBar(const RenderObject&, const PaintInfo&, const IntRect&) final; >+ >+ bool paintSliderTrack(const RenderObject&, const PaintInfo&, const IntRect&) final; >+ void adjustSliderThumbSize(RenderStyle&, const Element*) const final; >+ bool paintSliderThumb(const RenderObject&, const PaintInfo&, const IntRect&) final; > > #if ENABLE(VIDEO) >- bool paintMediaSliderTrack(const RenderObject&, const PaintInfo&, const IntRect&) override; >- bool paintMediaVolumeSliderTrack(const RenderObject&, const PaintInfo&, const IntRect&) override; >+ bool paintMediaSliderTrack(const RenderObject&, const PaintInfo&, const IntRect&) final; >+ bool paintMediaVolumeSliderTrack(const RenderObject&, const PaintInfo&, const IntRect&) final; > #endif > >+#if ENABLE(DATALIST_ELEMENT) >+ IntSize sliderTickSize() const final; >+ int sliderTickOffsetFromTrackCenter() const final; >+ void adjustListButtonStyle(RenderStyle&, const Element*) const final; >+#endif > }; > > } // namespace WebCore >diff --git a/Source/WebCore/rendering/RenderThemeGtk.cpp b/Source/WebCore/rendering/RenderThemeGtk.cpp >index 1aba35bcd8d..d73af6c67b2 100644 >--- a/Source/WebCore/rendering/RenderThemeGtk.cpp >+++ b/Source/WebCore/rendering/RenderThemeGtk.cpp >@@ -1,9 +1,5 @@ > /* >- * Copyright (C) 2007 Apple Inc. >- * Copyright (C) 2007 Alp Toker <alp@atoker.com> >- * Copyright (C) 2008 Collabora Ltd. >- * Copyright (C) 2009 Kenneth Rohde Christiansen >- * Copyright (C) 2010 Igalia S.L. >+ * Copyright (C) 2020 Igalia S.L. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -26,38 +22,11 @@ > #include "RenderThemeGtk.h" > > #include "CSSValueKeywords.h" >-#include "FileList.h" >-#include "FloatRoundedRect.h" > #include "FontDescription.h" > #include "GRefPtrGtk.h" >-#include "GUniquePtrGtk.h" >-#include "Gradient.h" >-#include "GraphicsContext.h" >-#include "HTMLInputElement.h" >-#include "HTMLMediaElement.h" >-#include "LocalizedStrings.h" >-#include "MediaControlElements.h" >-#include "Page.h" >-#include "PaintInfo.h" >-#include "PlatformContextCairo.h" >-#include "RenderBox.h" >-#include "RenderObject.h" >-#include "RenderProgress.h" >-#include "RenderThemeWidget.h" >-#include "ScrollbarThemeGtk.h" >-#include "StringTruncator.h" >-#include "TimeRanges.h" >-#include "UserAgentScripts.h" >-#include "UserAgentStyleSheets.h" >-#include <cmath> >-#include <gdk/gdk.h> >-#include <glib.h> >+#include "PlatformScreen.h" > #include <gtk/gtk.h> >-#include <wtf/FileSystem.h> >-#include <wtf/glib/GRefPtr.h> > #include <wtf/glib/GUniquePtr.h> >-#include <wtf/text/CString.h> >-#include <wtf/text/StringBuilder.h> > > namespace WebCore { > >@@ -67,19 +36,6 @@ RenderTheme& RenderTheme::singleton() > return theme; > } > >-static double getScreenDPI() >-{ >- // FIXME: Really this should be the widget's screen. >- GdkScreen* screen = gdk_screen_get_default(); >- if (!screen) >- return 96; // Default to 96 DPI. >- >- float dpi = gdk_screen_get_resolution(screen); >- if (dpi <= 0) >- return 96; >- return dpi; >-} >- > void RenderThemeGtk::updateCachedSystemFontDescription(CSSValueID, FontCascadeDescription& fontDescription) const > { > GtkSettings* settings = gtk_settings_get_default(); >@@ -101,7 +57,7 @@ void RenderThemeGtk::updateCachedSystemFontDescription(CSSValueID, FontCascadeDe > int size = pango_font_description_get_size(pangoDescription) / PANGO_SCALE; > // If the size of the font is in points, we need to convert it to pixels. > if (!pango_font_description_get_size_is_absolute(pangoDescription)) >- size = size * (getScreenDPI() / 72.0); >+ size = size * (screenDPI() / 72.0); > > fontDescription.setSpecifiedSize(size); > fontDescription.setIsAbsoluteSize(true); >@@ -110,1085 +66,12 @@ void RenderThemeGtk::updateCachedSystemFontDescription(CSSValueID, FontCascadeDe > pango_font_description_free(pangoDescription); > } > >-#if ENABLE(DATALIST_ELEMENT) >-IntSize RenderThemeGtk::sliderTickSize() const >-{ >- // FIXME: We need to set this to the size of one tick mark. >- return IntSize(0, 0); >-} >- >-int RenderThemeGtk::sliderTickOffsetFromTrackCenter() const >-{ >- // FIXME: We need to set this to the position of the tick marks. >- return 0; >-} >-#endif >- >-enum RenderThemePart { >- Entry, >- EntrySelection, >- EntryIconLeft, >- EntryIconRight, >- Button, >- CheckButton, >- RadioButton, >- ComboBox, >- ComboBoxButton, >- ComboBoxArrow, >- Scale, >- ScaleTrough, >- ScaleSlider, >- ProgressBar, >- ProgressBarTrough, >- ProgressBarProgress, >- ListBox, >- SpinButton, >- SpinButtonUpButton, >- SpinButtonDownButton, >-#if ENABLE(VIDEO) >- MediaButton, >-#endif >- Window, >-}; >- >-#if ENABLE(VIDEO) >-static bool nodeHasPseudo(Node& node, const char* pseudo) >-{ >- return is<Element>(node) && downcast<Element>(node).pseudo() == pseudo; >-} >- >-static bool nodeHasClass(Node* node, const char* className) >-{ >- if (!is<Element>(*node)) >- return false; >- >- Element& element = downcast<Element>(*node); >- >- if (!element.hasClass()) >- return false; >- >- return element.classNames().contains(className); >-} >-#endif // ENABLE(VIDEO) >- >-RenderThemeGtk::~RenderThemeGtk() = default; >- >-static bool supportsFocus(ControlPart appearance) >-{ >- switch (appearance) { >- case PushButtonPart: >- case ButtonPart: >- case TextFieldPart: >- case TextAreaPart: >- case SearchFieldPart: >- case MenulistPart: >- case RadioPart: >- case CheckboxPart: >- case SliderHorizontalPart: >- case SliderVerticalPart: >- return true; >- default: >- return false; >- } >-} >- >-bool RenderThemeGtk::supportsFocusRing(const RenderStyle& style) const >-{ >- return supportsFocus(style.appearance()); >-} >- >-bool RenderThemeGtk::controlSupportsTints(const RenderObject& o) const >-{ >- return isEnabled(o); >-} >- >-int RenderThemeGtk::baselinePosition(const RenderBox& box) const >-{ >- // FIXME: This strategy is possibly incorrect for the GTK+ port. >- if (box.style().appearance() == CheckboxPart || box.style().appearance() == RadioPart) >- return box.marginTop() + box.height() - 2; >- return RenderTheme::baselinePosition(box); >-} >- >-void RenderThemeGtk::adjustRepaintRect(const RenderObject&, FloatRect&) >-{ >-} >-static GtkStateFlags themePartStateFlags(const RenderThemeGtk& theme, RenderThemePart themePart, const RenderObject& renderObject) >-{ >- unsigned stateFlags = 0; >- switch (renderObject.style().direction()) { >- case TextDirection::RTL: >- stateFlags |= GTK_STATE_FLAG_DIR_RTL; >- break; >- case TextDirection::LTR: >- stateFlags |= GTK_STATE_FLAG_DIR_LTR; >- break; >- } >- >- if (!theme.isEnabled(renderObject) || (themePart == Entry && theme.isReadOnlyControl(renderObject))) >- stateFlags |= GTK_STATE_FLAG_INSENSITIVE; >- else { >- if (theme.isHovered(renderObject)) >- stateFlags |= GTK_STATE_FLAG_PRELIGHT; >- if (theme.isFocused(renderObject)) >- stateFlags |= GTK_STATE_FLAG_FOCUSED; >- } >- >- switch (themePart) { >- case CheckButton: >- case RadioButton: >- if (theme.isChecked(renderObject)) >- stateFlags |= GTK_STATE_FLAG_CHECKED; >- if (theme.isIndeterminate(renderObject)) >- stateFlags |= GTK_STATE_FLAG_INCONSISTENT; >- if (theme.isPressed(renderObject)) >- stateFlags |= GTK_STATE_FLAG_SELECTED; >- break; >- case Button: >- case ComboBoxButton: >- case ScaleSlider: >- case EntryIconLeft: >- case EntryIconRight: >-#if ENABLE(VIDEO) >- case MediaButton: >-#endif >- if (theme.isPressed(renderObject)) >- stateFlags |= GTK_STATE_FLAG_ACTIVE; >- break; >- case SpinButtonUpButton: >- if (theme.isPressed(renderObject) && theme.isSpinUpButtonPartPressed(renderObject)) >- stateFlags |= GTK_STATE_FLAG_ACTIVE; >- if (theme.isHovered(renderObject) && !theme.isSpinUpButtonPartHovered(renderObject)) >- stateFlags &= ~GTK_STATE_FLAG_PRELIGHT; >- break; >- case SpinButtonDownButton: >- if (theme.isPressed(renderObject) && !theme.isSpinUpButtonPartPressed(renderObject)) >- stateFlags |= GTK_STATE_FLAG_ACTIVE; >- if (theme.isHovered(renderObject) && theme.isSpinUpButtonPartHovered(renderObject)) >- stateFlags &= ~GTK_STATE_FLAG_PRELIGHT; >- break; >- default: >- break; >- } >- >- return static_cast<GtkStateFlags>(stateFlags); >-} >- >-void RenderThemeGtk::adjustButtonStyle(RenderStyle& style, const Element*) const >-{ >- // Some layout tests check explicitly that buttons ignore line-height. >- if (style.appearance() == PushButtonPart) >- style.setLineHeight(RenderStyle::initialLineHeight()); >-} >- >-static void shrinkToMinimumSizeAndCenterRectangle(FloatRect& rect, const IntSize& minSize) >-{ >- if (rect.width() > minSize.width()) { >- rect.inflateX(-(rect.width() - minSize.width()) / 2); >- rect.setWidth(minSize.width()); // In case rect.width() was equal to minSize.width() + 1. >- } >- >- if (rect.height() > minSize.height()) { >- rect.inflateY(-(rect.height() - minSize.height()) / 2); >- rect.setHeight(minSize.height()); // In case rect.height() was equal to minSize.height() + 1. >- } >-} >- >-static void setToggleSize(RenderThemePart themePart, RenderStyle& style) >-{ >- ASSERT(themePart == CheckButton || themePart == RadioButton); >- >- // The width and height are both specified, so we shouldn't change them. >- if (!style.width().isIntrinsicOrAuto() && !style.height().isAuto()) >- return; >- >- auto& toggleWidget = static_cast<RenderThemeToggleButton&>(RenderThemeWidget::getOrCreate(themePart == CheckButton ? RenderThemeWidget::Type::CheckButton : RenderThemeWidget::Type::RadioButton)); >- toggleWidget.button().setState(GTK_STATE_FLAG_NORMAL); >- toggleWidget.toggle().setState(GTK_STATE_FLAG_NORMAL); >- IntSize preferredSize = toggleWidget.button().preferredSize(); >- preferredSize = preferredSize.expandedTo(toggleWidget.toggle().preferredSize()); >- >- if (style.width().isIntrinsicOrAuto()) >- style.setWidth(Length(preferredSize.width(), Fixed)); >- >- if (style.height().isAuto()) >- style.setHeight(Length(preferredSize.height(), Fixed)); >-} >- >-static void paintToggle(const RenderThemeGtk* theme, RenderThemePart themePart, const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& fullRect) >-{ >- ASSERT(themePart == CheckButton || themePart == RadioButton); >- >- auto& toggleWidget = static_cast<RenderThemeToggleButton&>(RenderThemeWidget::getOrCreate(themePart == CheckButton ? RenderThemeWidget::Type::CheckButton : RenderThemeWidget::Type::RadioButton)); >- auto toggleState = themePartStateFlags(*theme, themePart, renderObject); >- toggleWidget.button().setState(toggleState); >- toggleWidget.toggle().setState(toggleState); >- >- FloatRect rect = fullRect; >- // Some themes do not render large toggle buttons properly, so we simply >- // shrink the rectangle back down to the default size and then center it >- // in the full toggle button region. The reason for not simply forcing toggle >- // buttons to be a smaller size is that we don't want to break site layouts. >- IntSize preferredSize = toggleWidget.button().preferredSize(); >- preferredSize = preferredSize.expandedTo(toggleWidget.toggle().preferredSize()); >- shrinkToMinimumSizeAndCenterRectangle(rect, preferredSize); >- toggleWidget.button().render(paintInfo.context().platformContext()->cr(), rect); >- toggleWidget.toggle().render(paintInfo.context().platformContext()->cr(), rect); >- >- if (theme->isFocused(renderObject)) >- toggleWidget.button().renderFocus(paintInfo.context().platformContext()->cr(), rect); >-} >- >-void RenderThemeGtk::setCheckboxSize(RenderStyle& style) const >-{ >- setToggleSize(CheckButton, style); >-} >- >-bool RenderThemeGtk::paintCheckbox(const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect) >-{ >- paintToggle(this, CheckButton, renderObject, paintInfo, rect); >- return false; >-} >- >-void RenderThemeGtk::setRadioSize(RenderStyle& style) const >-{ >- setToggleSize(RadioButton, style); >-} >- >-bool RenderThemeGtk::paintRadio(const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect) >-{ >- paintToggle(this, RadioButton, renderObject, paintInfo, rect); >- return false; >-} >- >-bool RenderThemeGtk::paintButton(const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect) >-{ >- auto& buttonWidget = static_cast<RenderThemeButton&>(RenderThemeWidget::getOrCreate(isDefault(renderObject) ? RenderThemeWidget::Type::ButtonDefault : RenderThemeWidget::Type::Button)); >- buttonWidget.button().setState(themePartStateFlags(*this, Button, renderObject)); >- buttonWidget.button().render(paintInfo.context().platformContext()->cr(), rect); >- if (isFocused(renderObject)) >- buttonWidget.button().renderFocus(paintInfo.context().platformContext()->cr(), rect); >- return false; >-} >- >-static Color menuListColor(const Element* element) >-{ >- auto& comboWidget = static_cast<RenderThemeComboBox&>(RenderThemeWidget::getOrCreate(RenderThemeWidget::Type::ComboBox)); >- GtkStateFlags state = element->isDisabledFormControl() ? GTK_STATE_FLAG_INSENSITIVE : GTK_STATE_FLAG_NORMAL; >- comboWidget.comboBox().setState(state); >- comboWidget.button().setState(state); >- return comboWidget.button().color(); >-} >- >-void RenderThemeGtk::adjustMenuListStyle(RenderStyle& style, const Element* element) const >-{ >- // The tests check explicitly that select menu buttons ignore line height. >- style.setLineHeight(RenderStyle::initialLineHeight()); >- >- // We cannot give a proper rendering when border radius is active, unfortunately. >- style.resetBorderRadius(); >- >- if (element) >- style.setColor(menuListColor(element)); >-} >- >-void RenderThemeGtk::adjustMenuListButtonStyle(RenderStyle& style, const Element* e) const >-{ >- adjustMenuListStyle(style, e); >-} >- >-/* >- * GtkComboBox gadgets tree >- * >- * combobox >- * âââ box.linked >- * â â°ââ button.combo >- * â â°ââ box >- * â âââ cellview >- * â â°ââ arrow >- * â°ââ window.popup >- */ >-LengthBox RenderThemeGtk::popupInternalPaddingBox(const RenderStyle& style) const >-{ >- if (style.appearance() == NoControlPart) >- return LengthBox(0); >- >- auto& comboWidget = static_cast<RenderThemeComboBox&>(RenderThemeWidget::getOrCreate(RenderThemeWidget::Type::ComboBox)); >- comboWidget.comboBox().setState(GTK_STATE_FLAG_NORMAL); >- comboWidget.button().setState(GTK_STATE_FLAG_NORMAL); >- comboWidget.arrow().setState(GTK_STATE_FLAG_NORMAL); >- GtkBorder comboContentsBox = comboWidget.comboBox().contentsBox(); >- GtkBorder boxContentsBox = comboWidget.box().contentsBox(); >- GtkBorder buttonContentsBox = comboWidget.button().contentsBox(); >- GtkBorder buttonBoxContentsBox = comboWidget.buttonBox().contentsBox(); >- GtkBorder padding; >- padding.left = comboContentsBox.left + boxContentsBox.left + buttonContentsBox.left + buttonBoxContentsBox.left; >- padding.right = comboContentsBox.right + boxContentsBox.right + buttonContentsBox.right + buttonBoxContentsBox.right; >- padding.top = comboContentsBox.top + boxContentsBox.top + buttonContentsBox.top + buttonBoxContentsBox.top; >- padding.bottom = comboContentsBox.bottom + boxContentsBox.bottom + buttonContentsBox.bottom + buttonBoxContentsBox.bottom; >- >- auto arrowSize = comboWidget.arrow().preferredSize(); >- return LengthBox(padding.top, padding.right + (style.direction() == TextDirection::LTR ? arrowSize.width() : 0), >- padding.bottom, padding.left + (style.direction() == TextDirection::RTL ? arrowSize.width() : 0)); >-} >- >-bool RenderThemeGtk::paintMenuList(const RenderObject& renderObject, const PaintInfo& paintInfo, const FloatRect& rect) >-{ >- auto& comboWidget = static_cast<RenderThemeComboBox&>(RenderThemeWidget::getOrCreate(RenderThemeWidget::Type::ComboBox)); >- auto comboState = themePartStateFlags(*this, ComboBoxButton, renderObject); >- comboWidget.comboBox().setState(comboState); >- comboWidget.button().setState(comboState); >- comboWidget.arrow().setState(comboState); >- >- cairo_t* cr = paintInfo.context().platformContext()->cr(); >- comboWidget.comboBox().render(cr, rect); >- comboWidget.box().render(cr, rect); >- FloatRect contentsRect; >- comboWidget.button().render(cr, rect, &contentsRect); >- comboWidget.buttonBox().render(cr, contentsRect); >- comboWidget.arrow().render(cr, contentsRect); >- if (isFocused(renderObject)) >- comboWidget.button().renderFocus(cr, rect); >- >- return false; >-} >- >-bool RenderThemeGtk::paintMenuListButtonDecorations(const RenderBox& object, const PaintInfo& info, const FloatRect& rect) >-{ >- return paintMenuList(object, info, rect); >-} >- >-static IntSize spinButtonSize() >-{ >- auto& spinButtonWidget = static_cast<RenderThemeSpinButton&>(RenderThemeWidget::getOrCreate(RenderThemeWidget::Type::SpinButton)); >- spinButtonWidget.spinButton().setState(GTK_STATE_FLAG_NORMAL); >- spinButtonWidget.entry().setState(GTK_STATE_FLAG_NORMAL); >- spinButtonWidget.up().setState(GTK_STATE_FLAG_NORMAL); >- spinButtonWidget.down().setState(GTK_STATE_FLAG_NORMAL); >- >- IntSize preferredSize = spinButtonWidget.spinButton().preferredSize(); >- preferredSize = preferredSize.expandedTo(spinButtonWidget.entry().preferredSize()); >- IntSize upPreferredSize = preferredSize.expandedTo(spinButtonWidget.up().preferredSize()); >- IntSize downPreferredSize = preferredSize.expandedTo(spinButtonWidget.down().preferredSize()); >- >- return IntSize(upPreferredSize.width() + downPreferredSize.width(), std::max(upPreferredSize.height(), downPreferredSize.height())); >-} >- >- >-void RenderThemeGtk::adjustTextFieldStyle(RenderStyle& style, const Element* element) const >-{ >- if (!is<HTMLInputElement>(element) || !shouldHaveSpinButton(downcast<HTMLInputElement>(*element))) >- return; >- >- style.setMinHeight(Length(spinButtonSize().height(), Fixed)); >- >- // The default theme for the GTK+ port uses very wide spin buttons (66px) compared to what other >- // browsers use (~13 px). And unfortunately, most of the web developers won't test how their site >- // renders on WebKitGTK. To ensure that spin buttons don't end up covering the values of the input >- // field, we override the width of the input element and always increment it with the width needed >- // for the spinbutton (when drawing the spinbutton). >- int minimumWidth = style.width().intValue() + spinButtonSize().width(); >- style.setMinWidth(Length(minimumWidth, Fixed)); >-} >- >-bool RenderThemeGtk::paintTextField(const RenderObject& renderObject, const PaintInfo& paintInfo, const FloatRect& rect) >-{ >- if (is<HTMLInputElement>(renderObject.node()) && shouldHaveSpinButton(downcast<HTMLInputElement>(*renderObject.node()))) { >- auto& spinButtonWidget = static_cast<RenderThemeSpinButton&>(RenderThemeWidget::getOrCreate(RenderThemeWidget::Type::SpinButton)); >- auto spinButtonState = themePartStateFlags(*this, Entry, renderObject); >- spinButtonWidget.spinButton().setState(spinButtonState); >- spinButtonWidget.entry().setState(spinButtonState); >- spinButtonWidget.spinButton().render(paintInfo.context().platformContext()->cr(), rect); >- spinButtonWidget.entry().render(paintInfo.context().platformContext()->cr(), rect); >- } else { >- auto& entryWidget = static_cast<RenderThemeEntry&>(RenderThemeWidget::getOrCreate(RenderThemeWidget::Type::Entry)); >- entryWidget.entry().setState(themePartStateFlags(*this, Entry, renderObject)); >- entryWidget.entry().render(paintInfo.context().platformContext()->cr(), rect); >- >-#if ENABLE(DATALIST_ELEMENT) >- if (is<HTMLInputElement>(renderObject.generatingNode())) { >- const auto& input = downcast<HTMLInputElement>(*(renderObject.generatingNode())); >- if (input.list()) >- paintListButtonForInput(renderObject, paintInfo, rect); >- } >-#endif >- } >- return false; >-} >- >-static void adjustSearchFieldIconStyle(RenderThemePart themePart, RenderStyle& style) >-{ >- ASSERT(themePart == EntryIconLeft || themePart == EntryIconRight); >- auto& searchEntryWidget = static_cast<RenderThemeSearchEntry&>(RenderThemeWidget::getOrCreate(RenderThemeWidget::Type::SearchEntry)); >- searchEntryWidget.entry().setState(GTK_STATE_FLAG_NORMAL); >- searchEntryWidget.leftIcon().setState(GTK_STATE_FLAG_NORMAL); >- searchEntryWidget.rightIcon().setState(GTK_STATE_FLAG_NORMAL); >- >- // Get the icon size based on the font size. >- auto& icon = static_cast<RenderThemeIconGadget&>(themePart == EntryIconLeft ? searchEntryWidget.leftIcon() : searchEntryWidget.rightIcon()); >- icon.setIconSize(style.computedFontPixelSize()); >- IntSize preferredSize = icon.preferredSize(); >- GtkBorder contentsBox = searchEntryWidget.entry().contentsBox(); >- if (themePart == EntryIconLeft) >- preferredSize.expand(contentsBox.left, contentsBox.top + contentsBox.bottom); >- else >- preferredSize.expand(contentsBox.right, contentsBox.top + contentsBox.bottom); >- style.setWidth(Length(preferredSize.width(), Fixed)); >- style.setHeight(Length(preferredSize.height(), Fixed)); >-} >- >-bool RenderThemeGtk::paintTextArea(const RenderObject& o, const PaintInfo& i, const FloatRect& r) >-{ >- return paintTextField(o, i, r); >-} >- >-void RenderThemeGtk::adjustSearchFieldResultsButtonStyle(RenderStyle& style, const Element* e) const >-{ >- adjustSearchFieldCancelButtonStyle(style, e); >-} >- >-bool RenderThemeGtk::paintSearchFieldResultsButton(const RenderBox& o, const PaintInfo& i, const IntRect& rect) >-{ >- return paintSearchFieldResultsDecorationPart(o, i, rect); >-} >- >-void RenderThemeGtk::adjustSearchFieldResultsDecorationPartStyle(RenderStyle& style, const Element*) const >-{ >- adjustSearchFieldIconStyle(EntryIconLeft, style); >-} >- >-void RenderThemeGtk::adjustSearchFieldCancelButtonStyle(RenderStyle& style, const Element*) const >-{ >- adjustSearchFieldIconStyle(EntryIconRight, style); >-} >- >-static bool paintSearchFieldIcon(RenderThemeGtk* theme, RenderThemePart themePart, const RenderBox& renderObject, const PaintInfo& paintInfo, const IntRect& rect) >-{ >- ASSERT(themePart == EntryIconLeft || themePart == EntryIconRight); >- auto& searchEntryWidget = static_cast<RenderThemeSearchEntry&>(RenderThemeWidget::getOrCreate(RenderThemeWidget::Type::SearchEntry)); >- searchEntryWidget.entry().setState(themePartStateFlags(*theme, Entry, renderObject)); >- auto& icon = static_cast<RenderThemeIconGadget&>(themePart == EntryIconLeft ? searchEntryWidget.leftIcon() : searchEntryWidget.rightIcon()); >- icon.setState(themePartStateFlags(*theme, themePart, renderObject)); >- icon.setIconSize(renderObject.style().computedFontPixelSize()); >- GtkBorder contentsBox = searchEntryWidget.entry().contentsBox(); >- IntRect iconRect = rect; >- if (themePart == EntryIconLeft) { >- iconRect.move(contentsBox.left, contentsBox.top); >- iconRect.contract(contentsBox.left, contentsBox.top + contentsBox.bottom); >- } else >- iconRect.contract(contentsBox.right, contentsBox.top + contentsBox.bottom); >- return !icon.render(paintInfo.context().platformContext()->cr(), iconRect); >-} >-bool RenderThemeGtk::paintSearchFieldResultsDecorationPart(const RenderBox& renderObject, const PaintInfo& paintInfo, const IntRect& rect) >-{ >- return paintSearchFieldIcon(this, EntryIconLeft, renderObject, paintInfo, rect); >-} >- >-bool RenderThemeGtk::paintSearchFieldCancelButton(const RenderBox& renderObject, const PaintInfo& paintInfo, const IntRect& rect) >-{ >- return paintSearchFieldIcon(this, EntryIconRight, renderObject, paintInfo, rect); >-} >- >-#if ENABLE(DATALIST_ELEMENT) >-void RenderThemeGtk::adjustListButtonStyle(RenderStyle& style, const Element*) const >-{ >- // Add a margin to place the button at end of the input field. >- if (style.isLeftToRightDirection()) >- style.setMarginRight(Length(-4, Fixed)); >- else >- style.setMarginLeft(Length(-4, Fixed)); >-} >- >-void RenderThemeGtk::paintListButtonForInput(const RenderObject& renderObject, const PaintInfo& paintInfo, const FloatRect& rect) >-{ >- // Use a combo box widget to render its arrow. >- auto& comboWidget = static_cast<RenderThemeComboBox&>(RenderThemeWidget::getOrCreate(RenderThemeWidget::Type::ComboBox)); >- comboWidget.arrow().setState(themePartStateFlags(*this, ComboBoxButton, renderObject)); >- >- // But a search entry widget to get the contents rect, since this is a text input field. >- auto& searchEntryWidget = static_cast<RenderThemeSearchEntry&>(RenderThemeWidget::getOrCreate(RenderThemeWidget::Type::SearchEntry)); >- auto& icon = static_cast<RenderThemeIconGadget&>(searchEntryWidget.rightIcon()); >- icon.setIconSize(comboWidget.arrow().preferredSize().width()); >- GtkBorder contentsBox = searchEntryWidget.entry().contentsBox(); >- FloatRect adjustedRect(rect); >- adjustedRect.move(contentsBox.left, contentsBox.top); >- adjustedRect.contract(contentsBox.right + 1, contentsBox.top + contentsBox.bottom); >- comboWidget.arrow().render(paintInfo.context().platformContext()->cr(), adjustedRect); >-} >-#endif >- >-void RenderThemeGtk::adjustSearchFieldStyle(RenderStyle& style, const Element*) const >-{ >- // We cannot give a proper rendering when border radius is active, unfortunately. >- style.resetBorderRadius(); >- style.setLineHeight(RenderStyle::initialLineHeight()); >-} >- >-bool RenderThemeGtk::paintSearchField(const RenderObject& o, const PaintInfo& i, const IntRect& rect) >-{ >- return paintTextField(o, i, rect); >-} >- >-bool RenderThemeGtk::shouldHaveCapsLockIndicator(const HTMLInputElement& element) const >-{ >- return element.isPasswordField(); >-} >- >-void RenderThemeGtk::adjustSliderTrackStyle(RenderStyle& style, const Element*) const >-{ >- style.setBoxShadow(nullptr); >-} >- >-void RenderThemeGtk::adjustSliderThumbStyle(RenderStyle& style, const Element* element) const >-{ >- RenderTheme::adjustSliderThumbStyle(style, element); >- style.setBoxShadow(nullptr); >-} >- >-/* >- * GtkScale >- * >- * scale >- * â°ââ contents >- * â°ââ trough >- * âââ slider >- * â°ââ [highlight] >- */ >-bool RenderThemeGtk::paintSliderTrack(const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect) >-{ >- ControlPart part = renderObject.style().appearance(); >- ASSERT(part == SliderHorizontalPart || part == SliderVerticalPart); >- >- auto& sliderWidget = static_cast<RenderThemeSlider&>(RenderThemeWidget::getOrCreate(part == SliderHorizontalPart ? RenderThemeWidget::Type::HorizontalSlider : RenderThemeWidget::Type::VerticalSlider)); >- auto scaleState = themePartStateFlags(*this, Scale, renderObject); >- auto& scale = sliderWidget.scale(); >- scale.setState(scaleState); >- auto& contents = sliderWidget.contents(); >- auto& trough = sliderWidget.trough(); >- trough.setState(scaleState); >- auto& slider = sliderWidget.slider(); >- auto& highlight = sliderWidget.highlight(); >- >- // The given rectangle is not calculated based on the scale size, but all the margins and paddings are based on it. >- IntSize preferredSize = scale.preferredSize(); >- preferredSize = preferredSize.expandedTo(contents.preferredSize()); >- preferredSize = preferredSize.expandedTo(trough.preferredSize()); >- FloatRect trackRect = rect; >- if (part == SliderHorizontalPart) { >- trackRect.move(0, rect.height() / 2 - (preferredSize.height() / 2)); >- trackRect.setHeight(preferredSize.height()); >- } else { >- trackRect.move(rect.width() / 2 - (preferredSize.width() / 2), 0); >- trackRect.setWidth(preferredSize.width()); >- } >- >- FloatRect contentsRect; >- scale.render(paintInfo.context().platformContext()->cr(), trackRect, &contentsRect); >- contents.render(paintInfo.context().platformContext()->cr(), contentsRect, &contentsRect); >- // Scale trough defines its size querying slider and highlight. >- if (part == SliderHorizontalPart) >- contentsRect.setHeight(trough.preferredSize().height() + std::max(slider.preferredSize().height(), highlight.preferredSize().height())); >- else >- contentsRect.setWidth(trough.preferredSize().width() + std::max(slider.preferredSize().width(), highlight.preferredSize().width())); >- FloatRect troughRect = contentsRect; >- trough.render(paintInfo.context().platformContext()->cr(), troughRect, &contentsRect); >- if (isFocused(renderObject)) >- trough.renderFocus(paintInfo.context().platformContext()->cr(), troughRect); >- >- LayoutPoint thumbLocation; >- if (is<HTMLInputElement>(renderObject.node())) { >- auto& input = downcast<HTMLInputElement>(*renderObject.node()); >- if (auto* element = input.sliderThumbElement()) >- thumbLocation = element->renderBox()->location(); >- } >- >- if (part == SliderHorizontalPart) { >- if (renderObject.style().direction() == TextDirection::RTL) { >- contentsRect.move(thumbLocation.x(), 0); >- contentsRect.setWidth(contentsRect.width() - thumbLocation.x()); >- } else >- contentsRect.setWidth(thumbLocation.x()); >- } else >- contentsRect.setHeight(thumbLocation.y()); >- highlight.render(paintInfo.context().platformContext()->cr(), contentsRect); >- >- return false; >-} >- >-void RenderThemeGtk::adjustSliderThumbSize(RenderStyle& style, const Element*) const >-{ >- ControlPart part = style.appearance(); >- if (part != SliderThumbHorizontalPart && part != SliderThumbVerticalPart) >- return; >- >- auto& sliderWidget = static_cast<RenderThemeSlider&>(RenderThemeWidget::getOrCreate(part == SliderThumbHorizontalPart ? RenderThemeWidget::Type::HorizontalSlider : RenderThemeWidget::Type::VerticalSlider)); >- sliderWidget.scale().setState(GTK_STATE_FLAG_NORMAL); >- sliderWidget.trough().setState(GTK_STATE_FLAG_NORMAL); >- >- IntSize preferredSize = sliderWidget.scale().preferredSize(); >- preferredSize = preferredSize.expandedTo(sliderWidget.contents().preferredSize()); >- preferredSize = preferredSize.expandedTo(sliderWidget.trough().preferredSize()); >- preferredSize = preferredSize.expandedTo(sliderWidget.slider().preferredSize()); >- if (part == SliderThumbHorizontalPart) { >- style.setWidth(Length(preferredSize.width(), Fixed)); >- style.setHeight(Length(preferredSize.height(), Fixed)); >- return; >- } >- ASSERT(part == SliderThumbVerticalPart); >- style.setWidth(Length(preferredSize.height(), Fixed)); >- style.setHeight(Length(preferredSize.width(), Fixed)); >-} >- >-bool RenderThemeGtk::paintSliderThumb(const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect) >-{ >- ControlPart part = renderObject.style().appearance(); >- ASSERT(part == SliderThumbHorizontalPart || part == SliderThumbVerticalPart); >- >- auto& sliderWidget = static_cast<RenderThemeSlider&>(RenderThemeWidget::getOrCreate(part == SliderThumbHorizontalPart ? RenderThemeWidget::Type::HorizontalSlider : RenderThemeWidget::Type::VerticalSlider)); >- auto scaleState = themePartStateFlags(*this, Scale, renderObject); >- auto& scale = sliderWidget.scale(); >- scale.setState(scaleState); >- auto& contents = sliderWidget.contents(); >- auto& trough = sliderWidget.trough(); >- trough.setState(scaleState); >- auto& slider = sliderWidget.slider(); >- slider.setState(themePartStateFlags(*this, ScaleSlider, renderObject)); >- auto& highlight = sliderWidget.highlight(); >- >- GtkBorder scaleContentsBox = scale.contentsBox(); >- GtkBorder contentsContentsBox = contents.contentsBox(); >- GtkBorder troughContentsBox = trough.contentsBox(); >- GtkBorder padding; >- padding.left = scaleContentsBox.left + contentsContentsBox.left + troughContentsBox.left; >- padding.right = scaleContentsBox.right + contentsContentsBox.right + troughContentsBox.right; >- padding.top = scaleContentsBox.top + contentsContentsBox.top + troughContentsBox.top; >- padding.bottom = scaleContentsBox.bottom + contentsContentsBox.bottom + troughContentsBox.bottom; >- >- // Scale trough defines its size querying slider and highlight. >- int troughHeight = trough.preferredSize().height() + std::max(slider.preferredSize().height(), highlight.preferredSize().height()); >- IntRect sliderRect(rect.location(), IntSize(troughHeight, troughHeight)); >- sliderRect.move(padding.left, padding.top); >- sliderRect.contract(padding.left + padding.right, padding.top + padding.bottom); >- slider.render(paintInfo.context().platformContext()->cr(), sliderRect); >- return false; >-} >- >-IntRect RenderThemeGtk::progressBarRectForBounds(const RenderObject& renderObject, const IntRect& bounds) const >-{ >- const auto& renderProgress = downcast<RenderProgress>(renderObject); >- auto& progressBarWidget = static_cast<RenderThemeProgressBar&>(RenderThemeWidget::getOrCreate(renderProgress.isDeterminate() ? RenderThemeProgressBar::Type::ProgressBar : RenderThemeProgressBar::Type::IndeterminateProgressBar)); >- IntSize preferredSize = progressBarWidget.progressBar().preferredSize(); >- preferredSize = preferredSize.expandedTo(progressBarWidget.trough().preferredSize()); >- preferredSize = preferredSize.expandedTo(progressBarWidget.progress().preferredSize()); >- return IntRect(bounds.x(), bounds.y(), bounds.width(), preferredSize.height()); >-} >- >-bool RenderThemeGtk::paintProgressBar(const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect) >-{ >- if (!renderObject.isProgress()) >- return true; >- >- const auto& renderProgress = downcast<RenderProgress>(renderObject); >- auto& progressBarWidget = static_cast<RenderThemeProgressBar&>(RenderThemeWidget::getOrCreate(renderProgress.isDeterminate() ? RenderThemeProgressBar::Type::ProgressBar : RenderThemeProgressBar::Type::IndeterminateProgressBar)); >- progressBarWidget.progressBar().render(paintInfo.context().platformContext()->cr(), rect); >- progressBarWidget.trough().render(paintInfo.context().platformContext()->cr(), rect); >- progressBarWidget.progress().render(paintInfo.context().platformContext()->cr(), calculateProgressRect(renderObject, rect)); >- return false; >-} >- >-RenderTheme::InnerSpinButtonLayout RenderThemeGtk::innerSpinButtonLayout(const RenderObject& renderObject) const >-{ >- return renderObject.style().direction() == TextDirection::RTL ? InnerSpinButtonLayout::HorizontalUpLeft : InnerSpinButtonLayout::HorizontalUpRight; >-} >- >-void RenderThemeGtk::adjustInnerSpinButtonStyle(RenderStyle& style, const Element*) const >-{ >- style.setWidth(Length(spinButtonSize().width(), Fixed)); >- style.setHeight(Length(spinButtonSize().height(), Fixed)); >-} >- >-bool RenderThemeGtk::paintInnerSpinButton(const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect) >-{ >- auto& spinButtonWidget = static_cast<RenderThemeSpinButton&>(RenderThemeWidget::getOrCreate(RenderThemeWidget::Type::SpinButton)); >- auto spinButtonState = themePartStateFlags(*this, SpinButton, renderObject); >- spinButtonWidget.spinButton().setState(spinButtonState); >- spinButtonWidget.entry().setState(spinButtonState); >- auto& up = spinButtonWidget.up(); >- up.setState(themePartStateFlags(*this, SpinButtonUpButton, renderObject)); >- auto& down = spinButtonWidget.down(); >- down.setState(themePartStateFlags(*this, SpinButtonDownButton, renderObject)); >- >- IntRect iconRect = rect; >- iconRect.setWidth(iconRect.width() / 2); >- if (renderObject.style().direction() == TextDirection::RTL) >- up.render(paintInfo.context().platformContext()->cr(), iconRect); >- else >- down.render(paintInfo.context().platformContext()->cr(), iconRect); >- iconRect.move(iconRect.width(), 0); >- if (renderObject.style().direction() == TextDirection::RTL) >- down.render(paintInfo.context().platformContext()->cr(), iconRect); >- else >- up.render(paintInfo.context().platformContext()->cr(), iconRect); >- >- return false; >-} >- > Seconds RenderThemeGtk::caretBlinkInterval() const > { >- GtkSettings* settings = gtk_settings_get_default(); >- > gboolean shouldBlink; > gint time; >- >- g_object_get(settings, "gtk-cursor-blink", &shouldBlink, "gtk-cursor-blink-time", &time, nullptr); >- >- if (!shouldBlink) >- return 0_s; >- >- return 500_us * time; >-} >- >-enum StyleColorType { StyleColorBackground, StyleColorForeground }; >- >-static Color styleColor(RenderThemePart themePart, GtkStateFlags state, StyleColorType colorType) >-{ >- RenderThemeGadget* gadget = nullptr; >- switch (themePart) { >- default: >- ASSERT_NOT_REACHED(); >- FALLTHROUGH; >- case Entry: >- gadget = &static_cast<RenderThemeEntry&>(RenderThemeWidget::getOrCreate(RenderThemeWidget::Type::Entry)).entry(); >- break; >- case EntrySelection: >- gadget = static_cast<RenderThemeEntry&>(RenderThemeWidget::getOrCreate(RenderThemeWidget::Type::SelectedEntry)).selection(); >- break; >- case ListBox: >- gadget = &static_cast<RenderThemeListView&>(RenderThemeWidget::getOrCreate(RenderThemeWidget::Type::ListView)).treeview(); >- break; >- case Button: >- gadget = &static_cast<RenderThemeButton&>(RenderThemeWidget::getOrCreate(RenderThemeWidget::Type::Button)).button(); >- break; >- case Window: >- gadget = &static_cast<RenderThemeWindow&>(RenderThemeWidget::getOrCreate(RenderThemeWidget::Type::Window)).window(); >- break; >- } >- >- ASSERT(gadget); >- gadget->setState(state); >- return colorType == StyleColorBackground ? gadget->backgroundColor() : gadget->color(); >-} >- >-Color RenderThemeGtk::platformActiveSelectionBackgroundColor(OptionSet<StyleColor::Options>) const >-{ >- return styleColor(EntrySelection, static_cast<GtkStateFlags>(GTK_STATE_FLAG_SELECTED | GTK_STATE_FLAG_FOCUSED), StyleColorBackground); >+ g_object_get(gtk_settings_get_default(), "gtk-cursor-blink", &shouldBlink, "gtk-cursor-blink-time", &time, nullptr); >+ return shouldBlink ? 500_us * time : 0_s; > } > >-Color RenderThemeGtk::platformInactiveSelectionBackgroundColor(OptionSet<StyleColor::Options>) const >-{ >- return styleColor(EntrySelection, GTK_STATE_FLAG_SELECTED, StyleColorBackground); >-} >- >-Color RenderThemeGtk::platformActiveSelectionForegroundColor(OptionSet<StyleColor::Options>) const >-{ >- return styleColor(EntrySelection, static_cast<GtkStateFlags>(GTK_STATE_FLAG_SELECTED | GTK_STATE_FLAG_FOCUSED), StyleColorForeground); >-} >- >-Color RenderThemeGtk::platformInactiveSelectionForegroundColor(OptionSet<StyleColor::Options>) const >-{ >- return styleColor(EntrySelection, GTK_STATE_FLAG_SELECTED, StyleColorForeground); >-} >- >-Color RenderThemeGtk::platformActiveListBoxSelectionBackgroundColor(OptionSet<StyleColor::Options>) const >-{ >- return styleColor(ListBox, static_cast<GtkStateFlags>(GTK_STATE_FLAG_SELECTED | GTK_STATE_FLAG_FOCUSED), StyleColorBackground); >-} >- >-Color RenderThemeGtk::platformInactiveListBoxSelectionBackgroundColor(OptionSet<StyleColor::Options>) const >-{ >- return styleColor(ListBox, GTK_STATE_FLAG_SELECTED, StyleColorBackground); >-} >- >-Color RenderThemeGtk::platformActiveListBoxSelectionForegroundColor(OptionSet<StyleColor::Options>) const >-{ >- return styleColor(ListBox, static_cast<GtkStateFlags>(GTK_STATE_FLAG_SELECTED | GTK_STATE_FLAG_FOCUSED), StyleColorForeground); >-} >- >-Color RenderThemeGtk::platformInactiveListBoxSelectionForegroundColor(OptionSet<StyleColor::Options>) const >-{ >- return styleColor(ListBox, GTK_STATE_FLAG_SELECTED, StyleColorForeground); >-} >- >-Color RenderThemeGtk::disabledTextColor(const Color&, const Color&) const >-{ >- return styleColor(Entry, GTK_STATE_FLAG_INSENSITIVE, StyleColorForeground); >-} >- >-Color RenderThemeGtk::systemColor(CSSValueID cssValueId, OptionSet<StyleColor::Options> options) const >-{ >- switch (cssValueId) { >- case CSSValueButtontext: >- return styleColor(Button, GTK_STATE_FLAG_ACTIVE, StyleColorForeground); >- case CSSValueCaptiontext: >- return styleColor(Entry, GTK_STATE_FLAG_ACTIVE, StyleColorForeground); >- case CSSValueText: >- return styleColor(Entry, GTK_STATE_FLAG_ACTIVE, StyleColorForeground); >- case CSSValueGraytext: >- return styleColor(Entry, GTK_STATE_FLAG_INSENSITIVE, StyleColorForeground); >- default: >- break; >- } >- >- return RenderTheme::systemColor(cssValueId, options); >-} >- >-void RenderThemeGtk::platformColorsDidChange() >-{ >- RenderTheme::platformColorsDidChange(); >-} >- >-#if ENABLE(VIDEO) >-String RenderThemeGtk::extraMediaControlsStyleSheet() >-{ >- return String(mediaControlsGtkUserAgentStyleSheet, sizeof(mediaControlsGtkUserAgentStyleSheet)); >-} >- >-#if ENABLE(FULLSCREEN_API) >-String RenderThemeGtk::extraFullScreenStyleSheet() >-{ >- return String(); >-} >-#endif >- >-bool RenderThemeGtk::paintMediaButton(const RenderObject& renderObject, GraphicsContext& graphicsContext, const IntRect& rect, const char* iconName) >-{ >- auto& iconWidget = static_cast<RenderThemeIcon&>(RenderThemeWidget::getOrCreate(RenderThemeWidget::Type::Icon)); >- auto& icon = static_cast<RenderThemeIconGadget&>(iconWidget.icon()); >- icon.setState(themePartStateFlags(*this, MediaButton, renderObject)); >- icon.setIconSize(RenderThemeIconGadget::IconSizeGtk::Menu); >- icon.setIconName(iconName); >- return !icon.render(graphicsContext.platformContext()->cr(), rect); >-} >- >-bool RenderThemeGtk::hasOwnDisabledStateHandlingFor(ControlPart part) const >-{ >- return (part != MediaMuteButtonPart); >-} >- >-bool RenderThemeGtk::paintMediaFullscreenButton(const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect) >-{ >- return paintMediaButton(renderObject, paintInfo.context(), rect, "view-fullscreen-symbolic"); >-} >- >-bool RenderThemeGtk::paintMediaMuteButton(const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect) >-{ >- Node* node = renderObject.node(); >- if (!node) >- return true; >- Node* mediaNode = node->shadowHost(); >- if (!is<HTMLMediaElement>(mediaNode)) >- return true; >- >- HTMLMediaElement* mediaElement = downcast<HTMLMediaElement>(mediaNode); >- return paintMediaButton(renderObject, paintInfo.context(), rect, mediaElement->muted() ? "audio-volume-muted-symbolic" : "audio-volume-high-symbolic"); >-} >- >-bool RenderThemeGtk::paintMediaPlayButton(const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect) >-{ >- Node* node = renderObject.node(); >- if (!node) >- return true; >- if (!nodeHasPseudo(*node, "-webkit-media-controls-play-button")) >- return true; >- >- return paintMediaButton(renderObject, paintInfo.context(), rect, nodeHasClass(node, "paused") ? "media-playback-start-symbolic" : "media-playback-pause-symbolic"); >-} >- >-bool RenderThemeGtk::paintMediaSeekBackButton(const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect) >-{ >- return paintMediaButton(renderObject, paintInfo.context(), rect, "media-seek-backward-symbolic"); >-} >- >-bool RenderThemeGtk::paintMediaSeekForwardButton(const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect) >-{ >- return paintMediaButton(renderObject, paintInfo.context(), rect, "media-seek-forward-symbolic"); >-} >- >-#if ENABLE(VIDEO_TRACK) >-bool RenderThemeGtk::paintMediaToggleClosedCaptionsButton(const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect) >-{ >- return paintMediaButton(renderObject, paintInfo.context(), rect, "media-view-subtitles-symbolic"); >-} >-#endif >- >-static FloatRoundedRect::Radii borderRadiiFromStyle(const RenderStyle& style) >-{ >- return FloatRoundedRect::Radii( >- IntSize(style.borderTopLeftRadius().width.intValue(), style.borderTopLeftRadius().height.intValue()), >- IntSize(style.borderTopRightRadius().width.intValue(), style.borderTopRightRadius().height.intValue()), >- IntSize(style.borderBottomLeftRadius().width.intValue(), style.borderBottomLeftRadius().height.intValue()), >- IntSize(style.borderBottomRightRadius().width.intValue(), style.borderBottomRightRadius().height.intValue())); >-} >- >-bool RenderThemeGtk::paintMediaSliderTrack(const RenderObject& o, const PaintInfo& paintInfo, const IntRect& r) >-{ >- auto mediaElement = parentMediaElement(o); >- if (!mediaElement) >- return true; >- >- GraphicsContext& context = paintInfo.context(); >- context.save(); >- context.setStrokeStyle(NoStroke); >- >- float mediaDuration = mediaElement->duration(); >- float totalTrackWidth = r.width(); >- auto& style = o.style(); >- RefPtr<TimeRanges> timeRanges = mediaElement->buffered(); >- for (unsigned index = 0; index < timeRanges->length(); ++index) { >- float start = timeRanges->start(index).releaseReturnValue(); >- float end = timeRanges->end(index).releaseReturnValue(); >- float startRatio = start / mediaDuration; >- float lengthRatio = (end - start) / mediaDuration; >- if (!lengthRatio) >- continue; >- >- IntRect rangeRect(r); >- rangeRect.setWidth(lengthRatio * totalTrackWidth); >- if (index) >- rangeRect.move(startRatio * totalTrackWidth, 0); >- context.fillRoundedRect(FloatRoundedRect(rangeRect, borderRadiiFromStyle(style)), style.visitedDependentColor(CSSPropertyColor)); >- } >- >- context.restore(); >- return false; >-} >- >-bool RenderThemeGtk::paintMediaSliderThumb(const RenderObject& o, const PaintInfo& paintInfo, const IntRect& r) >-{ >- auto& style = o.style(); >- paintInfo.context().fillRoundedRect(FloatRoundedRect(r, borderRadiiFromStyle(style)), style.visitedDependentColor(CSSPropertyColor)); >- return false; >-} >- >-bool RenderThemeGtk::paintMediaVolumeSliderTrack(const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect) >-{ >- auto mediaElement = parentMediaElement(renderObject); >- if (!mediaElement) >- return true; >- >- float volume = mediaElement->muted() ? 0.0f : mediaElement->volume(); >- if (!volume) >- return true; >- >- GraphicsContext& context = paintInfo.context(); >- context.save(); >- context.setStrokeStyle(NoStroke); >- >- int rectHeight = rect.height(); >- float trackHeight = rectHeight * volume; >- auto& style = renderObject.style(); >- IntRect volumeRect(rect); >- volumeRect.move(0, rectHeight - trackHeight); >- volumeRect.setHeight(ceil(trackHeight)); >- >- context.fillRoundedRect(FloatRoundedRect(volumeRect, borderRadiiFromStyle(style)), style.visitedDependentColor(CSSPropertyColor)); >- context.restore(); >- >- return false; >-} >- >-bool RenderThemeGtk::paintMediaVolumeSliderThumb(const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect) >-{ >- return paintMediaSliderThumb(renderObject, paintInfo, rect); >-} >- >-String RenderThemeGtk::formatMediaControlsCurrentTime(float currentTime, float duration) const >-{ >- return formatMediaControlsTime(currentTime) + " / " + formatMediaControlsTime(duration); >-} >- >-bool RenderThemeGtk::paintMediaCurrentTime(const RenderObject&, const PaintInfo&, const IntRect&) >-{ >- return false; >-} >-#endif >- >-void RenderThemeGtk::adjustProgressBarStyle(RenderStyle& style, const Element*) const >-{ >- style.setBoxShadow(nullptr); >-} >- >-// These values have been copied from RenderThemeChromiumSkia.cpp >-static const int progressActivityBlocks = 5; >-static const int progressAnimationFrames = 10; >-static const Seconds progressAnimationInterval { 125_ms }; >-Seconds RenderThemeGtk::animationRepeatIntervalForProgressBar(RenderProgress&) const >-{ >- return progressAnimationInterval; >-} >- >-Seconds RenderThemeGtk::animationDurationForProgressBar(RenderProgress&) const >-{ >- return progressAnimationInterval * progressAnimationFrames * 2; // "2" for back and forth; >-} >- >-IntRect RenderThemeGtk::calculateProgressRect(const RenderObject& renderObject, const IntRect& fullBarRect) >-{ >- IntRect progressRect(fullBarRect); >- const auto& renderProgress = downcast<RenderProgress>(renderObject); >- if (renderProgress.isDeterminate()) { >- int progressWidth = progressRect.width() * renderProgress.position(); >- if (renderObject.style().direction() == TextDirection::RTL) >- progressRect.setX(progressRect.x() + progressRect.width() - progressWidth); >- progressRect.setWidth(progressWidth); >- return progressRect; >- } >- >- double animationProgress = renderProgress.animationProgress(); >- >- // Never let the progress rect shrink smaller than 2 pixels. >- int newWidth = std::max(2, progressRect.width() / progressActivityBlocks); >- int movableWidth = progressRect.width() - newWidth; >- progressRect.setWidth(newWidth); >- >- // We want the first 0.5 units of the animation progress to represent the >- // forward motion and the second 0.5 units to represent the backward motion, >- // thus we multiply by two here to get the full sweep of the progress bar with >- // each direction. >- if (animationProgress < 0.5) >- progressRect.setX(progressRect.x() + (animationProgress * 2 * movableWidth)); >- else >- progressRect.setX(progressRect.x() + ((1.0 - animationProgress) * 2 * movableWidth)); >- return progressRect; >-} >- >-String RenderThemeGtk::fileListNameForWidth(const FileList* fileList, const FontCascade& font, int width, bool multipleFilesAllowed) const >-{ >- if (width <= 0) >- return String(); >- >- if (fileList->length() > 1) >- return StringTruncator::rightTruncate(multipleFileUploadText(fileList->length()), width, font); >- >- String string; >- if (fileList->length()) >- string = FileSystem::pathGetFileName(fileList->item(0)->path()); >- else if (multipleFilesAllowed) >- string = fileButtonNoFilesSelectedLabel(); >- else >- string = fileButtonNoFileSelectedLabel(); >- >- return StringTruncator::centerTruncate(string, width, font); >-} >- >-#if ENABLE(VIDEO) >-String RenderThemeGtk::mediaControlsScript() >-{ >- StringBuilder scriptBuilder; >- scriptBuilder.appendCharacters(mediaControlsLocalizedStringsJavaScript, sizeof(mediaControlsLocalizedStringsJavaScript)); >- scriptBuilder.appendCharacters(mediaControlsBaseJavaScript, sizeof(mediaControlsBaseJavaScript)); >- scriptBuilder.appendCharacters(mediaControlsGtkJavaScript, sizeof(mediaControlsGtkJavaScript)); >- return scriptBuilder.toString(); >-} >-#endif // ENABLE(VIDEO) >-} >+} // namespace WebCore >diff --git a/Source/WebCore/rendering/RenderThemeGtk.h b/Source/WebCore/rendering/RenderThemeGtk.h >index 87c3aad58ba..aa0b3957a4b 100644 >--- a/Source/WebCore/rendering/RenderThemeGtk.h >+++ b/Source/WebCore/rendering/RenderThemeGtk.h >@@ -1,12 +1,5 @@ > /* >- * This file is part of the WebKit project. >- * >- * Copyright (C) 2006 Apple Inc. >- * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com >- * Copyright (C) 2007 Holger Hans Peter Freyther >- * Copyright (C) 2007 Alp Toker <alp@atoker.com> >- * Copyright (C) 2010 Igalia S.L. >- * All rights reserved. >+ * Copyright (C) 2020 Igalia S.L. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -27,170 +20,16 @@ > > #pragma once > >-#include "RenderTheme.h" >+#include "RenderThemeAdwaita.h" > > namespace WebCore { > >-class RenderThemeGtk final : public RenderTheme { >-public: >- friend NeverDestroyed<RenderThemeGtk>; >- >-#if ENABLE(DATALIST_ELEMENT) >- // Returns size of one slider tick mark for a horizontal track. >- // For vertical tracks we rotate it and use it. i.e. Width is always length along the track. >- IntSize sliderTickSize() const override; >- // Returns the distance of slider tick origin from the slider track center. >- int sliderTickOffsetFromTrackCenter() const override; >-#endif >- >+class RenderThemeGtk final : public RenderThemeAdwaita { > private: >- // System fonts. >- void updateCachedSystemFontDescription(CSSValueID, FontCascadeDescription&) const override; >- >-public: >- // A method asking if the theme's controls actually care about redrawing when hovered. >- bool supportsHover(const RenderStyle&) const override { return true; } >- >- // A method asking if the theme is able to draw the focus ring. >- bool supportsFocusRing(const RenderStyle&) const override; >- >- // A method asking if the control changes its tint when the window has focus or not. >- bool controlSupportsTints(const RenderObject&) const override; >- >- // A general method asking if any control tinting is supported at all. >- bool supportsControlTints() const override { return true; } >- >- void adjustRepaintRect(const RenderObject&, FloatRect&) override; >- >- // A method to obtain the baseline position for a "leaf" control. This will only be used if a baseline >- // position cannot be determined by examining child content. Checkboxes and radio buttons are examples of >- // controls that need to do this. >- int baselinePosition(const RenderBox&) const override; >- >- // The platform selection color. >- Color platformActiveSelectionBackgroundColor(OptionSet<StyleColor::Options>) const override; >- Color platformInactiveSelectionBackgroundColor(OptionSet<StyleColor::Options>) const override; >- Color platformActiveSelectionForegroundColor(OptionSet<StyleColor::Options>) const override; >- Color platformInactiveSelectionForegroundColor(OptionSet<StyleColor::Options>) const override; >- >- // List Box selection color >- Color platformActiveListBoxSelectionBackgroundColor(OptionSet<StyleColor::Options>) const override; >- Color platformActiveListBoxSelectionForegroundColor(OptionSet<StyleColor::Options>) const override; >- Color platformInactiveListBoxSelectionBackgroundColor(OptionSet<StyleColor::Options>) const override; >- Color platformInactiveListBoxSelectionForegroundColor(OptionSet<StyleColor::Options>) const override; >- >- Color disabledTextColor(const Color&, const Color&) const override; >+ virtual ~RenderThemeGtk() = default; > >+ void updateCachedSystemFontDescription(CSSValueID, FontCascadeDescription&) const override; > Seconds caretBlinkInterval() const override; >- >- void platformColorsDidChange() override; >- >- // System colors. >- Color systemColor(CSSValueID, OptionSet<StyleColor::Options>) const override; >- >- bool popsMenuBySpaceOrReturn() const override { return true; } >- >-#if ENABLE(VIDEO) >- String extraMediaControlsStyleSheet() override; >- String formatMediaControlsCurrentTime(float currentTime, float duration) const override; >- bool supportsClosedCaptioning() const override { return true; } >- String mediaControlsScript() override; >- >-#if ENABLE(FULLSCREEN_API) >- String extraFullScreenStyleSheet() override; >-#endif >-#endif >- >- bool shouldHaveCapsLockIndicator(const HTMLInputElement&) const override; >- >-private: >- virtual ~RenderThemeGtk(); >- >- bool paintCheckbox(const RenderObject&, const PaintInfo&, const IntRect&) override; >- void setCheckboxSize(RenderStyle&) const override; >- >- bool paintRadio(const RenderObject&, const PaintInfo&, const IntRect&) override; >- void setRadioSize(RenderStyle&) const override; >- >- void adjustButtonStyle(RenderStyle&, const Element*) const override; >- bool paintButton(const RenderObject&, const PaintInfo&, const IntRect&) override; >- >- void adjustTextFieldStyle(RenderStyle&, const Element*) const override; >- bool paintTextField(const RenderObject&, const PaintInfo&, const FloatRect&) override; >- bool paintTextArea(const RenderObject&, const PaintInfo&, const FloatRect&) override; >- >- LengthBox popupInternalPaddingBox(const RenderStyle&) const override; >- >- // The Mac port differentiates between the "menu list" and the "menu list button." >- // The former is used when a menu list button has been styled. This is used to ensure >- // Aqua themed controls whenever possible. We always want to use GTK+ theming, so >- // we don't maintain this differentiation. >- void adjustMenuListStyle(RenderStyle&, const Element*) const override; >- void adjustMenuListButtonStyle(RenderStyle&, const Element*) const override; >- bool paintMenuList(const RenderObject&, const PaintInfo&, const FloatRect&) override; >- bool paintMenuListButtonDecorations(const RenderBox&, const PaintInfo&, const FloatRect&) override; >- >- void adjustSearchFieldResultsDecorationPartStyle(RenderStyle&, const Element*) const override; >- bool paintSearchFieldResultsDecorationPart(const RenderBox&, const PaintInfo&, const IntRect&) override; >- >- void adjustSearchFieldStyle(RenderStyle&, const Element*) const override; >- bool paintSearchField(const RenderObject&, const PaintInfo&, const IntRect&) override; >- >- void adjustSearchFieldResultsButtonStyle(RenderStyle&, const Element*) const override; >- bool paintSearchFieldResultsButton(const RenderBox&, const PaintInfo&, const IntRect&) override; >- >- void adjustSearchFieldCancelButtonStyle(RenderStyle&, const Element*) const override; >- bool paintSearchFieldCancelButton(const RenderBox&, const PaintInfo&, const IntRect&) override; >- >-#if ENABLE(DATALIST_ELEMENT) >- void paintListButtonForInput(const RenderObject&, const PaintInfo&, const FloatRect&); >- void adjustListButtonStyle(RenderStyle&, const Element*) const override; >-#endif >- >- bool paintSliderTrack(const RenderObject&, const PaintInfo&, const IntRect&) override; >- void adjustSliderTrackStyle(RenderStyle&, const Element*) const override; >- >- bool paintSliderThumb(const RenderObject&, const PaintInfo&, const IntRect&) override; >- void adjustSliderThumbStyle(RenderStyle&, const Element*) const override; >- >- void adjustSliderThumbSize(RenderStyle&, const Element*) const override; >- >-#if ENABLE(VIDEO) >- bool hasOwnDisabledStateHandlingFor(ControlPart) const override; >- bool paintMediaFullscreenButton(const RenderObject&, const PaintInfo&, const IntRect&) override; >- bool paintMediaPlayButton(const RenderObject&, const PaintInfo&, const IntRect&) override; >- bool paintMediaMuteButton(const RenderObject&, const PaintInfo&, const IntRect&) override; >- bool paintMediaSeekBackButton(const RenderObject&, const PaintInfo&, const IntRect&) override; >- bool paintMediaSeekForwardButton(const RenderObject&, const PaintInfo&, const IntRect&) override; >- bool paintMediaSliderTrack(const RenderObject&, const PaintInfo&, const IntRect&) override; >- bool paintMediaSliderThumb(const RenderObject&, const PaintInfo&, const IntRect&) override; >- bool paintMediaVolumeSliderTrack(const RenderObject&, const PaintInfo&, const IntRect&) override; >- bool paintMediaVolumeSliderThumb(const RenderObject&, const PaintInfo&, const IntRect&) override; >- bool paintMediaCurrentTime(const RenderObject&, const PaintInfo&, const IntRect&) override; >-#if ENABLE(VIDEO_TRACK) >- bool paintMediaToggleClosedCaptionsButton(const RenderObject&, const PaintInfo&, const IntRect&) override; >-#endif >-#endif >- >- Seconds animationRepeatIntervalForProgressBar(RenderProgress&) const override; >- Seconds animationDurationForProgressBar(RenderProgress&) const override; >- void adjustProgressBarStyle(RenderStyle&, const Element*) const override; >- IntRect progressBarRectForBounds(const RenderObject&, const IntRect&) const override; >- bool paintProgressBar(const RenderObject&, const PaintInfo&, const IntRect&) override; >- >- InnerSpinButtonLayout innerSpinButtonLayout(const RenderObject&) const override; >- void adjustInnerSpinButtonStyle(RenderStyle&, const Element*) const override; >- bool paintInnerSpinButton(const RenderObject&, const PaintInfo&, const IntRect&) override; >- >- String fileListNameForWidth(const FileList*, const FontCascade&, int width, bool multipleFilesAllowed) const override; >- >- static void setTextInputBorders(RenderStyle&); >- >-#if ENABLE(VIDEO) >- bool paintMediaButton(const RenderObject&, GraphicsContext&, const IntRect&, const char* iconName); >-#endif >- >- static IntRect calculateProgressRect(const RenderObject&, const IntRect&); > }; > > } // namespace WebCore >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index a023241e677..b9e3568843a 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,13 @@ >+2020-02-24 Carlos Garcia Campos <cgarcia@igalia.com> >+ >+ [GTK] Stop using gtk foreign drawing API to style form controls >+ https://bugs.webkit.org/show_bug.cgi?id=208129 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebProcess/WebPage/gtk/WebPageGtk.cpp: >+ (WebKit::WebPage::themeDidChange): Notify RenderTheme about the theme change to clear the colors cache. >+ > 2020-02-23 Adrian Perez de Castro <aperez@igalia.com> > > Non-unified build fixes late February 2020 edition >diff --git a/Source/WebKit/WebProcess/WebPage/gtk/WebPageGtk.cpp b/Source/WebKit/WebProcess/WebPage/gtk/WebPageGtk.cpp >index 8e86ed3b12a..1539901e6c8 100644 >--- a/Source/WebKit/WebProcess/WebPage/gtk/WebPageGtk.cpp >+++ b/Source/WebKit/WebProcess/WebPage/gtk/WebPageGtk.cpp >@@ -44,6 +44,7 @@ > #include <WebCore/Page.h> > #include <WebCore/PasteboardHelper.h> > #include <WebCore/PlatformKeyboardEvent.h> >+#include <WebCore/RenderTheme.h> > #include <WebCore/Settings.h> > #include <WebCore/SharedBuffer.h> > #include <WebCore/UserAgent.h> >@@ -164,6 +165,7 @@ void WebPage::themeDidChange(String&& themeName) > > m_themeName = WTFMove(themeName); > g_object_set(gtk_settings_get_default(), "gtk-theme-name", m_themeName.utf8().data(), nullptr); >+ RenderTheme::singleton().platformColorsDidChange(); > Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment(); > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
aperez
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 208129
:
391524
| 391525