Title: [254312] trunk/Source/WebKit
Revision
254312
Author
simon.fra...@apple.com
Date
2020-01-09 15:48:21 -0800 (Thu, 09 Jan 2020)

Log Message

Use HAVE(TOUCH_BAR) instead of PLATFORM(COCOA) in more places
https://bugs.webkit.org/show_bug.cgi?id=205975

Reviewed by Wenson Hsieh.

Protect Touch Bar-related code with HAVE(TOUCH_BAR) instead of PLATFORM(COCOA).

* Shared/TouchBarMenuData.cpp:
* Shared/TouchBarMenuData.h:
* Shared/TouchBarMenuItemData.cpp:
* Shared/TouchBarMenuItemData.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::forceRequestCandidatesForTesting):
(WebKit::WebViewImpl::setEditableElementIsFocused):
* UIProcess/WebPageProxy.cpp:
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didStartPageTransition):
(WebKit::WebPage::didChangeSelectionOrOverflowScrollPosition):
(WebKit::WebPage::didInsertMenuElement):
(WebKit::WebPage::didRemoveMenuElement):
(WebKit::WebPage::didInsertMenuItemElement):
(WebKit::WebPage::didRemoveMenuItemElement):
* WebProcess/WebPage/WebPage.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (254311 => 254312)


--- trunk/Source/WebKit/ChangeLog	2020-01-09 23:48:18 UTC (rev 254311)
+++ trunk/Source/WebKit/ChangeLog	2020-01-09 23:48:21 UTC (rev 254312)
@@ -38,6 +38,34 @@
 
 2020-01-09  Simon Fraser  <simon.fra...@apple.com>
 
+        Use HAVE(TOUCH_BAR) instead of PLATFORM(COCOA) in more places
+        https://bugs.webkit.org/show_bug.cgi?id=205975
+
+        Reviewed by Wenson Hsieh.
+
+        Protect Touch Bar-related code with HAVE(TOUCH_BAR) instead of PLATFORM(COCOA).
+
+        * Shared/TouchBarMenuData.cpp:
+        * Shared/TouchBarMenuData.h:
+        * Shared/TouchBarMenuItemData.cpp:
+        * Shared/TouchBarMenuItemData.h:
+        * UIProcess/Cocoa/WebViewImpl.mm:
+        (WebKit::WebViewImpl::forceRequestCandidatesForTesting):
+        (WebKit::WebViewImpl::setEditableElementIsFocused):
+        * UIProcess/WebPageProxy.cpp:
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::didStartPageTransition):
+        (WebKit::WebPage::didChangeSelectionOrOverflowScrollPosition):
+        (WebKit::WebPage::didInsertMenuElement):
+        (WebKit::WebPage::didRemoveMenuElement):
+        (WebKit::WebPage::didInsertMenuItemElement):
+        (WebKit::WebPage::didRemoveMenuItemElement):
+        * WebProcess/WebPage/WebPage.h:
+
+2020-01-09  Simon Fraser  <simon.fra...@apple.com>
+
         Add ENABLE_UI_SIDE_COMPOSITING and use it in a few places
         https://bugs.webkit.org/show_bug.cgi?id=205982
 

Modified: trunk/Source/WebKit/Shared/TouchBarMenuData.cpp (254311 => 254312)


--- trunk/Source/WebKit/Shared/TouchBarMenuData.cpp	2020-01-09 23:48:18 UTC (rev 254311)
+++ trunk/Source/WebKit/Shared/TouchBarMenuData.cpp	2020-01-09 23:48:21 UTC (rev 254312)
@@ -24,6 +24,9 @@
  */
 
 #include "config.h"
+
+#if HAVE(TOUCH_BAR)
+
 #include "TouchBarMenuData.h"
 
 #include "Decoder.h"
@@ -68,3 +71,5 @@
 }
     
 }
+
+#endif // HAVE(TOUCH_BAR)

Modified: trunk/Source/WebKit/Shared/TouchBarMenuData.h (254311 => 254312)


--- trunk/Source/WebKit/Shared/TouchBarMenuData.h	2020-01-09 23:48:18 UTC (rev 254311)
+++ trunk/Source/WebKit/Shared/TouchBarMenuData.h	2020-01-09 23:48:21 UTC (rev 254312)
@@ -24,6 +24,9 @@
  */
 
 #pragma once
+
+#if HAVE(TOUCH_BAR)
+
 #include "ArgumentCoders.h"
 #include "TouchBarMenuItemData.h"
 #include <wtf/text/WTFString.h>
@@ -63,5 +66,7 @@
     
     bool m_isPageCustomized { false };
 };
-    
+
 }
+
+#endif // HAVE(TOUCH_BAR)

Modified: trunk/Source/WebKit/Shared/TouchBarMenuItemData.cpp (254311 => 254312)


--- trunk/Source/WebKit/Shared/TouchBarMenuItemData.cpp	2020-01-09 23:48:18 UTC (rev 254311)
+++ trunk/Source/WebKit/Shared/TouchBarMenuItemData.cpp	2020-01-09 23:48:21 UTC (rev 254312)
@@ -22,7 +22,11 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
+
 #include "config.h"
+
+#if HAVE(TOUCH_BAR)
+
 #include "TouchBarMenuItemData.h"
 
 #include "Decoder.h"
@@ -69,3 +73,5 @@
 }
 
 }
+
+#endif // HAVE(TOUCH_BAR)

Modified: trunk/Source/WebKit/Shared/TouchBarMenuItemData.h (254311 => 254312)


--- trunk/Source/WebKit/Shared/TouchBarMenuItemData.h	2020-01-09 23:48:18 UTC (rev 254311)
+++ trunk/Source/WebKit/Shared/TouchBarMenuItemData.h	2020-01-09 23:48:21 UTC (rev 254312)
@@ -24,6 +24,9 @@
  */
 
 #pragma once
+
+#if HAVE(TOUCH_BAR)
+
 #include "ArgumentCoders.h"
 #include <wtf/text/WTFString.h>
 
@@ -91,3 +94,5 @@
 }
 
 }
+
+#endif // HAVE(TOUCH_BAR)

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm (254311 => 254312)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2020-01-09 23:48:18 UTC (rev 254311)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2020-01-09 23:48:21 UTC (rev 254312)
@@ -1293,8 +1293,6 @@
 #endif
 }
 
-#if HAVE(TOUCH_BAR)
-
 bool WebViewImpl::canTogglePictureInPicture()
 {
 #if ENABLE(WEB_PLAYBACK_CONTROLS_MANAGER)
@@ -1304,14 +1302,10 @@
 #endif
 }
 
-#endif // HAVE(TOUCH_BAR)
-
 void WebViewImpl::forceRequestCandidatesForTesting()
 {
     m_canCreateTouchBars = true;
-#if HAVE(TOUCH_BAR)
     updateTouchBar();
-#endif
 }
 
 bool WebViewImpl::shouldRequestCandidates() const
@@ -1323,15 +1317,15 @@
 {
     m_editableElementIsFocused = editableElementIsFocused;
 
-#if HAVE(TOUCH_BAR)
     // If the editable elements have blurred, then we might need to get rid of the editing function bar.
     if (!m_editableElementIsFocused)
         updateTouchBar();
-#endif
 }
 
 } // namespace WebKit
+
 #else // !HAVE(TOUCH_BAR)
+
 namespace WebKit {
 
 void WebViewImpl::forceRequestCandidatesForTesting()
@@ -1349,6 +1343,7 @@
 }
 
 } // namespace WebKit
+
 #endif // HAVE(TOUCH_BAR)
 
 namespace WebKit {

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (254311 => 254312)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2020-01-09 23:48:18 UTC (rev 254311)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2020-01-09 23:48:21 UTC (rev 254312)
@@ -196,8 +196,6 @@
 #include "InsertTextOptions.h"
 #include "RemoteLayerTreeDrawingAreaProxy.h"
 #include "RemoteLayerTreeScrollingPerformanceData.h"
-#include "TouchBarMenuData.h"
-#include "TouchBarMenuItemData.h"
 #include "UserMediaCaptureManagerProxy.h"
 #include "VersionChecks.h"
 #include "VideoFullscreenManagerProxy.h"
@@ -207,6 +205,11 @@
 #include <wtf/MachSendRight.h>
 #endif
 
+#if HAVE(TOUCH_BAR)
+#include "TouchBarMenuData.h"
+#include "TouchBarMenuItemData.h"
+#endif
+
 #if PLATFORM(COCOA) || PLATFORM(GTK)
 #include "ViewSnapshotStore.h"
 #endif
@@ -5974,6 +5977,8 @@
     m_hasHadSelectionChangesFromUserInteraction = hasHadUserSelectionChanges;
 }
 
+#if HAVE(TOUCH_BAR)
+
 void WebPageProxy::setIsTouchBarUpdateSupressedForHiddenContentEditable(bool ignoreTouchBarUpdate)
 {
     m_isTouchBarUpdateSupressedForHiddenContentEditable = ignoreTouchBarUpdate;
@@ -5984,6 +5989,8 @@
     m_isNeverRichlyEditableForTouchBar = isNeverRichlyEditable;
 }
 
+#endif
+
 void WebPageProxy::requestDOMPasteAccess(const WebCore::IntRect& elementRect, const String& originIdentifier, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&& completionHandler)
 {
     m_pageClient->requestDOMPasteAccess(elementRect, originIdentifier, WTFMove(completionHandler));
@@ -9068,7 +9075,7 @@
     send(Messages::WebPage::EffectiveAppearanceDidChange(useDarkAppearance(), useElevatedUserInterfaceLevel()));
 }
 
-#if PLATFORM(COCOA)
+#if HAVE(TOUCH_BAR)
 void WebPageProxy::touchBarMenuDataChanged(const TouchBarMenuData& touchBarMenuData)
 {
     m_touchBarMenuData = touchBarMenuData;

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (254311 => 254312)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.h	2020-01-09 23:48:18 UTC (rev 254311)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h	2020-01-09 23:48:21 UTC (rev 254312)
@@ -134,6 +134,9 @@
 #if PLATFORM(COCOA)
 #include "DynamicViewportSizeUpdate.h"
 #include "RemoteLayerTreeNode.h"
+#endif
+
+#if HAVE(TOUCH_BAR)
 #include "TouchBarMenuData.h"
 #include "TouchBarMenuItemData.h"
 #endif
@@ -659,7 +662,7 @@
 
     Optional<WebCore::FontAttributes> cachedFontAttributesAtSelectionStart() const { return m_cachedFontAttributesAtSelectionStart; }
 
-#if PLATFORM(COCOA)
+#if HAVE(TOUCH_BAR)
     const TouchBarMenuData& touchBarMenuData() const { return m_touchBarMenuData; }
 #endif
 
@@ -1480,8 +1483,11 @@
     void setUserInterfaceLayoutDirection(WebCore::UserInterfaceLayoutDirection);
 
     bool hasHadSelectionChangesFromUserInteraction() const { return m_hasHadSelectionChangesFromUserInteraction; }
+
+#if HAVE(TOUCH_BAR)
     bool isTouchBarUpdateSupressedForHiddenContentEditable() const { return m_isTouchBarUpdateSupressedForHiddenContentEditable; }
     bool isNeverRichlyEditableForTouchBar() const { return m_isNeverRichlyEditableForTouchBar; }
+#endif
 
     bool isAlwaysOnLoggingAllowed() const;
 
@@ -1506,7 +1512,7 @@
     void scheduleFullEditorStateUpdate();
     void dispatchDidReceiveEditorStateAfterFocus();
 
-#if PLATFORM(COCOA)
+#if HAVE(TOUCH_BAR)
     void touchBarMenuDataRemoved();
     void touchBarMenuDataChanged(const TouchBarMenuData&);
     void touchBarMenuItemDataAdded(const TouchBarMenuItemData&);
@@ -1858,8 +1864,11 @@
 
     void compositionWasCanceled();
     void setHasHadSelectionChangesFromUserInteraction(bool);
+
+#if HAVE(TOUCH_BAR)
     void setIsTouchBarUpdateSupressedForHiddenContentEditable(bool);
     void setIsNeverRichlyEditableForTouchBar(bool);
+#endif
 
     void requestDOMPasteAccess(const WebCore::IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&);
 
@@ -2349,7 +2358,7 @@
     EditorState m_editorState;
     bool m_isEditable { false };
 
-#if PLATFORM(COCOA)
+#if HAVE(TOUCH_BAR)
     TouchBarMenuData m_touchBarMenuData;
 #endif
 
@@ -2566,8 +2575,11 @@
     WebCore::MediaProducer::MediaStateFlags m_mediaState { WebCore::MediaProducer::IsNotPlaying };
 
     bool m_hasHadSelectionChangesFromUserInteraction { false };
+
+#if HAVE(TOUCH_BAR)
     bool m_isTouchBarUpdateSupressedForHiddenContentEditable { false };
     bool m_isNeverRichlyEditableForTouchBar { false };
+#endif
 
 #if ENABLE(MEDIA_SESSION)
     bool m_hasMediaSessionWithActiveMediaElements { false };

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in (254311 => 254312)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in	2020-01-09 23:48:18 UTC (rev 254311)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in	2020-01-09 23:48:21 UTC (rev 254312)
@@ -252,8 +252,12 @@
     EditorStateChanged(struct WebKit::EditorState editorState)
     CompositionWasCanceled()
     SetHasHadSelectionChangesFromUserInteraction(bool hasHadUserSelectionChanges)
+
+#if HAVE(TOUCH_BAR)
     SetIsTouchBarUpdateSupressedForHiddenContentEditable(bool isTouchBarUpdateSupressed)
     SetIsNeverRichlyEditableForTouchBar(bool isNeverRichlyEditable)
+#endif
+
     RequestDOMPasteAccess(WebCore::IntRect elementRect, String originIdentifier) -> (enum:uint8_t WebCore::DOMPasteAccessResponse response) Synchronous
 
     # Find messages
@@ -360,7 +364,9 @@
     SearchWithSpotlight(String string)
 
     SearchTheWeb(String string)
+#endif
 
+#if HAVE(TOUCH_BAR)
     TouchBarMenuDataChanged(WebKit::TouchBarMenuData touchBarMenuData)
     TouchBarMenuItemDataAdded(struct WebKit::TouchBarMenuItemData touchBarMenuItemData)
     TouchBarMenuItemDataRemoved(struct WebKit::TouchBarMenuItemData touchBarMenuItemData)

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (254311 => 254312)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2020-01-09 23:48:18 UTC (rev 254311)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2020-01-09 23:48:21 UTC (rev 254312)
@@ -262,8 +262,6 @@
 #include "RemoteLayerTreeTransaction.h"
 #include "RemoteObjectRegistryMessages.h"
 #include "TextCheckingControllerProxy.h"
-#include "TouchBarMenuData.h"
-#include "TouchBarMenuItemData.h"
 #include "UserMediaCaptureManager.h"
 #include "VideoFullscreenManager.h"
 #include "WKStringCF.h"
@@ -273,6 +271,11 @@
 #include <wtf/MachSendRight.h>
 #endif
 
+#if HAVE(TOUCH_BAR)
+#include "TouchBarMenuData.h"
+#include "TouchBarMenuItemData.h"
+#endif
+
 #if PLATFORM(GTK)
 #include "WebPrintOperationGtk.h"
 #include "WebSelectionData.h"
@@ -3273,18 +3276,24 @@
 #endif
     m_hasEverFocusedElementDueToUserInteractionSincePageTransition = false;
     m_lastEditorStateWasContentEditable = EditorStateIsContentEditable::Unset;
+
 #if PLATFORM(MAC)
     if (hasPreviouslyFocusedDueToUserInteraction)
         send(Messages::WebPageProxy::SetHasHadSelectionChangesFromUserInteraction(m_hasEverFocusedElementDueToUserInteractionSincePageTransition));
+#endif
+
+#if HAVE(TOUCH_BAR)
     if (m_isTouchBarUpdateSupressedForHiddenContentEditable) {
         m_isTouchBarUpdateSupressedForHiddenContentEditable = false;
         send(Messages::WebPageProxy::SetIsTouchBarUpdateSupressedForHiddenContentEditable(m_isTouchBarUpdateSupressedForHiddenContentEditable));
     }
+
     if (m_isNeverRichlyEditableForTouchBar) {
         m_isNeverRichlyEditableForTouchBar = false;
         send(Messages::WebPageProxy::SetIsNeverRichlyEditableForTouchBar(m_isNeverRichlyEditableForTouchBar));
     }
 #endif
+
 #if PLATFORM(IOS_FAMILY)
     m_isShowingInputViewForFocusedElement = false;
 #endif
@@ -5442,6 +5451,7 @@
     m_hasEverFocusedElementDueToUserInteractionSincePageTransition |= m_userIsInteracting;
 
     if (!hasPreviouslyFocusedDueToUserInteraction && m_hasEverFocusedElementDueToUserInteractionSincePageTransition) {
+#if HAVE(TOUCH_BAR)
         if (frame.document()->quirks().isTouchBarUpdateSupressedForHiddenContentEditable()) {
             m_isTouchBarUpdateSupressedForHiddenContentEditable = true;
             send(Messages::WebPageProxy::SetIsTouchBarUpdateSupressedForHiddenContentEditable(m_isTouchBarUpdateSupressedForHiddenContentEditable));
@@ -5451,6 +5461,7 @@
             m_isNeverRichlyEditableForTouchBar = true;
             send(Messages::WebPageProxy::SetIsNeverRichlyEditableForTouchBar(m_isNeverRichlyEditableForTouchBar));
         }
+#endif
 
         send(Messages::WebPageProxy::SetHasHadSelectionChangesFromUserInteraction(m_hasEverFocusedElementDueToUserInteractionSincePageTransition));
     }
@@ -5890,7 +5901,7 @@
 
 void WebPage::didInsertMenuElement(HTMLMenuElement& element)
 {
-#if PLATFORM(COCOA)
+#if HAVE(TOUCH_BAR)
     sendTouchBarMenuDataAddedUpdate(element);
 #else
     UNUSED_PARAM(element);
@@ -5899,7 +5910,7 @@
 
 void WebPage::didRemoveMenuElement(HTMLMenuElement& element)
 {
-#if PLATFORM(COCOA)
+#if HAVE(TOUCH_BAR)
     sendTouchBarMenuDataRemovedUpdate(element);
 #else
     UNUSED_PARAM(element);
@@ -5908,7 +5919,7 @@
 
 void WebPage::didInsertMenuItemElement(HTMLMenuItemElement& element)
 {
-#if PLATFORM(COCOA)
+#if HAVE(TOUCH_BAR)
     sendTouchBarMenuItemDataAddedUpdate(element);
 #else
     UNUSED_PARAM(element);
@@ -5917,7 +5928,7 @@
 
 void WebPage::didRemoveMenuItemElement(HTMLMenuItemElement& element)
 {
-#if PLATFORM(COCOA)
+#if HAVE(TOUCH_BAR)
     sendTouchBarMenuItemDataRemovedUpdate(element);
 #else
     UNUSED_PARAM(element);
@@ -6165,7 +6176,7 @@
     m_drawingArea->scheduleCompositingLayerFlush();
 }
 
-#if PLATFORM(COCOA)
+#if HAVE(TOUCH_BAR)
 void WebPage::sendTouchBarMenuDataRemovedUpdate(HTMLMenuElement& element)
 {
     send(Messages::WebPageProxy::TouchBarMenuDataChanged(TouchBarMenuData { }));

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (254311 => 254312)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2020-01-09 23:48:18 UTC (rev 254311)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2020-01-09 23:48:21 UTC (rev 254312)
@@ -1277,7 +1277,7 @@
     void platformWillPerformEditingCommand();
     void sendEditorStateUpdate();
 
-#if PLATFORM(COCOA)
+#if HAVE(TOUCH_BAR)
     void sendTouchBarMenuDataAddedUpdate(WebCore::HTMLMenuElement&);
     void sendTouchBarMenuDataRemovedUpdate(WebCore::HTMLMenuElement&);
     void sendTouchBarMenuItemDataAddedUpdate(WebCore::HTMLMenuItemElement&);
@@ -1873,8 +1873,11 @@
 
     bool m_userIsInteracting { false };
     bool m_hasEverFocusedElementDueToUserInteractionSincePageTransition { false };
+
+#if HAVE(TOUCH_BAR)
     bool m_isTouchBarUpdateSupressedForHiddenContentEditable { false };
     bool m_isNeverRichlyEditableForTouchBar { false };
+#endif
     OptionSet<WebCore::ActivityState::Flag> m_lastActivityStateChanges;
 
 #if ENABLE(CONTEXT_MENUS)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to