Diff
Modified: trunk/Source/WebCore/ChangeLog (287320 => 287321)
--- trunk/Source/WebCore/ChangeLog 2021-12-21 17:58:56 UTC (rev 287320)
+++ trunk/Source/WebCore/ChangeLog 2021-12-21 18:17:38 UTC (rev 287321)
@@ -1,3 +1,44 @@
+2021-12-21 Wenson Hsieh <wenson_hs...@apple.com>
+
+ Add support for a UI delegate method to decide how to handle detected modal containers
+ https://bugs.webkit.org/show_bug.cgi?id=234440
+ rdar://77073735
+
+ Reviewed by Darin Adler.
+
+ Move ModalContainerControlType.h to ModalContainerTypes.h, and add a new enum flag to represent return values in
+ the new UI delegate decision handler.
+
+ * Headers.cmake:
+ * WebCore.xcodeproj/project.pbxproj:
+ * loader/DocumentLoader.h:
+
+ Additionally remove the unused Allow and Disallow values of ModalContainerObservationPolicy, now that we will
+ always (effectively) "prompt" when detecting a modal container by calling into the client layer with the new
+ delegate method.
+
+ * loader/EmptyClients.cpp:
+ (WebCore::EmptyChromeClient::decidePolicyForModalContainer):
+ * loader/EmptyClients.h:
+ * page/ChromeClient.h:
+
+ Add the new async chrome client hook, `decidePolicyForModalContainer()`.
+
+ * page/ModalContainerObserver.cpp:
+ (WebCore::ModalContainerObserver::collectClickableElementsTimerFired):
+
+ Call into the chrome client to decide how to handle the observed modal container.
+
+ (WebCore::ModalContainerObserver::revealModalContainer:
+
+ Add a helper method to reset the current `m_container` and invalidate its style (such that it will be displayed
+ after the next style update).
+
+ * page/ModalContainerTypes.h: Renamed from Source/WebCore/page/ModalContainerControlType.h.
+
+ Also, tweak the `ModalContainerControlType` values so that they can be used as option flags when informing the
+ WebKit client about which control types are present in the modal container.
+
2021-12-21 Alan Bujtas <za...@apple.com>
[LFC][IFC] Move enclosing line geometry computation to a dedicated function
Modified: trunk/Source/WebCore/Headers.cmake (287320 => 287321)
--- trunk/Source/WebCore/Headers.cmake 2021-12-21 17:58:56 UTC (rev 287320)
+++ trunk/Source/WebCore/Headers.cmake 2021-12-21 18:17:38 UTC (rev 287321)
@@ -1109,7 +1109,7 @@
page/MediaControlsContextMenuItem.h
page/MediaProducer.h
page/MemoryRelease.h
- page/ModalContainerControlType.h
+ page/ModalContainerTypes.h
page/NavigatorIsLoggedIn.h
page/PDFImageCachingPolicy.h
page/Page.h
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (287320 => 287321)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-12-21 17:58:56 UTC (rev 287320)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-12-21 18:17:38 UTC (rev 287321)
@@ -5509,7 +5509,7 @@
F48D2A6C215623B400C6752B /* FontShadow.h in Headers */ = {isa = PBXBuildFile; fileRef = F48D2A6A215623B400C6752B /* FontShadow.h */; settings = {ATTRIBUTES = (Private, ); }; };
F48D2A7E2157182600C6752B /* FontAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = F48D2A712156DC0A00C6752B /* FontAttributes.h */; settings = {ATTRIBUTES = (Private, ); }; };
F48D2AA52159740D00C6752B /* ColorCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = F48D2AA32159740D00C6752B /* ColorCocoa.h */; settings = {ATTRIBUTES = (Private, ); }; };
- F49328832769041B003E20F8 /* ModalContainerControlType.h in Headers */ = {isa = PBXBuildFile; fileRef = F49328822769041B003E20F8 /* ModalContainerControlType.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ F49328832769041B003E20F8 /* ModalContainerTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = F49328822769041B003E20F8 /* ModalContainerTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
F49786881FF45FA500E060AB /* PasteboardItemInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = F49786871FF45FA500E060AB /* PasteboardItemInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
F4B0018926E7F21F006EAABE /* HTMLAtomStringCache.h in Headers */ = {isa = PBXBuildFile; fileRef = F4B0018726E7F21F006EAABE /* HTMLAtomStringCache.h */; };
F4B2A909265030BA009E7286 /* DataDetectorHighlight.h in Headers */ = {isa = PBXBuildFile; fileRef = F4B2A90626502BA0009E7286 /* DataDetectorHighlight.h */; };
@@ -17740,7 +17740,7 @@
F48D2A7A2157051E00C6752B /* FontShadowCocoa.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = FontShadowCocoa.mm; sourceTree = "<group>"; };
F48D2AA32159740D00C6752B /* ColorCocoa.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ColorCocoa.h; sourceTree = "<group>"; };
F48D2AA42159740D00C6752B /* ColorCocoa.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ColorCocoa.mm; sourceTree = "<group>"; };
- F49328822769041B003E20F8 /* ModalContainerControlType.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ModalContainerControlType.h; sourceTree = "<group>"; };
+ F49328822769041B003E20F8 /* ModalContainerTypes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ModalContainerTypes.h; sourceTree = "<group>"; };
F49786871FF45FA500E060AB /* PasteboardItemInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PasteboardItemInfo.h; sourceTree = "<group>"; };
F49E98E421DEE6C1009AE55E /* EditAction.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = EditAction.cpp; sourceTree = "<group>"; };
F4B0018726E7F21F006EAABE /* HTMLAtomStringCache.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HTMLAtomStringCache.h; sourceTree = "<group>"; };
@@ -19262,12 +19262,12 @@
11A1E6FB26FBB6CE00435D36 /* display */ = {
isa = PBXGroup;
children = (
- 6F60E5A927710F39005C15B9 /* InlineDisplayLineBuilder.h */,
- 6F60E5A727710F2F005C15B9 /* InlineDisplayLineBuilder.cpp */,
6FC3F9452516756600A49BEA /* InlineDisplayBox.h */,
11513D0026D981DD004D3FAA /* InlineDisplayContentBuilder.cpp */,
11513D0226D981E7004D3FAA /* InlineDisplayContentBuilder.h */,
6F91420F25152137004E4FEA /* InlineDisplayLine.h */,
+ 6F60E5A727710F2F005C15B9 /* InlineDisplayLineBuilder.cpp */,
+ 6F60E5A927710F39005C15B9 /* InlineDisplayLineBuilder.h */,
);
path = display;
sourceTree = "<group>";
@@ -23991,9 +23991,9 @@
52E2CAFB19FF0207001EEB4F /* MediaProducer.h */,
413E00771DB0E4DE002341D2 /* MemoryRelease.cpp */,
413E00781DB0E4DE002341D2 /* MemoryRelease.h */,
- F49328822769041B003E20F8 /* ModalContainerControlType.h */,
A10F7C7127310073008FA9AF /* ModalContainerObserver.cpp */,
A10F7C7027310073008FA9AF /* ModalContainerObserver.h */,
+ F49328822769041B003E20F8 /* ModalContainerTypes.h */,
93EB355E09E37FD600F43799 /* MouseEventWithHitTestResults.cpp */,
935C476209AC4CE600A6AAB4 /* MouseEventWithHitTestResults.h */,
6B507A23234BF34100BE7C62 /* Navigator+IsLoggedIn.idl */,
@@ -33349,7 +33349,6 @@
8378878224D8A609000D4A5B /* AudioBufferSourceOptions.h in Headers */,
FD31607C12B026F700C1A359 /* AudioBus.h in Headers */,
FD31607E12B026F700C1A359 /* AudioChannel.h in Headers */,
- BC19CDF2276FFC6D0053F734 /* GradientRendererCG.h in Headers */,
CD3EEF3A25799F88006563BB /* AudioConfiguration.h in Headers */,
FD31600512B0267600C1A359 /* AudioContext.h in Headers */,
E785D96224B7F7350014DB21 /* AudioContextLatencyCategory.h in Headers */,
@@ -34510,7 +34509,9 @@
311518FC1E78C15F00EC514A /* GPUBasedCanvasRenderingContext.h in Headers */,
BC53C5F50DA56B920021EB5D /* Gradient.h in Headers */,
B22279640D00BF220071B782 /* GradientAttributes.h in Headers */,
+ BC19CDF4277106390053F734 /* GradientColorStop.h in Headers */,
2D481F04146B5C6B00AA7834 /* GradientImage.h in Headers */,
+ BC19CDF2276FFC6D0053F734 /* GradientRendererCG.h in Headers */,
7BB680BA25BA1BE4002B8738 /* GraphicsChecksMac.h in Headers */,
B2A015A90AF6CD53006BCE0E /* GraphicsContext.h in Headers */,
934907E4125BBBC8007F23A0 /* GraphicsContextCG.h in Headers */,
@@ -34843,6 +34844,7 @@
6FC3F9472516756700A49BEA /* InlineDisplayBox.h in Headers */,
11513D0326D981E8004D3FAA /* InlineDisplayContentBuilder.h in Headers */,
6F91421125152138004E4FEA /* InlineDisplayLine.h in Headers */,
+ 6F60E5AA27710F39005C15B9 /* InlineDisplayLineBuilder.h in Headers */,
6F7CA3CA208C2B2E002F29AB /* InlineFormattingContext.h in Headers */,
47C4D57D26508BCB00C7AB1F /* InlineFormattingGeometry.h in Headers */,
6FE636E82647962900F0951E /* InlineFormattingQuirks.h in Headers */,
@@ -34906,7 +34908,6 @@
A5B81CAD1FAA44620037D1E6 /* InspectorDOMStorageAgent.h in Headers */,
994C603A253A277300BDF060 /* InspectorFrontendAPIDispatcher.h in Headers */,
F344C7141125B82C00F26EEE /* InspectorFrontendClient.h in Headers */,
- BC19CDF4277106390053F734 /* GradientColorStop.h in Headers */,
F344C75311294D9D00F26EEE /* InspectorFrontendClientLocal.h in Headers */,
7A0E770F10C00A8800A0276E /* InspectorFrontendHost.h in Headers */,
7A54858014E02D51006AE05A /* InspectorHistory.h in Headers */,
@@ -36147,8 +36148,8 @@
CDF2B0171820540700F2B424 /* MockSourceBufferPrivate.h in Headers */,
CDF2B0191820540700F2B424 /* MockTracks.h in Headers */,
5715610C234C1CA1008FC7AB /* MockWebAuthenticationConfiguration.h in Headers */,
- F49328832769041B003E20F8 /* ModalContainerControlType.h in Headers */,
A10F7C73273100D0008FA9AF /* ModalContainerObserver.h in Headers */,
+ F49328832769041B003E20F8 /* ModalContainerTypes.h in Headers */,
2DC8D39825F2FE9700CFCBAB /* Model.h in Headers */,
313E79EA273C86B80097F905 /* ModelDocument.h in Headers */,
BC2B41172732F41E00A2D191 /* ModelPlayer.h in Headers */,
@@ -37676,7 +37677,6 @@
BEF29EEC1715DD0900C4B4C9 /* VideoTrackPrivate.h in Headers */,
CD336F6417FA0A4D00DDDCD0 /* VideoTrackPrivateAVF.h in Headers */,
CD336F6817FA0AC600DDDCD0 /* VideoTrackPrivateAVFObjC.h in Headers */,
- 6F60E5AA27710F39005C15B9 /* InlineDisplayLineBuilder.h in Headers */,
CD1F9B14270235F700617EB6 /* VideoTrackPrivateClient.h in Headers */,
CD8B5A43180D149A008B8E65 /* VideoTrackPrivateMediaSourceAVFObjC.h in Headers */,
070E81D11BF27656001FDA48 /* VideoTrackPrivateMediaStream.h in Headers */,
Modified: trunk/Source/WebCore/loader/DocumentLoader.h (287320 => 287321)
--- trunk/Source/WebCore/loader/DocumentLoader.h 2021-12-21 17:58:56 UTC (rev 287320)
+++ trunk/Source/WebCore/loader/DocumentLoader.h 2021-12-21 18:17:38 UTC (rev 287321)
@@ -145,12 +145,7 @@
#endif
};
-enum class ModalContainerObservationPolicy : uint8_t {
- Disabled,
- Prompt,
- Allow,
- Disallow,
-};
+enum class ModalContainerObservationPolicy : bool { Disabled, Prompt };
enum class ColorSchemePreference : uint8_t {
NoPreference,
@@ -808,9 +803,7 @@
using values = EnumValues<
WebCore::ModalContainerObservationPolicy,
WebCore::ModalContainerObservationPolicy::Disabled,
- WebCore::ModalContainerObservationPolicy::Prompt,
- WebCore::ModalContainerObservationPolicy::Allow,
- WebCore::ModalContainerObservationPolicy::Disallow
+ WebCore::ModalContainerObservationPolicy::Prompt
>;
};
Modified: trunk/Source/WebCore/loader/EmptyClients.cpp (287320 => 287321)
--- trunk/Source/WebCore/loader/EmptyClients.cpp 2021-12-21 17:58:56 UTC (rev 287320)
+++ trunk/Source/WebCore/loader/EmptyClients.cpp 2021-12-21 18:17:38 UTC (rev 287321)
@@ -63,7 +63,7 @@
#include "LibWebRTCProvider.h"
#include "MediaRecorderPrivate.h"
#include "MediaRecorderProvider.h"
-#include "ModalContainerControlType.h"
+#include "ModalContainerTypes.h"
#include "NetworkStorageSession.h"
#include "Page.h"
#include "PageConfiguration.h"
@@ -596,6 +596,11 @@
completion({ });
}
+void EmptyChromeClient::decidePolicyForModalContainer(OptionSet<ModalContainerControlType>, CompletionHandler<void(ModalContainerDecision)>&& completion)
+{
+ completion(ModalContainerDecision::Show);
+}
+
void EmptyFrameLoaderClient::dispatchDecidePolicyForNewWindowAction(const NavigationAction&, const ResourceRequest&, FormState*, const String&, PolicyCheckIdentifier, FramePolicyFunction&&)
{
}
Modified: trunk/Source/WebCore/loader/EmptyClients.h (287320 => 287321)
--- trunk/Source/WebCore/loader/EmptyClients.h 2021-12-21 17:58:56 UTC (rev 287320)
+++ trunk/Source/WebCore/loader/EmptyClients.h 2021-12-21 18:17:38 UTC (rev 287321)
@@ -221,6 +221,7 @@
void requestCookieConsent(CompletionHandler<void(CookieConsentDecisionResult)>&&) final;
void classifyModalContainerControls(Vector<String>&&, CompletionHandler<void(Vector<ModalContainerControlType>&&)>&&) final;
+ void decidePolicyForModalContainer(OptionSet<ModalContainerControlType>, CompletionHandler<void(ModalContainerDecision)>&&) final;
};
DiagnosticLoggingClient& emptyDiagnosticLoggingClient();
Modified: trunk/Source/WebCore/page/ChromeClient.h (287320 => 287321)
--- trunk/Source/WebCore/page/ChromeClient.h 2021-12-21 17:58:56 UTC (rev 287320)
+++ trunk/Source/WebCore/page/ChromeClient.h 2021-12-21 18:17:38 UTC (rev 287321)
@@ -144,6 +144,7 @@
enum class CookieConsentDecisionResult : uint8_t;
enum class ModalContainerControlType : uint8_t;
+enum class ModalContainerDecision : uint8_t;
enum class RouteSharingPolicy : uint8_t;
class ChromeClient {
@@ -627,6 +628,8 @@
virtual const AtomString& searchStringForModalContainerObserver() const { return nullAtom(); }
virtual void classifyModalContainerControls(Vector<String>&& texts, CompletionHandler<void(Vector<ModalContainerControlType>&&)>&&) = 0;
+ virtual void decidePolicyForModalContainer(OptionSet<ModalContainerControlType>, CompletionHandler<void(ModalContainerDecision)>&&) = 0;
+
protected:
virtual ~ChromeClient() = default;
};
Deleted: trunk/Source/WebCore/page/ModalContainerControlType.h (287320 => 287321)
--- trunk/Source/WebCore/page/ModalContainerControlType.h 2021-12-21 17:58:56 UTC (rev 287320)
+++ trunk/Source/WebCore/page/ModalContainerControlType.h 2021-12-21 18:17:38 UTC (rev 287321)
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2021 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. 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 <wtf/EnumTraits.h>
-
-namespace WebCore {
-
-enum class ModalContainerControlType : uint8_t {
- Neutral,
- Positive,
- Negative,
- Other,
-};
-
-} // namespace WebCore
-
-namespace WTF {
-
-template<> struct EnumTraits<WebCore::ModalContainerControlType> {
- using values = EnumValues<
- WebCore::ModalContainerControlType,
- WebCore::ModalContainerControlType::Neutral,
- WebCore::ModalContainerControlType::Positive,
- WebCore::ModalContainerControlType::Negative,
- WebCore::ModalContainerControlType::Other
- >;
-};
-
-} // namespace WTF
Modified: trunk/Source/WebCore/page/ModalContainerObserver.cpp (287320 => 287321)
--- trunk/Source/WebCore/page/ModalContainerObserver.cpp 2021-12-21 17:58:56 UTC (rev 287320)
+++ trunk/Source/WebCore/page/ModalContainerObserver.cpp 2021-12-21 18:17:38 UTC (rev 287321)
@@ -42,7 +42,7 @@
#include "HTMLElement.h"
#include "HTMLImageElement.h"
#include "HTMLInputElement.h"
-#include "ModalContainerControlType.h"
+#include "ModalContainerTypes.h"
#include "Page.h"
#include "RenderDescendantIterator.h"
#include "RenderText.h"
@@ -300,9 +300,49 @@
return;
}
- Vector<Ref<HTMLElement>> positiveControls;
- Vector<Ref<HTMLElement>> neutralControls;
- Vector<Ref<HTMLElement>> negativeControls;
+ struct ClassifiedControls {
+ Vector<WeakPtr<HTMLElement>> positive;
+ Vector<WeakPtr<HTMLElement>> neutral;
+ Vector<WeakPtr<HTMLElement>> negative;
+
+ HTMLElement* controlToClick(ModalContainerDecision decision) const
+ {
+ auto matchNonNull = [&](const WeakPtr<HTMLElement>& element) {
+ return !!element;
+ };
+
+ switch (decision) {
+ case ModalContainerDecision::Show:
+ case ModalContainerDecision::HideAndIgnore:
+ break;
+ case ModalContainerDecision::HideAndAllow:
+ if (auto index = positive.findMatching(matchNonNull); index != notFound)
+ return positive[index].get();
+ if (auto index = neutral.findMatching(matchNonNull); index != notFound)
+ return neutral[index].get();
+ break;
+ case ModalContainerDecision::HideAndDisallow:
+ if (auto index = negative.findMatching(matchNonNull); index != notFound)
+ return negative[index].get();
+ break;
+ }
+ return nullptr;
+ }
+
+ OptionSet<ModalContainerControlType> types() const
+ {
+ OptionSet<ModalContainerControlType> availableTypesIgnoringOther;
+ if (!positive.isEmpty())
+ availableTypesIgnoringOther.add(ModalContainerControlType::Positive);
+ if (!negative.isEmpty())
+ availableTypesIgnoringOther.add(ModalContainerControlType::Negative);
+ if (!neutral.isEmpty())
+ availableTypesIgnoringOther.add(ModalContainerControlType::Neutral);
+ return availableTypesIgnoringOther;
+ }
+ };
+
+ ClassifiedControls classifiedControls;
for (size_t index = 0; index < types.size(); ++index) {
auto control = controls[index];
if (!control)
@@ -310,13 +350,13 @@
switch (types[index]) {
case ModalContainerControlType::Positive:
- positiveControls.append(*control);
+ classifiedControls.positive.append(control);
break;
case ModalContainerControlType::Negative:
- negativeControls.append(*control);
+ classifiedControls.negative.append(control);
break;
case ModalContainerControlType::Neutral:
- neutralControls.append(*control);
+ classifiedControls.neutral.append(control);
break;
case ModalContainerControlType::Other:
break;
@@ -323,38 +363,44 @@
}
}
- RefPtr<HTMLElement> controlToClick;
- switch (documentLoader->modalContainerObservationPolicy()) {
- case ModalContainerObservationPolicy::Disabled:
- ASSERT_NOT_REACHED();
- break;
- case ModalContainerObservationPolicy::Allow: {
- if (!positiveControls.isEmpty())
- controlToClick = positiveControls[0].ptr();
- else if (!neutralControls.isEmpty())
- controlToClick = neutralControls[0].ptr();
- break;
+ observer->m_hasAttemptedToFulfillPolicy = true;
+
+ auto* page = document->page();
+ if (!page)
+ return;
+
+ auto clickableControlTypes = classifiedControls.types();
+ if (clickableControlTypes.isEmpty()) {
+ observer->revealModalContainer();
+ return;
}
- case ModalContainerObservationPolicy::Disallow: {
- if (!negativeControls.isEmpty())
- controlToClick = negativeControls[0].ptr();
- else if (!neutralControls.isEmpty())
- controlToClick = neutralControls[0].ptr();
- break;
- }
- case ModalContainerObservationPolicy::Prompt:
- // Not supported yet.
- break;
- }
- observer->m_hasAttemptedToFulfillPolicy = true;
+ page->chrome().client().decidePolicyForModalContainer(clickableControlTypes, [weakDocument = WTFMove(weakDocument), observer, classifiedControls = WTFMove(classifiedControls)](auto decision) mutable {
+ RefPtr document = weakDocument.get();
+ if (!document)
+ return;
- if (controlToClick)
- controlToClick->dispatchSimulatedClick(nullptr, SendMouseUpDownEvents, DoNotShowPressedLook);
+ if (observer != document->modalContainerObserverIfExists())
+ return;
+
+ if (decision == ModalContainerDecision::Show) {
+ observer->revealModalContainer();
+ return;
+ }
+
+ if (RefPtr controlToClick = classifiedControls.controlToClick(decision))
+ controlToClick->dispatchSimulatedClick(nullptr, SendMouseUpDownEvents, DoNotShowPressedLook);
+ });
});
});
}
+void ModalContainerObserver::revealModalContainer()
+{
+ if (auto container = std::exchange(m_container, { }))
+ container->invalidateStyle();
+}
+
std::pair<Vector<WeakPtr<HTMLElement>>, Vector<String>> ModalContainerObserver::collectClickableElements()
{
Ref container = *m_container;
Modified: trunk/Source/WebCore/page/ModalContainerObserver.h (287320 => 287321)
--- trunk/Source/WebCore/page/ModalContainerObserver.h 2021-12-21 17:58:56 UTC (rev 287320)
+++ trunk/Source/WebCore/page/ModalContainerObserver.h 2021-12-21 18:17:38 UTC (rev 287321)
@@ -53,6 +53,7 @@
private:
void scheduleClickableElementCollection();
void collectClickableElementsTimerFired();
+ void revealModalContainer();
std::pair<Vector<WeakPtr<HTMLElement>>, Vector<String>> collectClickableElements();
Copied: trunk/Source/WebCore/page/ModalContainerTypes.h (from rev 287320, trunk/Source/WebCore/page/ModalContainerControlType.h) (0 => 287321)
--- trunk/Source/WebCore/page/ModalContainerTypes.h (rev 0)
+++ trunk/Source/WebCore/page/ModalContainerTypes.h 2021-12-21 18:17:38 UTC (rev 287321)
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2021 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. 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 <wtf/EnumTraits.h>
+
+namespace WebCore {
+
+enum class ModalContainerControlType : uint8_t {
+ Neutral = 1 << 0,
+ Positive = 1 << 1,
+ Negative = 1 << 2,
+ Other = 1 << 3,
+};
+
+enum class ModalContainerDecision : uint8_t {
+ Show,
+ HideAndIgnore,
+ HideAndAllow,
+ HideAndDisallow,
+};
+
+} // namespace WebCore
+
+namespace WTF {
+
+template<> struct EnumTraits<WebCore::ModalContainerControlType> {
+ using values = EnumValues<
+ WebCore::ModalContainerControlType,
+ WebCore::ModalContainerControlType::Neutral,
+ WebCore::ModalContainerControlType::Positive,
+ WebCore::ModalContainerControlType::Negative,
+ WebCore::ModalContainerControlType::Other
+ >;
+};
+
+template<> struct EnumTraits<WebCore::ModalContainerDecision> {
+ using values = EnumValues<
+ WebCore::ModalContainerDecision,
+ WebCore::ModalContainerDecision::Show,
+ WebCore::ModalContainerDecision::HideAndIgnore,
+ WebCore::ModalContainerDecision::HideAndAllow,
+ WebCore::ModalContainerDecision::HideAndDisallow
+ >;
+};
+
+} // namespace WTF
Modified: trunk/Source/WebKit/ChangeLog (287320 => 287321)
--- trunk/Source/WebKit/ChangeLog 2021-12-21 17:58:56 UTC (rev 287320)
+++ trunk/Source/WebKit/ChangeLog 2021-12-21 18:17:38 UTC (rev 287321)
@@ -1,3 +1,62 @@
+2021-12-21 Wenson Hsieh <wenson_hs...@apple.com>
+
+ Add support for a UI delegate method to decide how to handle detected modal containers
+ https://bugs.webkit.org/show_bug.cgi?id=234440
+ rdar://77073735
+
+ Reviewed by Darin Adler.
+
+ Add support for a new UI delegate method, `-_webView:decidePolicyForModalContainer:decisionHandler:`, that is
+ invoked when a modal container has been detected and suppressed due to a WebKit client specifying the
+ `_WKWebsiteModalContainerObservationPolicyPrompt` option in webpage preferences. This new delegate method is
+ invoked with a new `_WKModalContainerInfo` object, which (for now) just encapsulates an option set of
+ ModalContainerControlTypes that indicates which types of modal containers are available.
+
+ * Scripts/webkit/messages.py:
+ (headers_for_type):
+ * SourcesCocoa.txt:
+ * UIProcess/API/APIUIClient.h:
+ (API::UIClient::decidePolicyForModalContainer):
+ * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
+ * UIProcess/API/Cocoa/WKWebpagePreferences.mm:
+ (WebKit::modalContainerObservationPolicy):
+ (WebKit::coreModalContainerObservationPolicy):
+ * UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h:
+
+ Remove support for two unused policy flags, `_WKWebsiteModalContainerObservationPolicyAllow` and
+ `_WKWebsiteModalContainerObservationPolicyDisallow`. These are now obviated by the new decision handler return
+ values `_WKModalContainerDecisionHideAndAllow` and `_WKModalContainerDecisionHideAndDisallow`, respectively.
+ While this leaves us with only two policy modes (such that the policy can now be turned into a single BOOL
+ switch), I'm keeping the named enum flags for now, since:
+
+ 1. The existing names do a better job of describing their respective behaviors than a single BOOL flag like
+ `modalContainerObserverShouldPrompt`, or `modalContainerObserverEnabled`, and...
+
+ 2. We'll probably need to extend this policy set to add a new value in the near future, anyways.
+
+ * UIProcess/API/Cocoa/_WKModalContainerInfo.h:
+ * UIProcess/API/Cocoa/_WKModalContainerInfo.mm:
+ (-[_WKModalContainerInfo initWithTypes:]):
+ * UIProcess/API/Cocoa/_WKModalContainerInfoInternal.h:
+ * UIProcess/Cocoa/ModalContainerControlClassifier.mm:
+ * UIProcess/Cocoa/UIDelegate.h:
+ * UIProcess/Cocoa/UIDelegate.mm:
+ (WebKit::UIDelegate::setDelegate):
+ (WebKit::coreModalContainerDecision):
+ (WebKit::UIDelegate::UIClient::decidePolicyForModalContainer):
+
+ Add plumbing for the new chrome client hook through WebChromeClient, WebPage, WebPageProxy, and finally the UI
+ client.
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::decidePolicyForModalContainer):
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/WebPageProxy.messages.in:
+ * WebKit.xcodeproj/project.pbxproj:
+ * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+ (WebKit::WebChromeClient::decidePolicyForModalContainer):
+ * WebProcess/WebCoreSupport/WebChromeClient.h:
+
2021-12-21 Alex Christensen <achristen...@webkit.org>
ASSERT NOT REACHED under WebKit::Daemon::ConnectionToMachService seen with TestWebKitAPI.WebPushD.BasicCommunication and PermissionManagement
Modified: trunk/Source/WebKit/Scripts/webkit/messages.py (287320 => 287321)
--- trunk/Source/WebKit/Scripts/webkit/messages.py 2021-12-21 17:58:56 UTC (rev 287320)
+++ trunk/Source/WebKit/Scripts/webkit/messages.py 2021-12-21 18:17:38 UTC (rev 287321)
@@ -802,6 +802,8 @@
'WebCore::MediaProducerMediaState': ['<WebCore/MediaProducer.h>'],
'WebCore::MediaProducerMutedState': ['<WebCore/MediaProducer.h>'],
'WebCore::MessagePortChannelProvider::HasActivity': ['<WebCore/MessagePortChannelProvider.h>'],
+ 'WebCore::ModalContainerControlType': ['<WebCore/ModalContainerTypes.h>'],
+ 'WebCore::ModalContainerDecision': ['<WebCore/ModalContainerTypes.h>'],
'WebCore::MouseEventPolicy': ['<WebCore/DocumentLoader.h>'],
'WebCore::MoveData': ['<WebCore/InlinePathData.h>'],
'WebCore::NetworkTransactionInformation': ['<WebCore/NetworkLoadInformation.h>'],
Modified: trunk/Source/WebKit/SourcesCocoa.txt (287320 => 287321)
--- trunk/Source/WebKit/SourcesCocoa.txt 2021-12-21 17:58:56 UTC (rev 287320)
+++ trunk/Source/WebKit/SourcesCocoa.txt 2021-12-21 18:17:38 UTC (rev 287321)
@@ -287,6 +287,7 @@
UIProcess/API/Cocoa/_WKInspectorWindow.mm
UIProcess/API/Cocoa/_WKInternalDebugFeature.mm
UIProcess/API/Cocoa/_WKLinkIconParameters.mm
+UIProcess/API/Cocoa/_WKModalContainerInfo.mm
UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm
UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm
UIProcess/API/Cocoa/_WKResourceLoadInfo.mm
Modified: trunk/Source/WebKit/UIProcess/API/APIUIClient.h (287320 => 287321)
--- trunk/Source/WebKit/UIProcess/API/APIUIClient.h 2021-12-21 17:58:56 UTC (rev 287320)
+++ trunk/Source/WebKit/UIProcess/API/APIUIClient.h 2021-12-21 18:17:38 UTC (rev 287321)
@@ -32,6 +32,7 @@
#include "WebPageProxy.h"
#include <WebCore/CookieConsentDecisionResult.h>
#include <WebCore/FloatRect.h>
+#include <WebCore/ModalContainerTypes.h>
#include <wtf/CompletionHandler.h>
#if PLATFORM(COCOA)
@@ -146,6 +147,7 @@
virtual void decidePolicyForNotificationPermissionRequest(WebKit::WebPageProxy&, SecurityOrigin&, CompletionHandler<void(bool allowed)>&& completionHandler) { completionHandler(false); }
virtual void requestStorageAccessConfirm(WebKit::WebPageProxy&, WebKit::WebFrameProxy*, const WebCore::RegistrableDomain& requestingDomain, const WebCore::RegistrableDomain& currentDomain, CompletionHandler<void(bool)>&& completionHandler) { completionHandler(true); }
virtual void requestCookieConsent(CompletionHandler<void(WebCore::CookieConsentDecisionResult)>&& completionHandler) { completionHandler(WebCore::CookieConsentDecisionResult::NotSupported); }
+ virtual void decidePolicyForModalContainer(OptionSet<WebCore::ModalContainerControlType>, CompletionHandler<void(WebCore::ModalContainerDecision)>&& completion) { completion(WebCore::ModalContainerDecision::Show); }
// Printing.
virtual float headerHeight(WebKit::WebPageProxy&, WebKit::WebFrameProxy&) { return 0; }
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h (287320 => 287321)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h 2021-12-21 17:58:56 UTC (rev 287320)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h 2021-12-21 18:17:38 UTC (rev 287321)
@@ -42,6 +42,7 @@
@class _WKInspector;
@class _WKInspectorConfiguration;
@class _WKInspectorDebuggableInfo;
+@class _WKModalContainerInfo;
#if TARGET_OS_IOS
@@ -103,6 +104,13 @@
_WKXRSessionFeatureFlagsReferenceSpaceTypeUnbounded = 1 << 4,
} WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
+typedef NS_ENUM(NSInteger, _WKModalContainerDecision) {
+ _WKModalContainerDecisionShow,
+ _WKModalContainerDecisionHideAndIgnore,
+ _WKModalContainerDecisionHideAndAllow,
+ _WKModalContainerDecisionHideAndDisallow,
+} WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
+
@protocol WKUIDelegatePrivate <WKUIDelegate>
#ifdef FOUNDATION_HAS_DIRECTIONAL_GEOMETRY
@@ -181,6 +189,8 @@
- (void)_webView:(WKWebView *)webView requestCookieConsentWithMoreInfoHandler:(void (^)(void))moreInfoHandler decisionHandler:(void (^)(BOOL))decisionHandler WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
+- (void)_webView:(WKWebView *)webView decidePolicyForModalContainer:(_WKModalContainerInfo *)containerInfo decisionHandler:(void (^)(_WKModalContainerDecision))decisionHandler WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
+
#if TARGET_OS_IPHONE
- (BOOL)_webView:(WKWebView *)webView shouldIncludeAppLinkActionsForElement:(_WKActivatedElementInfo *)element WK_API_AVAILABLE(ios(9.0));
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebpagePreferences.mm (287320 => 287321)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebpagePreferences.mm 2021-12-21 17:58:56 UTC (rev 287320)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebpagePreferences.mm 2021-12-21 18:17:38 UTC (rev 287321)
@@ -111,10 +111,6 @@
return _WKWebsiteModalContainerObservationPolicyDisabled;
case WebCore::ModalContainerObservationPolicy::Prompt:
return _WKWebsiteModalContainerObservationPolicyPrompt;
- case WebCore::ModalContainerObservationPolicy::Allow:
- return _WKWebsiteModalContainerObservationPolicyAllow;
- case WebCore::ModalContainerObservationPolicy::Disallow:
- return _WKWebsiteModalContainerObservationPolicyDisallow;
}
ASSERT_NOT_REACHED();
return _WKWebsiteModalContainerObservationPolicyDisabled;
@@ -127,10 +123,6 @@
return WebCore::ModalContainerObservationPolicy::Disabled;
case _WKWebsiteModalContainerObservationPolicyPrompt:
return WebCore::ModalContainerObservationPolicy::Prompt;
- case _WKWebsiteModalContainerObservationPolicyAllow:
- return WebCore::ModalContainerObservationPolicy::Allow;
- case _WKWebsiteModalContainerObservationPolicyDisallow:
- return WebCore::ModalContainerObservationPolicy::Disallow;
}
ASSERT_NOT_REACHED();
return WebCore::ModalContainerObservationPolicy::Disabled;
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h (287320 => 287321)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h 2021-12-21 17:58:56 UTC (rev 287320)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h 2021-12-21 18:17:38 UTC (rev 287321)
@@ -65,8 +65,6 @@
typedef NS_OPTIONS(NSUInteger, _WKWebsiteModalContainerObservationPolicy) {
_WKWebsiteModalContainerObservationPolicyDisabled,
_WKWebsiteModalContainerObservationPolicyPrompt,
- _WKWebsiteModalContainerObservationPolicyAllow,
- _WKWebsiteModalContainerObservationPolicyDisallow,
} WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
// Allow overriding the system color-scheme with a per-website preference.
Copied: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKModalContainerInfo.h (from rev 287320, trunk/Source/WebCore/page/ModalContainerControlType.h) (0 => 287321)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKModalContainerInfo.h (rev 0)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKModalContainerInfo.h 2021-12-21 18:17:38 UTC (rev 287321)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2021 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. 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.
+ */
+
+#import <Foundation/Foundation.h>
+#import <WebKit/WKFoundation.h>
+
+typedef NS_OPTIONS(NSUInteger, _WKModalContainerControlTypes) {
+ _WKModalContainerControlTypeNeutral = 1 << 0,
+ _WKModalContainerControlTypePositive = 1 << 1,
+ _WKModalContainerControlTypeNegative = 1 << 2,
+} WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
+
+WK_CLASS_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA))
+@interface _WKModalContainerInfo : NSObject
+
+@property (nonatomic, readonly) _WKModalContainerControlTypes availableTypes;
+
+@end
Copied: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKModalContainerInfo.mm (from rev 287320, trunk/Source/WebCore/page/ModalContainerControlType.h) (0 => 287321)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKModalContainerInfo.mm (rev 0)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKModalContainerInfo.mm 2021-12-21 18:17:38 UTC (rev 287321)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2021 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. 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.
+ */
+
+#import "config.h"
+#import "_WKModalContainerInfoInternal.h"
+
+#import <WebCore/ModalContainerTypes.h>
+
+@implementation _WKModalContainerInfo
+
+- (instancetype)initWithTypes:(OptionSet<WebCore::ModalContainerControlType>)types
+{
+ if (!(self = [super init]))
+ return nil;
+
+ if (types.contains(WebCore::ModalContainerControlType::Positive))
+ _availableTypes |= _WKModalContainerControlTypePositive;
+
+ if (types.contains(WebCore::ModalContainerControlType::Negative))
+ _availableTypes |= _WKModalContainerControlTypeNegative;
+
+ if (types.contains(WebCore::ModalContainerControlType::Neutral))
+ _availableTypes |= _WKModalContainerControlTypeNeutral;
+
+ return self;
+}
+
+@end
Copied: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKModalContainerInfoInternal.h (from rev 287320, trunk/Source/WebCore/page/ModalContainerControlType.h) (0 => 287321)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKModalContainerInfoInternal.h (rev 0)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKModalContainerInfoInternal.h 2021-12-21 18:17:38 UTC (rev 287321)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2021 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. 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
+
+#import "_WKModalContainerInfo.h"
+#import <wtf/OptionSet.h>
+
+namespace WebCore {
+enum class ModalContainerControlType : uint8_t;
+}
+
+@interface _WKModalContainerInfo (WebKitInternal)
+
+- (instancetype)initWithTypes:(OptionSet<WebCore::ModalContainerControlType>)types;
+
+@end
Modified: trunk/Source/WebKit/UIProcess/Cocoa/ModalContainerControlClassifier.mm (287320 => 287321)
--- trunk/Source/WebKit/UIProcess/Cocoa/ModalContainerControlClassifier.mm 2021-12-21 17:58:56 UTC (rev 287320)
+++ trunk/Source/WebKit/UIProcess/Cocoa/ModalContainerControlClassifier.mm 2021-12-21 18:17:38 UTC (rev 287321)
@@ -26,7 +26,7 @@
#import "config.h"
#import "ModalContainerControlClassifier.h"
-#import <WebCore/ModalContainerControlType.h>
+#import <WebCore/ModalContainerTypes.h>
#import <pal/cocoa/CoreMLSoftLink.h>
#import <pal/cocoa/NaturalLanguageSoftLink.h>
Modified: trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.h (287320 => 287321)
--- trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.h 2021-12-21 17:58:56 UTC (rev 287320)
+++ trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.h 2021-12-21 18:17:38 UTC (rev 287321)
@@ -107,6 +107,7 @@
void handleAutoplayEvent(WebPageProxy&, WebCore::AutoplayEvent, OptionSet<WebCore::AutoplayEventFlags>) final;
void decidePolicyForNotificationPermissionRequest(WebPageProxy&, API::SecurityOrigin&, CompletionHandler<void(bool allowed)>&&) final;
void requestCookieConsent(CompletionHandler<void(WebCore::CookieConsentDecisionResult)>&&) final;
+ void decidePolicyForModalContainer(OptionSet<WebCore::ModalContainerControlType>, CompletionHandler<void(WebCore::ModalContainerDecision)>&&) final;
#if PLATFORM(MAC)
void showPage(WebPageProxy*) final;
@@ -274,6 +275,7 @@
#endif
bool webViewRequestNotificationPermissionForSecurityOriginDecisionHandler : 1;
bool webViewRequestCookieConsentWithMoreInfoHandlerDecisionHandler : 1;
+ bool webViewDecidePolicyForModalContainerDecisionHandler : 1;
} m_delegateMethods;
};
Modified: trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm (287320 => 287321)
--- trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm 2021-12-21 17:58:56 UTC (rev 287320)
+++ trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm 2021-12-21 18:17:38 UTC (rev 287321)
@@ -57,6 +57,7 @@
#import "_WKHitTestResultInternal.h"
#import "_WKInspectorConfigurationInternal.h"
#import "_WKInspectorInternal.h"
+#import "_WKModalContainerInfoInternal.h"
#import "_WKWebAuthenticationPanelInternal.h"
#import <AVFoundation/AVCaptureDevice.h>
#import <AVFoundation/AVMediaFormat.h>
@@ -199,6 +200,7 @@
#endif
m_delegateMethods.webViewRequestNotificationPermissionForSecurityOriginDecisionHandler = [delegate respondsToSelector:@selector(_webView:requestNotificationPermissionForSecurityOrigin:decisionHandler:)];
m_delegateMethods.webViewRequestCookieConsentWithMoreInfoHandlerDecisionHandler = [delegate respondsToSelector:@selector(_webView:requestCookieConsentWithMoreInfoHandler:decisionHandler:)];
+ m_delegateMethods.webViewDecidePolicyForModalContainerDecisionHandler = [delegate respondsToSelector:@selector(_webView:decidePolicyForModalContainer:decisionHandler:)];
}
#if ENABLE(CONTEXT_MENUS)
@@ -665,6 +667,44 @@
}).get()];
}
+static WebCore::ModalContainerDecision coreModalContainerDecision(_WKModalContainerDecision decision)
+{
+ switch (decision) {
+ case _WKModalContainerDecisionShow:
+ return WebCore::ModalContainerDecision::Show;
+ case _WKModalContainerDecisionHideAndIgnore:
+ return WebCore::ModalContainerDecision::HideAndIgnore;
+ case _WKModalContainerDecisionHideAndAllow:
+ return WebCore::ModalContainerDecision::HideAndAllow;
+ case _WKModalContainerDecisionHideAndDisallow:
+ return WebCore::ModalContainerDecision::HideAndDisallow;
+ }
+ return WebCore::ModalContainerDecision::Show;
+}
+
+void UIDelegate::UIClient::decidePolicyForModalContainer(OptionSet<WebCore::ModalContainerControlType> controlTypes, CompletionHandler<void(WebCore::ModalContainerDecision)>&& completion)
+{
+ if (!m_uiDelegate)
+ return completion(WebCore::ModalContainerDecision::Show);
+
+ if (!m_uiDelegate->m_delegateMethods.webViewDecidePolicyForModalContainerDecisionHandler)
+ return completion(WebCore::ModalContainerDecision::Show);
+
+ auto delegate = m_uiDelegate->m_delegate.get();
+ if (!delegate)
+ return completion(WebCore::ModalContainerDecision::Show);
+
+ auto checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(_webView:decidePolicyForModalContainer:decisionHandler:));
+ auto info = adoptNS([[_WKModalContainerInfo alloc] initWithTypes:controlTypes]);
+ [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate->m_webView.get().get() decidePolicyForModalContainer:info.get() decisionHandler:makeBlockPtr([completion = WTFMove(completion), checker = WTFMove(checker)] (_WKModalContainerDecision decision) mutable {
+ if (checker->completionHandlerHasBeenCalled())
+ return;
+
+ checker->didCallCompletionHandler();
+ completion(coreModalContainerDecision(decision));
+ }).get()];
+}
+
#if PLATFORM(MAC)
bool UIDelegate::UIClient::canRunModal() const
{
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (287320 => 287321)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2021-12-21 17:58:56 UTC (rev 287320)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2021-12-21 18:17:38 UTC (rev 287321)
@@ -169,7 +169,7 @@
#include <WebCore/LengthBox.h>
#include <WebCore/MIMETypeRegistry.h>
#include <WebCore/MediaStreamRequest.h>
-#include <WebCore/ModalContainerControlType.h>
+#include <WebCore/ModalContainerTypes.h>
#include <WebCore/PerformanceLoggingClient.h>
#include <WebCore/PermissionState.h>
#include <WebCore/PlatformEvent.h>
@@ -11057,6 +11057,11 @@
m_uiClient->requestCookieConsent(WTFMove(completion));
}
+void WebPageProxy::decidePolicyForModalContainer(OptionSet<ModalContainerControlType> types, CompletionHandler<void(ModalContainerDecision)>&& completion)
+{
+ m_uiClient->decidePolicyForModalContainer(types, WTFMove(completion));
+}
+
} // namespace WebKit
#undef WEBPAGEPROXY_RELEASE_LOG
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (287320 => 287321)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2021-12-21 17:58:56 UTC (rev 287320)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2021-12-21 18:17:38 UTC (rev 287321)
@@ -275,6 +275,7 @@
enum class HighlightRequestOriginatedInApp : bool;
enum class HighlightVisibility : bool;
enum class ModalContainerControlType : uint8_t;
+enum class ModalContainerDecision : uint8_t;
enum class MouseEventPolicy : uint8_t;
enum class NotificationDirection : uint8_t;
enum class RouteSharingPolicy : uint8_t;
@@ -2038,6 +2039,7 @@
void requestCookieConsent(CompletionHandler<void(WebCore::CookieConsentDecisionResult)>&&);
void classifyModalContainerControls(Vector<String>&& texts, CompletionHandler<void(Vector<WebCore::ModalContainerControlType>&&)>&&);
+ void decidePolicyForModalContainer(OptionSet<WebCore::ModalContainerControlType>, CompletionHandler<void(WebCore::ModalContainerDecision)>&&);
private:
WebPageProxy(PageClient&, WebProcessProxy&, Ref<API::PageConfiguration>&&);
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in (287320 => 287321)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2021-12-21 17:58:56 UTC (rev 287320)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2021-12-21 18:17:38 UTC (rev 287321)
@@ -616,4 +616,5 @@
RequestCookieConsent() -> (enum:uint8_t WebCore::CookieConsentDecisionResult result) Async
ClassifyModalContainerControls(Vector<String> texts) -> (Vector<WebCore::ModalContainerControlType> types) Async
+ DecidePolicyForModalContainer(OptionSet<WebCore::ModalContainerControlType> types) -> (enum:uint8_t WebCore::ModalContainerDecision decision) Async
}
Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (287320 => 287321)
--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2021-12-21 17:58:56 UTC (rev 287320)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2021-12-21 18:17:38 UTC (rev 287321)
@@ -2012,6 +2012,8 @@
F4D985C82690FC1200BBCCBE /* _WKTapHandlingResult.h in Headers */ = {isa = PBXBuildFile; fileRef = F4D985C72690FBEF00BBCCBE /* _WKTapHandlingResult.h */; settings = {ATTRIBUTES = (Private, ); }; };
F4D985CB2691096600BBCCBE /* TapHandlingResult.h in Headers */ = {isa = PBXBuildFile; fileRef = F4E2B44A268FDE1A00327ABC /* TapHandlingResult.h */; };
F4DB54E62319E733009E3155 /* WKHighlightLongPressGestureRecognizer.h in Headers */ = {isa = PBXBuildFile; fileRef = F4DB54E42319E733009E3155 /* WKHighlightLongPressGestureRecognizer.h */; };
+ F4DBC0BE276AA6A70001D169 /* _WKModalContainerInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = F4DBC0BC276AA6A70001D169 /* _WKModalContainerInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ F4DBC0C1276AA6CA0001D169 /* _WKModalContainerInfoInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = F4DBC0C0276AA6CA0001D169 /* _WKModalContainerInfoInternal.h */; };
F4EB4AFD269CD7F300D297AE /* OSStateSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = F4EB4AFC269CD23600D297AE /* OSStateSPI.h */; };
F4EC94E32356CC57000BB614 /* ApplicationServicesSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 29D04E2821F7C73D0076741D /* ApplicationServicesSPI.h */; };
F4FE0A3B24632B60002631E1 /* CocoaColor.h in Headers */ = {isa = PBXBuildFile; fileRef = F4FE0A3A24632B10002631E1 /* CocoaColor.h */; };
@@ -6438,6 +6440,9 @@
F4D985C72690FBEF00BBCCBE /* _WKTapHandlingResult.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _WKTapHandlingResult.h; sourceTree = "<group>"; };
F4DB54E42319E733009E3155 /* WKHighlightLongPressGestureRecognizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKHighlightLongPressGestureRecognizer.h; path = ios/WKHighlightLongPressGestureRecognizer.h; sourceTree = "<group>"; };
F4DB54E52319E733009E3155 /* WKHighlightLongPressGestureRecognizer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKHighlightLongPressGestureRecognizer.mm; path = ios/WKHighlightLongPressGestureRecognizer.mm; sourceTree = "<group>"; };
+ F4DBC0BC276AA6A70001D169 /* _WKModalContainerInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKModalContainerInfo.h; sourceTree = "<group>"; };
+ F4DBC0BD276AA6A70001D169 /* _WKModalContainerInfo.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKModalContainerInfo.mm; sourceTree = "<group>"; };
+ F4DBC0C0276AA6CA0001D169 /* _WKModalContainerInfoInternal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _WKModalContainerInfoInternal.h; sourceTree = "<group>"; };
F4E2B44A268FDE1A00327ABC /* TapHandlingResult.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = TapHandlingResult.h; path = ios/TapHandlingResult.h; sourceTree = "<group>"; };
F4EB4AFC269CD23600D297AE /* OSStateSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OSStateSPI.h; sourceTree = "<group>"; };
F4F59AD32065A5C9006CAA46 /* WKSelectMenuListViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKSelectMenuListViewController.mm; path = ios/forms/WKSelectMenuListViewController.mm; sourceTree = "<group>"; };
@@ -8679,6 +8684,9 @@
51C0C9791DDD78540032CAD3 /* _WKLinkIconParameters.h */,
51C0C97A1DDD78540032CAD3 /* _WKLinkIconParameters.mm */,
51C0C97B1DDD78540032CAD3 /* _WKLinkIconParametersInternal.h */,
+ F4DBC0BC276AA6A70001D169 /* _WKModalContainerInfo.h */,
+ F4DBC0BD276AA6A70001D169 /* _WKModalContainerInfo.mm */,
+ F4DBC0C0276AA6CA0001D169 /* _WKModalContainerInfoInternal.h */,
9323611D1B015DA800FA9232 /* _WKOverlayScrollbarStyle.h */,
1A43E828188F3CDC009E4D30 /* _WKProcessPoolConfiguration.h */,
1A43E827188F3CDC009E4D30 /* _WKProcessPoolConfiguration.mm */,
@@ -12634,6 +12642,8 @@
31B362972141EBD9007BFA53 /* _WKInternalDebugFeatureInternal.h in Headers */,
2D790A9D1AD7050D00AB90B3 /* _WKLayoutMode.h in Headers */,
510F59111DDE297000412FF5 /* _WKLinkIconParameters.h in Headers */,
+ F4DBC0BE276AA6A70001D169 /* _WKModalContainerInfo.h in Headers */,
+ F4DBC0C1276AA6CA0001D169 /* _WKModalContainerInfoInternal.h in Headers */,
A118A9F31908B8EA00F7C92B /* _WKNSFileManagerExtras.h in Headers */,
A5C0F0A72000654D00536536 /* _WKNSWindowExtras.h in Headers */,
9323611E1B015DA800FA9232 /* _WKOverlayScrollbarStyle.h in Headers */,
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp (287320 => 287321)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp 2021-12-21 17:58:56 UTC (rev 287320)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp 2021-12-21 18:17:38 UTC (rev 287321)
@@ -1573,6 +1573,11 @@
m_page.sendWithAsyncReply(Messages::WebPageProxy::ClassifyModalContainerControls(WTFMove(strings)), WTFMove(completion));
}
+void WebChromeClient::decidePolicyForModalContainer(OptionSet<ModalContainerControlType> types, CompletionHandler<void(ModalContainerDecision)>&& completion)
+{
+ m_page.sendWithAsyncReply(Messages::WebPageProxy::DecidePolicyForModalContainer(types), WTFMove(completion));
+}
+
#if USE(APPLE_INTERNAL_SDK)
#include <WebKitAdditions/WebChromeClientAdditions.cpp>
#else
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h (287320 => 287321)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h 2021-12-21 17:58:56 UTC (rev 287320)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h 2021-12-21 18:17:38 UTC (rev 287321)
@@ -468,6 +468,8 @@
void classifyModalContainerControls(Vector<String>&&, CompletionHandler<void(Vector<WebCore::ModalContainerControlType>&&)>&&) final;
+ void decidePolicyForModalContainer(OptionSet<WebCore::ModalContainerControlType>, CompletionHandler<void(WebCore::ModalContainerDecision)>&&) final;
+
const AtomString& searchStringForModalContainerObserver() const final;
mutable bool m_cachedMainFrameHasHorizontalScrollbar { false };
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (287320 => 287321)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2021-12-21 17:58:56 UTC (rev 287320)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2021-12-21 18:17:38 UTC (rev 287321)
@@ -1,3 +1,17 @@
+2021-12-21 Wenson Hsieh <wenson_hs...@apple.com>
+
+ Add support for a UI delegate method to decide how to handle detected modal containers
+ https://bugs.webkit.org/show_bug.cgi?id=234440
+ rdar://77073735
+
+ Reviewed by Darin Adler.
+
+ See WebKit ChangeLog for more details.
+
+ * WebCoreSupport/WebChromeClient.h:
+ * WebCoreSupport/WebChromeClient.mm:
+ (WebChromeClient::decidePolicyForModalContainer):
+
2021-12-19 Wenson Hsieh <wenson_hs...@apple.com>
Add client layer plumbing for classifying modal container controls
Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h (287320 => 287321)
--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h 2021-12-21 17:58:56 UTC (rev 287320)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h 2021-12-21 18:17:38 UTC (rev 287321)
@@ -261,6 +261,8 @@
void classifyModalContainerControls(Vector<String>&&, CompletionHandler<void(Vector<WebCore::ModalContainerControlType>&&)>&&) final;
+ void decidePolicyForModalContainer(OptionSet<WebCore::ModalContainerControlType>, CompletionHandler<void(WebCore::ModalContainerDecision)>&&) final;
+
#if ENABLE(VIDEO_PRESENTATION_MODE)
bool m_mockVideoPresentationModeEnabled { false };
#endif
Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm (287320 => 287321)
--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm 2021-12-21 17:58:56 UTC (rev 287320)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm 2021-12-21 18:17:38 UTC (rev 287321)
@@ -78,7 +78,7 @@
#import <WebCore/Icon.h>
#import <WebCore/IntPoint.h>
#import <WebCore/IntRect.h>
-#import <WebCore/ModalContainerControlType.h>
+#import <WebCore/ModalContainerTypes.h>
#import <WebCore/NavigationAction.h>
#import <WebCore/NotImplemented.h>
#import <WebCore/Page.h>
@@ -1178,3 +1178,8 @@
{
completion({ });
}
+
+void WebChromeClient::decidePolicyForModalContainer(OptionSet<ModalContainerControlType>, CompletionHandler<void(ModalContainerDecision)>&& completion)
+{
+ completion(ModalContainerDecision::Show);
+}
Modified: trunk/Source/WebKitLegacy/win/ChangeLog (287320 => 287321)
--- trunk/Source/WebKitLegacy/win/ChangeLog 2021-12-21 17:58:56 UTC (rev 287320)
+++ trunk/Source/WebKitLegacy/win/ChangeLog 2021-12-21 18:17:38 UTC (rev 287321)
@@ -1,3 +1,17 @@
+2021-12-21 Wenson Hsieh <wenson_hs...@apple.com>
+
+ Add support for a UI delegate method to decide how to handle detected modal containers
+ https://bugs.webkit.org/show_bug.cgi?id=234440
+ rdar://77073735
+
+ Reviewed by Darin Adler.
+
+ See WebKit ChangeLog for more details.
+
+ * WebCoreSupport/WebChromeClient.h:
+ * WebCoreSupport/WebChromeClient.cpp:
+ (WebChromeClient::decidePolicyForModalContainer):
+
2021-12-21 Sam Weinig <wei...@apple.com>
Add support for premultiplied alpha interpolated gradients and defaulted off option to use them for CSS Gradients
Modified: trunk/Source/WebKitLegacy/win/WebCoreSupport/WebChromeClient.cpp (287320 => 287321)
--- trunk/Source/WebKitLegacy/win/WebCoreSupport/WebChromeClient.cpp 2021-12-21 17:58:56 UTC (rev 287320)
+++ trunk/Source/WebKitLegacy/win/WebCoreSupport/WebChromeClient.cpp 2021-12-21 18:17:38 UTC (rev 287321)
@@ -53,7 +53,7 @@
#include <WebCore/Icon.h>
#include <WebCore/LocalWindowsContext.h>
#include <WebCore/LocalizedStrings.h>
-#include <WebCore/ModalContainerControlType.h>
+#include <WebCore/ModalContainerTypes.h>
#include <WebCore/NavigationAction.h>
#include <WebCore/NotImplemented.h>
#include <WebCore/Page.h>
@@ -887,3 +887,8 @@
{
completion({ });
}
+
+void WebChromeClient::decidePolicyForModalContainer(OptionSet<ModalContainerControlType>, CompletionHandler<void(ModalContainerDecision)>&& completion)
+{
+ completion(ModalContainerDecision::Show);
+}
Modified: trunk/Source/WebKitLegacy/win/WebCoreSupport/WebChromeClient.h (287320 => 287321)
--- trunk/Source/WebKitLegacy/win/WebCoreSupport/WebChromeClient.h 2021-12-21 17:58:56 UTC (rev 287320)
+++ trunk/Source/WebKitLegacy/win/WebCoreSupport/WebChromeClient.h 2021-12-21 18:17:38 UTC (rev 287321)
@@ -187,6 +187,8 @@
void classifyModalContainerControls(Vector<String>&&, CompletionHandler<void(Vector<WebCore::ModalContainerControlType>&&)>&&) final;
+ void decidePolicyForModalContainer(OptionSet<WebCore::ModalContainerControlType>, CompletionHandler<void(WebCore::ModalContainerDecision)>&&) final;
+
private:
COMPtr<IWebUIDelegate> uiDelegate();