Fix some include mistakes and make some coding style tweaks to WebKit and WebKitTestR...
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 23 Feb 2020 07:16:15 +0000 (07:16 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 23 Feb 2020 07:16:15 +0000 (07:16 +0000)
https://bugs.webkit.org/show_bug.cgi?id=208099

Reviewed by Antti Koivisto.

Source/WebKit:

* WebProcess/FullScreen/WebFullScreenManager.cpp: Removed some unneeded includes.

* WebProcess/WebCoreSupport/WebChromeClient.cpp: Removed some unneeded includes.
(WebKit::WebChromeClient::createDataListSuggestionPicker): Pass references.

* WebProcess/WebCoreSupport/WebDataListSuggestionPicker.cpp:
(WebKit::WebDataListSuggestionPicker::WebDataListSuggestionPicker): Take references
instead of pointers, since they must both be non-null.
(WebKit::WebDataListSuggestionPicker::handleKeydownWithIdentifier): Updated
to use reference.
(WebKit::WebDataListSuggestionPicker::didSelectOption): Ditto.
(WebKit::WebDataListSuggestionPicker::didCloseSuggestions): Ditto.
(WebKit::WebDataListSuggestionPicker::close): Ditto.
(WebKit::WebDataListSuggestionPicker::displayWithActivationType): Ditto.

* WebProcess/WebCoreSupport/WebDataListSuggestionPicker.h: Marked the class
final, made more functions private, use references instead of pointers,
renamed m_dataListSuggestionsClient to m_client since there is only one
client we are dealing with in this class.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setActiveDataListSuggestionPicker): Take reference.
* WebProcess/WebPage/WebPage.h: Updated for the above.

Source/WebKitLegacy/mac:

* DOM/DOMDocument.mm: Removed unneeded includes and re-sorted.
* DOM/DOMDocumentFragment.mm: Ditto.
* DOM/DOMHTMLFieldSetElement.mm: Ditto.

Tools:

* WebKitTestRunner/InjectedBundle/mac/AccessibilityNotificationHandler.mm:
Sorted includes the traditional way. Added an include of AccessibilityCommonMac.h
so we can use the -[NSString createJSStringRef] method.
(-[NSString createJSStringRef]): Deleted. This is a duplicate of the method
defined in AccessibilityCommonMac.mm, and was causing a linker warning.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@257191 268f45cc-cd09-0410-ab3c-d52691b4dbfc

13 files changed:
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/FullScreen/WebFullScreenManager.cpp
Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
Source/WebKit/WebProcess/WebCoreSupport/WebDataListSuggestionPicker.cpp
Source/WebKit/WebProcess/WebCoreSupport/WebDataListSuggestionPicker.h
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Source/WebKit/WebProcess/WebPage/WebPage.h
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/DOM/DOMDocument.mm
Source/WebKitLegacy/mac/DOM/DOMDocumentFragment.mm
Source/WebKitLegacy/mac/DOM/DOMHTMLFieldSetElement.mm
Tools/ChangeLog
Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityNotificationHandler.mm

index 0d34780..dc94545 100644 (file)
@@ -1,3 +1,34 @@
+2020-02-22  Darin Adler  <darin@apple.com>
+
+        Fix some include mistakes and make some coding style tweaks to WebKit and WebKitTestRunner
+        https://bugs.webkit.org/show_bug.cgi?id=208099
+
+        Reviewed by Antti Koivisto.
+
+        * WebProcess/FullScreen/WebFullScreenManager.cpp: Removed some unneeded includes.
+
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp: Removed some unneeded includes.
+        (WebKit::WebChromeClient::createDataListSuggestionPicker): Pass references.
+
+        * WebProcess/WebCoreSupport/WebDataListSuggestionPicker.cpp:
+        (WebKit::WebDataListSuggestionPicker::WebDataListSuggestionPicker): Take references
+        instead of pointers, since they must both be non-null.
+        (WebKit::WebDataListSuggestionPicker::handleKeydownWithIdentifier): Updated
+        to use reference.
+        (WebKit::WebDataListSuggestionPicker::didSelectOption): Ditto.
+        (WebKit::WebDataListSuggestionPicker::didCloseSuggestions): Ditto.
+        (WebKit::WebDataListSuggestionPicker::close): Ditto.
+        (WebKit::WebDataListSuggestionPicker::displayWithActivationType): Ditto.
+
+        * WebProcess/WebCoreSupport/WebDataListSuggestionPicker.h: Marked the class
+        final, made more functions private, use references instead of pointers,
+        renamed m_dataListSuggestionsClient to m_client since there is only one
+        client we are dealing with in this class.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::setActiveDataListSuggestionPicker): Take reference.
+        * WebProcess/WebPage/WebPage.h: Updated for the above.
+
 2020-02-22  Jer Noble  <jer.noble@apple.com>
 
         Stop using QTKit for rendering WK1 video fullscreen controls
index f51941e..803e846 100644 (file)
 #include "WebFullScreenManagerProxyMessages.h"
 #include "WebPage.h"
 #include <WebCore/Color.h>
-#include <WebCore/Element.h>
 #include <WebCore/Frame.h>
 #include <WebCore/FrameView.h>
 #include <WebCore/FullscreenManager.h>
 #include <WebCore/HTMLVideoElement.h>
-#include <WebCore/Page.h>
-#include <WebCore/RenderLayer.h>
 #include <WebCore/RenderLayerBacking.h>
-#include <WebCore/RenderObject.h>
 #include <WebCore/RenderView.h>
 #include <WebCore/Settings.h>
-#include <WebCore/TypedElementDescendantIterator.h>
 
 #if PLATFORM(IOS_FAMILY) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
 #include "PlaybackSessionManager.h"
 #endif
 
 namespace WebKit {
-using namespace WebCore;
 
-static IntRect screenRectOfContents(Element* element)
+static IntRect screenRectOfContents(WebCore::Element* element)
 {
     ASSERT(element);
     if (element->renderer() && element->renderer()->hasLayer() && element->renderer()->enclosingLayer()->isComposited()) {
-        FloatQuad contentsBox = static_cast<FloatRect>(element->renderer()->enclosingLayer()->backing()->contentsBox());
+        WebCore::FloatQuad contentsBox = static_cast<WebCore::FloatRect>(element->renderer()->enclosingLayer()->backing()->contentsBox());
         contentsBox = element->renderer()->localToAbsoluteQuad(contentsBox);
         return element->renderer()->view().frameView().contentsToScreen(contentsBox.enclosingBoundingBox());
     }
@@ -91,12 +85,12 @@ void WebFullScreenManager::videoControlsManagerDidChange()
     LOG(Fullscreen, "WebFullScreenManager %p videoControlsManagerDidChange()", this);
 
     auto* currentPlaybackControlsElement = m_page->playbackSessionManager().currentPlaybackControlsElement();
-    if (!m_element || !is<HTMLVideoElement>(currentPlaybackControlsElement)) {
+    if (!m_element || !is<WebCore::HTMLVideoElement>(currentPlaybackControlsElement)) {
         setPIPStandbyElement(nullptr);
         return;
     }
 
-    setPIPStandbyElement(downcast<HTMLVideoElement>(currentPlaybackControlsElement));
+    setPIPStandbyElement(downcast<WebCore::HTMLVideoElement>(currentPlaybackControlsElement));
 #endif
 }
 
index 8f51067..77bc5dd 100644 (file)
@@ -78,7 +78,6 @@
 #include <WebCore/HTMLPlugInImageElement.h>
 #include <WebCore/Icon.h>
 #include <WebCore/NotImplemented.h>
-#include <WebCore/Page.h>
 #include <WebCore/RegistrableDomain.h>
 #include <WebCore/ScriptController.h>
 #include <WebCore/SecurityOrigin.h>
@@ -795,7 +794,7 @@ std::unique_ptr<ColorChooser> WebChromeClient::createColorChooser(ColorChooserCl
 
 std::unique_ptr<DataListSuggestionPicker> WebChromeClient::createDataListSuggestionPicker(DataListSuggestionsClient& client)
 {
-    return makeUnique<WebDataListSuggestionPicker>(&m_page, &client);
+    return makeUnique<WebDataListSuggestionPicker>(m_page, client);
 }
 
 #endif
index aeb8737..b20b0ac 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2020 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 #include <WebCore/DataListSuggestionsClient.h>
 
 namespace WebKit {
-using namespace WebCore;
 
-WebDataListSuggestionPicker::WebDataListSuggestionPicker(WebPage* page, DataListSuggestionsClient* client)
-    : m_dataListSuggestionsClient(client)
+WebDataListSuggestionPicker::WebDataListSuggestionPicker(WebPage& page, WebCore::DataListSuggestionsClient& client)
+    : m_client(client)
     , m_page(page)
 {
 }
 
-WebDataListSuggestionPicker::~WebDataListSuggestionPicker() { }
-
-void WebDataListSuggestionPicker::handleKeydownWithIdentifier(const WTF::String& key)
+void WebDataListSuggestionPicker::handleKeydownWithIdentifier(const String& key)
 {
-    WebProcess::singleton().parentProcessConnection()->send(Messages::WebPageProxy::HandleKeydownInDataList(key), m_page->identifier());
+    WebProcess::singleton().parentProcessConnection()->send(Messages::WebPageProxy::HandleKeydownInDataList(key), m_page.identifier());
 }
 
-void WebDataListSuggestionPicker::didSelectOption(const WTF::String& selectedOption)
+void WebDataListSuggestionPicker::didSelectOption(const String& selectedOption)
 {
-    m_dataListSuggestionsClient->didSelectDataListOption(selectedOption);
+    m_client.didSelectDataListOption(selectedOption);
 }
 
 void WebDataListSuggestionPicker::didCloseSuggestions()
 {
-    m_dataListSuggestionsClient->didCloseSuggestions();
+    m_client.didCloseSuggestions();
 }
 
 void WebDataListSuggestionPicker::close()
 {
-    WebProcess::singleton().parentProcessConnection()->send(Messages::WebPageProxy::EndDataListSuggestions(), m_page->identifier());
+    WebProcess::singleton().parentProcessConnection()->send(Messages::WebPageProxy::EndDataListSuggestions(), m_page.identifier());
 }
 
-void WebDataListSuggestionPicker::displayWithActivationType(DataListSuggestionActivationType type)
+void WebDataListSuggestionPicker::displayWithActivationType(WebCore::DataListSuggestionActivationType type)
 {
-    if (!m_dataListSuggestionsClient->suggestions().size()) {
+    auto suggestions = m_client.suggestions();
+    if (suggestions.isEmpty()) {
         close();
         return;
     }
 
-    m_page->setActiveDataListSuggestionPicker(this);
+    m_page.setActiveDataListSuggestionPicker(*this);
 
-    DataListSuggestionInformation info = { type, m_dataListSuggestionsClient->suggestions(), m_dataListSuggestionsClient->elementRectInRootViewCoordinates() };
-    WebProcess::singleton().parentProcessConnection()->send(Messages::WebPageProxy::ShowDataListSuggestions(info), m_page->identifier());
+    WebCore::DataListSuggestionInformation info { type, WTFMove(suggestions), m_client.elementRectInRootViewCoordinates() };
+    WebProcess::singleton().parentProcessConnection()->send(Messages::WebPageProxy::ShowDataListSuggestions(info), m_page.identifier());
 }
 
 } // namespace WebKit
index 9705359..1351073 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2020 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -28,7 +28,6 @@
 #if ENABLE(DATALIST_ELEMENT)
 
 #include <WebCore/DataListSuggestionPicker.h>
-#include <wtf/text/WTFString.h>
 
 namespace WebCore {
 class DataListSuggestionsClient;
@@ -38,19 +37,20 @@ namespace WebKit {
 
 class WebPage;
 
-class WebDataListSuggestionPicker : public WebCore::DataListSuggestionPicker {
+class WebDataListSuggestionPicker final : public WebCore::DataListSuggestionPicker {
 public:
-    WebDataListSuggestionPicker(WebPage*, WebCore::DataListSuggestionsClient*);
-    virtual ~WebDataListSuggestionPicker();
+    WebDataListSuggestionPicker(WebPage&, WebCore::DataListSuggestionsClient&);
 
-    void handleKeydownWithIdentifier(const String&) override;
     void didSelectOption(const String&);
     void didCloseSuggestions();
-    void close() override;
-    void displayWithActivationType(WebCore::DataListSuggestionActivationType) override;
+
 private:
-    WebCore::DataListSuggestionsClient* m_dataListSuggestionsClient;
-    WebPage* m_page;
+    void handleKeydownWithIdentifier(const String&) final;
+    void displayWithActivationType(WebCore::DataListSuggestionActivationType) final;
+    void close() final;
+
+    WebCore::DataListSuggestionsClient& m_client;
+    WebPage& m_page;
 };
 
 } // namespace WebKit
index e458374..b9264a9 100644 (file)
@@ -4104,9 +4104,9 @@ void WebPage::didChooseColor(const WebCore::Color& color)
 
 #if ENABLE(DATALIST_ELEMENT)
 
-void WebPage::setActiveDataListSuggestionPicker(WebDataListSuggestionPicker* dataListSuggestionPicker)
+void WebPage::setActiveDataListSuggestionPicker(WebDataListSuggestionPicker& dataListSuggestionPicker)
 {
-    m_activeDataListSuggestionPicker = makeWeakPtr(dataListSuggestionPicker);
+    m_activeDataListSuggestionPicker = makeWeakPtr(&dataListSuggestionPicker);
 }
 
 void WebPage::didSelectDataListOption(const String& selectedOption)
index c7cf38c..fd741eb 100644 (file)
@@ -417,7 +417,7 @@ public:
 #endif
 
 #if ENABLE(DATALIST_ELEMENT)
-    void setActiveDataListSuggestionPicker(WebDataListSuggestionPicker*);
+    void setActiveDataListSuggestionPicker(WebDataListSuggestionPicker&);
     void didSelectDataListOption(const String&);
     void didCloseSuggestions();
 #endif
index ac64e14..8f507a4 100644 (file)
@@ -1,3 +1,14 @@
+2020-02-22  Darin Adler  <darin@apple.com>
+
+        Fix some include mistakes and make some coding style tweaks to WebKit and WebKitTestRunner
+        https://bugs.webkit.org/show_bug.cgi?id=208099
+
+        Reviewed by Antti Koivisto.
+
+        * DOM/DOMDocument.mm: Removed unneeded includes and re-sorted.
+        * DOM/DOMDocumentFragment.mm: Ditto.
+        * DOM/DOMHTMLFieldSetElement.mm: Ditto.
+
 2020-02-22  Jer Noble  <jer.noble@apple.com>
 
         Stop using QTKit for rendering WK1 video fullscreen controls
index 5c13d63..d1e2c34 100644 (file)
 
 #import "DOMDocumentInternal.h"
 
-#import <WebCore/Attr.h>
-#import <WebCore/CDATASection.h>
-#import <WebCore/CSSRuleList.h>
-#import <WebCore/CSSStyleDeclaration.h>
-#import <WebCore/Comment.h>
-#import <WebCore/DocumentFullscreen.h>
-#import <WebCore/SecurityOrigin.h>
 #import "DOMAbstractViewInternal.h"
 #import "DOMAttrInternal.h"
 #import "DOMCDATASectionInternal.h"
 #import "DOMStyleSheetListInternal.h"
 #import "DOMTextInternal.h"
 #import "DOMTreeWalkerInternal.h"
-#import <WebCore/DOMWindow.h>
 #import "DOMXPathExpressionInternal.h"
 #import "DOMXPathResultInternal.h"
+#import "ExceptionHandlers.h"
+#import "ObjCNodeFilterCondition.h"
+#import <WebCore/Attr.h>
+#import <WebCore/CDATASection.h>
+#import <WebCore/CSSRuleList.h>
+#import <WebCore/CSSStyleDeclaration.h>
+#import <WebCore/Comment.h>
+#import <WebCore/DOMWindow.h>
 #import <WebCore/Document.h>
 #import <WebCore/DocumentFragment.h>
+#import <WebCore/DocumentFullscreen.h>
 #import <WebCore/DocumentType.h>
-#import <WebCore/Element.h>
 #import <WebCore/Event.h>
-#import "ExceptionHandlers.h"
 #import <WebCore/HTMLCollection.h>
-#import <WebCore/HTMLElement.h>
 #import <WebCore/HTMLHeadElement.h>
 #import <WebCore/HTMLScriptElement.h>
 #import <WebCore/JSExecState.h>
 #import <WebCore/NameNodeList.h>
 #import <WebCore/NativeNodeFilter.h>
-#import <WebCore/Node.h>
 #import <WebCore/NodeIterator.h>
 #import <WebCore/NodeList.h>
-#import "ObjCNodeFilterCondition.h"
 #import <WebCore/ProcessingInstruction.h>
 #import <WebCore/Range.h>
+#import <WebCore/SecurityOrigin.h>
 #import <WebCore/StyleProperties.h>
 #import <WebCore/StyleSheetList.h>
 #import <WebCore/Text.h>
@@ -88,7 +85,6 @@
 #import <WebCore/XPathExpression.h>
 #import <WebCore/XPathNSResolver.h>
 #import <WebCore/XPathResult.h>
-#import <wtf/GetPtr.h>
 #import <wtf/URL.h>
 
 #define IMPL static_cast<WebCore::Document*>(reinterpret_cast<WebCore::Node*>(_internal))
index 072930e..4aed1f0 100644 (file)
 
 #import "DOMElementInternal.h"
 #import "DOMHTMLCollectionInternal.h"
-#import "DOMNodeInternal.h"
-#import "DOMNodeListInternal.h"
-#import <WebCore/DocumentFragment.h>
-#import <WebCore/Element.h>
 #import "ExceptionHandlers.h"
-#import <WebCore/HTMLCollection.h>
+#import <WebCore/DocumentFragment.h>
 #import <WebCore/JSExecState.h>
-#import <WebCore/NameNodeList.h>
-#import <WebCore/NodeList.h>
 #import <WebCore/ThreadCheck.h>
-#import <WebCore/WebScriptObjectPrivate.h>
-#import <wtf/GetPtr.h>
-#import <wtf/URL.h>
 
 #define IMPL static_cast<WebCore::DocumentFragment*>(reinterpret_cast<WebCore::Node*>(_internal))
 
index a4c1b60..0cb8edf 100644 (file)
 
 #import "DOMHTMLFieldSetElement.h"
 
-#import "DOMHTMLCollectionInternal.h"
 #import "DOMHTMLFormElementInternal.h"
-#import "DOMInternal.h"
-#import "DOMNodeInternal.h"
-#import "ExceptionHandlers.h"
-#import <WebCore/HTMLCollection.h>
 #import <WebCore/HTMLFieldSetElement.h>
-#import <WebCore/HTMLFormElement.h>
-#import <WebCore/HTMLNames.h>
 #import <WebCore/JSExecState.h>
-#import <WebCore/ThreadCheck.h>
-#import <WebCore/ValidityState.h>
-#import <WebCore/WebScriptObjectPrivate.h>
-#import <wtf/GetPtr.h>
-#import <wtf/URL.h>
 
 #define IMPL static_cast<WebCore::HTMLFieldSetElement*>(reinterpret_cast<WebCore::Node*>(_internal))
 
index d049862..1bf1811 100644 (file)
@@ -1,3 +1,16 @@
+2020-02-22  Darin Adler  <darin@apple.com>
+
+        Fix some include mistakes and make some coding style tweaks to WebKit and WebKitTestRunner
+        https://bugs.webkit.org/show_bug.cgi?id=208099
+
+        Reviewed by Antti Koivisto.
+
+        * WebKitTestRunner/InjectedBundle/mac/AccessibilityNotificationHandler.mm:
+        Sorted includes the traditional way. Added an include of AccessibilityCommonMac.h
+        so we can use the -[NSString createJSStringRef] method.
+        (-[NSString createJSStringRef]): Deleted. This is a duplicate of the method
+        defined in AccessibilityCommonMac.mm, and was causing a linker warning.
+
 2020-02-22  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         fast/forms/ios/force-gregorian-calendar-for-credit-card-expiry.html is failing in iOS 13.4 beta
index 5c51d48..66bae69 100644 (file)
  */
 
 #import "config.h"
+#import "AccessibilityNotificationHandler.h"
+
+#import "AccessibilityCommonMac.h"
+#import "AccessibilityUIElement.h"
 #import "InjectedBundle.h"
 #import "InjectedBundlePage.h"
 #import "JSWrapper.h"
-#import "AccessibilityNotificationHandler.h"
-#import "AccessibilityUIElement.h"
-
 #import <JavaScriptCore/JSRetainPtr.h>
 #import <JavaScriptCore/JSStringRef.h>
 #import <JavaScriptCore/JSStringRefCF.h>
 + (void)accessibilitySetShouldRepostNotifications:(BOOL)repost;
 @end
 
-@interface NSString (JSStringRefAdditions)
-- (JSRetainPtr<JSStringRef>)createJSStringRef;
-@end
-
-@implementation NSString (JSStringRefAdditions)
-
-- (JSRetainPtr<JSStringRef>)createJSStringRef
-{
-    return adopt(JSStringCreateWithCFString((__bridge CFStringRef)self));
-}
-
-@end
-
 @implementation AccessibilityNotificationHandler
 
 - (id)init