Diff
Modified: trunk/LayoutTests/ChangeLog (292799 => 292800)
--- trunk/LayoutTests/ChangeLog 2022-04-13 04:27:16 UTC (rev 292799)
+++ trunk/LayoutTests/ChangeLog 2022-04-13 04:58:17 UTC (rev 292800)
@@ -1,3 +1,13 @@
+2022-04-12 Wenson Hsieh <[email protected]>
+
+ Remove support for drawing cropped image overlays when hovering over "Copy Cropped Image"
+ https://bugs.webkit.org/show_bug.cgi?id=239269
+
+ Reviewed by Darin Adler.
+
+ * fast/images/text-recognition/image-overlay-cropped-image-expected.txt: Removed.
+ * fast/images/text-recognition/image-overlay-cropped-image.html: Removed.
+
2022-04-12 Devin Rousso <[email protected]>
[Modern Media Controls] allow skipping by durations other than 15s
Deleted: trunk/LayoutTests/fast/images/text-recognition/image-overlay-cropped-image-expected.txt (292799 => 292800)
--- trunk/LayoutTests/fast/images/text-recognition/image-overlay-cropped-image-expected.txt 2022-04-13 04:27:16 UTC (rev 292799)
+++ trunk/LayoutTests/fast/images/text-recognition/image-overlay-cropped-image-expected.txt 2022-04-13 04:58:17 UTC (rev 292800)
@@ -1,13 +0,0 @@
-
-PASS croppedImage is non-null.
-PASS croppedImageBackdrop is non-null.
-PASS croppedImageRect.x is 100
-PASS croppedImageRect.y is 100
-PASS croppedImageRect.width is 200
-PASS croppedImageRect.height is 200
-PASS croppedImage is null
-PASS croppedImageBackdrop is null
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
Deleted: trunk/LayoutTests/fast/images/text-recognition/image-overlay-cropped-image.html (292799 => 292800)
--- trunk/LayoutTests/fast/images/text-recognition/image-overlay-cropped-image.html 2022-04-13 04:27:16 UTC (rev 292799)
+++ trunk/LayoutTests/fast/images/text-recognition/image-overlay-cropped-image.html 2022-04-13 04:58:17 UTC (rev 292800)
@@ -1,40 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<script src=""
-<style>
-body, html {
- margin: 0;
-}
-</style>
-</head>
-<body>
-<img src=""
-<pre id="console"></pre>
-<script>
-addEventListener("load", () => {
- const image = document.querySelector("img");
-
- internals.installCroppedImageOverlay(image, new DOMRectReadOnly(0.25, 0.25, 0.5, 0.5));
-
- croppedImage = internals.shadowRoot(image).getElementById("image-overlay-cropped-image");
- croppedImageBackdrop = internals.shadowRoot(image).getElementById("image-overlay-cropped-image-backdrop");
- shouldBeNonNull("croppedImage");
- shouldBeNonNull("croppedImageBackdrop");
-
- croppedImageRect = croppedImage.getBoundingClientRect();
- shouldBe("croppedImageRect.x", "100");
- shouldBe("croppedImageRect.y", "100");
- shouldBe("croppedImageRect.width", "200");
- shouldBe("croppedImageRect.height", "200");
-
- internals.uninstallCroppedImageOverlay();
-
- croppedImage = internals.shadowRoot(image).getElementById("image-overlay-cropped-image");
- croppedImageBackdrop = internals.shadowRoot(image).getElementById("image-overlay-cropped-image-backdrop");
- shouldBeNull("croppedImage");
- shouldBeNull("croppedImageBackdrop");
-});
-</script>
-</body>
-</html>
\ No newline at end of file
Modified: trunk/Source/WebCore/ChangeLog (292799 => 292800)
--- trunk/Source/WebCore/ChangeLog 2022-04-13 04:27:16 UTC (rev 292799)
+++ trunk/Source/WebCore/ChangeLog 2022-04-13 04:58:17 UTC (rev 292800)
@@ -1,3 +1,31 @@
+2022-04-12 Wenson Hsieh <[email protected]>
+
+ Remove support for drawing cropped image overlays when hovering over "Copy Cropped Image"
+ https://bugs.webkit.org/show_bug.cgi?id=239269
+
+ Reviewed by Darin Adler.
+
+ Revert <https://trac.webkit.org/r290211> -- the corresponding UI is no longer plan of record.
+
+ * dom/ImageOverlay.cpp:
+ (WebCore::ImageOverlay::installImageOverlayStyleSheet):
+ (WebCore::ImageOverlay::imageOverlayCroppedImageIdentifier): Deleted.
+ (WebCore::ImageOverlay::imageOverlayCroppedImageBackdropIdentifier): Deleted.
+ (WebCore::ImageOverlay::CroppedImage::install): Deleted.
+ (WebCore::ImageOverlay::CroppedImage::CroppedImage): Deleted.
+ (WebCore::ImageOverlay::CroppedImage::~CroppedImage): Deleted.
+ (WebCore::ImageOverlay::CroppedImage::setVisibility): Deleted.
+ * dom/ImageOverlay.h:
+ * html/shadow/imageOverlay.css:
+ (div.image-overlay-data-detector-result):
+ (img#image-overlay-cropped-image): Deleted.
+ (div#image-overlay-cropped-image-backdrop): Deleted.
+ * testing/Internals.cpp:
+ (WebCore::Internals::installCroppedImageOverlay): Deleted.
+ (WebCore::Internals::uninstallCroppedImageOverlay): Deleted.
+ * testing/Internals.h:
+ * testing/Internals.idl:
+
2022-04-12 Asumu Takikawa <[email protected]>
Allow Wasm import from a JS Worker module
Modified: trunk/Source/WebCore/dom/ImageOverlay.cpp (292799 => 292800)
--- trunk/Source/WebCore/dom/ImageOverlay.cpp 2022-04-13 04:27:16 UTC (rev 292799)
+++ trunk/Source/WebCore/dom/ImageOverlay.cpp 2022-04-13 04:58:17 UTC (rev 292800)
@@ -101,18 +101,6 @@
#endif // ENABLE(IMAGE_ANALYSIS)
-static const AtomString& imageOverlayCroppedImageIdentifier()
-{
- static MainThreadNeverDestroyed<const AtomString> identifier("image-overlay-cropped-image", AtomString::ConstructFromLiteral);
- return identifier;
-}
-
-static const AtomString& imageOverlayCroppedImageBackdropIdentifier()
-{
- static MainThreadNeverDestroyed<const AtomString> identifier("image-overlay-cropped-image-backdrop", AtomString::ConstructFromLiteral);
- return identifier;
-}
-
bool hasOverlay(const HTMLElement& element)
{
auto shadowRoot = element.shadowRoot();
@@ -225,14 +213,6 @@
});
}
-static void installImageOverlayStyleSheet(ShadowRoot& shadowRoot)
-{
- static MainThreadNeverDestroyed<const String> shadowStyle(StringImpl::createWithoutCopying(imageOverlayUserAgentStyleSheet, sizeof(imageOverlayUserAgentStyleSheet)));
- auto style = HTMLStyleElement::create(HTMLNames::styleTag, shadowRoot.document(), false);
- style->setTextContent(shadowStyle);
- shadowRoot.appendChild(WTFMove(style));
-}
-
IntRect containerRect(HTMLElement& element)
{
auto* renderer = element.renderer();
@@ -247,6 +227,14 @@
#if ENABLE(IMAGE_ANALYSIS)
+static void installImageOverlayStyleSheet(ShadowRoot& shadowRoot)
+{
+ static MainThreadNeverDestroyed<const String> shadowStyle(StringImpl::createWithoutCopying(imageOverlayUserAgentStyleSheet, sizeof(imageOverlayUserAgentStyleSheet)));
+ auto style = HTMLStyleElement::create(HTMLNames::styleTag, shadowRoot.document(), false);
+ style->setTextContent(shadowStyle);
+ shadowRoot.appendChild(WTFMove(style));
+}
+
struct LineElements {
Ref<HTMLDivElement> line;
Vector<Ref<HTMLElement>> children;
@@ -695,87 +683,5 @@
#endif // ENABLE(IMAGE_ANALYSIS)
-std::unique_ptr<CroppedImage> CroppedImage::install(HTMLElement& host, Ref<SharedBuffer>&& imageData, const String& mimeType, FloatRect normalizedRect)
-{
- Ref document = host.document();
- Ref shadowRoot = host.ensureUserAgentShadowRoot();
- RefPtr imageOverlayRoot = dynamicDowncast<HTMLDivElement>(shadowRoot->getElementById(imageOverlayElementIdentifier()));
- if (!imageOverlayRoot) {
- imageOverlayRoot = HTMLDivElement::create(document.get());
- imageOverlayRoot->setIdAttribute(imageOverlayElementIdentifier());
- imageOverlayRoot->setTranslate(false);
- shadowRoot->appendChild(*imageOverlayRoot);
- installImageOverlayStyleSheet(shadowRoot.get());
- }
-
- document->updateLayoutIgnorePendingStylesheets();
-
- if (auto* renderer = dynamicDowncast<RenderImage>(host.renderer()))
- renderer->setHasImageOverlay();
-
- auto containerRect = ImageOverlay::containerRect(host);
- auto cropRect = normalizedRect;
- cropRect.scale(containerRect.width(), containerRect.height());
- cropRect.move(containerRect.x(), containerRect.y());
-
- auto croppedImageBackdrop = HTMLDivElement::create(document.get());
- croppedImageBackdrop->setIdAttribute(imageOverlayCroppedImageBackdropIdentifier());
- imageOverlayRoot->appendChild(croppedImageBackdrop.get());
-
- auto croppedImage = HTMLImageElement::create(document.get());
- auto croppedImageURL = DOMURL::createObjectURL(document.get(), Blob::create(document.ptr(), imageData->extractData(), mimeType));
- croppedImage->setIdAttribute(imageOverlayCroppedImageIdentifier());
- croppedImage->setAttributeWithoutSynchronization(HTMLNames::srcAttr, croppedImageURL);
- croppedImage->setInlineStyleProperty(CSSPropertyLeft, cropRect.x(), CSSUnitType::CSS_PX);
- croppedImage->setInlineStyleProperty(CSSPropertyTop, cropRect.y(), CSSUnitType::CSS_PX);
- croppedImage->setInlineStyleProperty(CSSPropertyWidth, cropRect.width(), CSSUnitType::CSS_PX);
- croppedImage->setInlineStyleProperty(CSSPropertyHeight, cropRect.height(), CSSUnitType::CSS_PX);
- imageOverlayRoot->appendChild(croppedImage.get());
-
- document->updateLayoutIgnorePendingStylesheets();
- croppedImageBackdrop->setInlineStyleProperty(CSSPropertyOpacity, 0.5, CSSUnitType::CSS_NUMBER);
-
- return makeUnique<CroppedImage>(document.get(), host, croppedImageBackdrop.get(), croppedImageURL);
-}
-
-CroppedImage::CroppedImage(Document& document, HTMLElement& host, HTMLElement& croppedImageBackdrop, const String& imageURL)
- : m_document(document)
- , m_host(host)
- , m_croppedImageBackdrop(croppedImageBackdrop)
- , m_imageURL(imageURL)
-{
- setVisibility(true);
-}
-
-CroppedImage::~CroppedImage()
-{
- if (RefPtr document = m_document.get())
- DOMURL::revokeObjectURL(*document, m_imageURL);
-
- RefPtr host = m_host.get();
- if (!host)
- return;
-
- RefPtr shadowRoot = host->shadowRoot();
- if (!shadowRoot || shadowRoot->mode() != ShadowRootMode::UserAgent)
- return;
-
- if (RefPtr croppedImage = shadowRoot->getElementById(imageOverlayCroppedImageIdentifier()))
- croppedImage->remove();
-
- if (RefPtr croppedImageBackdrop = shadowRoot->getElementById(imageOverlayCroppedImageBackdropIdentifier()))
- croppedImageBackdrop->remove();
-}
-
-void CroppedImage::setVisibility(bool visible)
-{
- RefPtr croppedImageBackdrop = m_croppedImageBackdrop.get();
- if (!croppedImageBackdrop)
- return;
-
- croppedImageBackdrop->document().updateLayoutIgnorePendingStylesheets();
- croppedImageBackdrop->setInlineStyleProperty(CSSPropertyOpacity, visible ? 0.5 : 0, CSSUnitType::CSS_NUMBER);
-}
-
} // namespace ImageOverlay
} // namespace WebCore
Modified: trunk/Source/WebCore/dom/ImageOverlay.h (292799 => 292800)
--- trunk/Source/WebCore/dom/ImageOverlay.h 2022-04-13 04:27:16 UTC (rev 292799)
+++ trunk/Source/WebCore/dom/ImageOverlay.h 2022-04-13 04:58:17 UTC (rev 292800)
@@ -60,24 +60,6 @@
WEBCORE_EXPORT void updateWithTextRecognitionResult(HTMLElement&, const TextRecognitionResult&, CacheTextRecognitionResults = CacheTextRecognitionResults::Yes);
#endif
-class CroppedImage {
- WTF_MAKE_FAST_ALLOCATED;
- WTF_MAKE_NONCOPYABLE(CroppedImage);
-public:
- WEBCORE_EXPORT static std::unique_ptr<CroppedImage> install(HTMLElement&, Ref<SharedBuffer>&&, const String&, FloatRect);
-
- CroppedImage(Document&, HTMLElement&, HTMLElement&, const String& imageURL);
- WEBCORE_EXPORT ~CroppedImage();
-
- WEBCORE_EXPORT void setVisibility(bool);
-
-private:
- WeakPtr<Document> m_document;
- WeakPtr<HTMLElement> m_host;
- WeakPtr<HTMLElement> m_croppedImageBackdrop;
- String m_imageURL;
-};
-
} // namespace ImageOverlay
} // namespace WebCore
Modified: trunk/Source/WebCore/html/shadow/imageOverlay.css (292799 => 292800)
--- trunk/Source/WebCore/html/shadow/imageOverlay.css 2022-04-13 04:27:16 UTC (rev 292799)
+++ trunk/Source/WebCore/html/shadow/imageOverlay.css 2022-04-13 04:58:17 UTC (rev 292800)
@@ -85,18 +85,3 @@
position: absolute;
-webkit-user-select: none;
}
-
-img#image-overlay-cropped-image {
- position: absolute;
- pointer-events: none;
-}
-
-div#image-overlay-cropped-image-backdrop {
- position: absolute;
- background: white;
- width: 100%;
- height: 100%;
- transition: opacity 0.5s ease-in-out;
- opacity: 0;
- pointer-events: none;
-}
Modified: trunk/Source/WebCore/testing/Internals.cpp (292799 => 292800)
--- trunk/Source/WebCore/testing/Internals.cpp 2022-04-13 04:27:16 UTC (rev 292799)
+++ trunk/Source/WebCore/testing/Internals.cpp 2022-04-13 04:58:17 UTC (rev 292800)
@@ -5950,29 +5950,6 @@
#endif
}
-void Internals::installCroppedImageOverlay(Element& element, Ref<DOMRectReadOnly>&& normalizedCropRect)
-{
- RefPtr htmlElement = dynamicDowncast<HTMLElement>(element);
- if (!htmlElement)
- return;
-
- auto imageData = pngDataForTesting();
- if (!imageData)
- return;
-
- m_croppedImageOverlay = ImageOverlay::CroppedImage::install(*htmlElement, imageData.releaseNonNull(), "image/png"_s, {
- static_cast<float>(normalizedCropRect->x()),
- static_cast<float>(normalizedCropRect->y()),
- static_cast<float>(normalizedCropRect->width()),
- static_cast<float>(normalizedCropRect->height())
- });
-}
-
-void Internals::uninstallCroppedImageOverlay()
-{
- m_croppedImageOverlay = nullptr;
-}
-
bool Internals::hasActiveDataDetectorHighlight() const
{
#if ENABLE(DATA_DETECTION) && ENABLE(IMAGE_ANALYSIS)
Modified: trunk/Source/WebCore/testing/Internals.h (292799 => 292800)
--- trunk/Source/WebCore/testing/Internals.h 2022-04-13 04:27:16 UTC (rev 292799)
+++ trunk/Source/WebCore/testing/Internals.h 2022-04-13 04:58:17 UTC (rev 292800)
@@ -986,8 +986,6 @@
};
void installImageOverlay(Element&, Vector<ImageOverlayLine>&&, Vector<ImageOverlayBlock>&& = { }, Vector<ImageOverlayDataDetector>&& = { });
- void installCroppedImageOverlay(Element&, Ref<DOMRectReadOnly>&&);
- void uninstallCroppedImageOverlay();
bool hasActiveDataDetectorHighlight() const;
#if ENABLE(IMAGE_ANALYSIS)
@@ -1353,8 +1351,6 @@
#if ENABLE(VIDEO)
std::unique_ptr<CaptionUserPreferencesTestingModeToken> m_testingModeToken;
#endif
-
- std::unique_ptr<ImageOverlay::CroppedImage> m_croppedImageOverlay;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/testing/Internals.idl (292799 => 292800)
--- trunk/Source/WebCore/testing/Internals.idl 2022-04-13 04:27:16 UTC (rev 292799)
+++ trunk/Source/WebCore/testing/Internals.idl 2022-04-13 04:58:17 UTC (rev 292800)
@@ -998,8 +998,6 @@
[Conditional=IMAGE_ANALYSIS] readonly attribute Element? textRecognitionCandidate;
[Conditional=IMAGE_ANALYSIS] undefined requestTextRecognition(Element element, VoidCallback callback);
undefined installImageOverlay(Element element, sequence<ImageOverlayLine> lines, optional sequence<ImageOverlayBlock> blocks = [], optional sequence<ImageOverlayDataDetector> dataDetectors = []);
- undefined installCroppedImageOverlay(Element element, DOMRectReadOnly normalizedCropRect);
- undefined uninstallCroppedImageOverlay();
readonly attribute boolean hasActiveDataDetectorHighlight;
boolean usingAppleInternalSDK();
Modified: trunk/Source/WebKit/ChangeLog (292799 => 292800)
--- trunk/Source/WebKit/ChangeLog 2022-04-13 04:27:16 UTC (rev 292799)
+++ trunk/Source/WebKit/ChangeLog 2022-04-13 04:58:17 UTC (rev 292800)
@@ -1,3 +1,34 @@
+2022-04-12 Wenson Hsieh <[email protected]>
+
+ Remove support for drawing cropped image overlays when hovering over "Copy Cropped Image"
+ https://bugs.webkit.org/show_bug.cgi?id=239269
+
+ Reviewed by Darin Adler.
+
+ * Shared/ContextMenuContextData.cpp:
+ (WebKit::ContextMenuContextData::ContextMenuContextData):
+ (WebKit::ContextMenuContextData::encode const):
+ (WebKit::ContextMenuContextData::decode):
+ * Shared/ContextMenuContextData.h:
+ (WebKit::ContextMenuContextData::hitTestedElementContext const): Deleted.
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::didDismissContextMenu):
+ (WebKit::WebPageProxy::resetStateAfterProcessExited):
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/mac/WebContextMenuProxyMac.mm:
+ (-[WKMenuDelegate menu:willHighlightItem:]): Deleted.
+ * UIProcess/mac/WebPageProxyMac.mm:
+ (WebKit::WebPageProxy::handleContextMenuCopyCroppedImage):
+ (WebKit::WebPageProxy::willHighlightContextMenuItem): Deleted.
+ * WebProcess/WebPage/WebContextMenu.cpp:
+ (WebKit::WebContextMenu::show):
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::didDismissContextMenu):
+ (WebKit::WebPage::installCroppedImageOverlay): Deleted.
+ (WebKit::WebPage::setCroppedImageOverlayVisibility): Deleted.
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/WebPage.messages.in:
+
2022-04-12 Elliott Williams <[email protected]>
[Xcode] In open-source builds, disable bitcode in xcconfigs instead of build-webkit
Modified: trunk/Source/WebKit/Shared/ContextMenuContextData.cpp (292799 => 292800)
--- trunk/Source/WebKit/Shared/ContextMenuContextData.cpp 2022-04-13 04:27:16 UTC (rev 292799)
+++ trunk/Source/WebKit/Shared/ContextMenuContextData.cpp 2022-04-13 04:58:17 UTC (rev 292800)
@@ -43,7 +43,7 @@
{
}
-ContextMenuContextData::ContextMenuContextData(const IntPoint& menuLocation, std::optional<ElementContext>&& hitTestedElementContext, const Vector<WebKit::WebContextMenuItemData>& menuItems, const ContextMenuContext& context)
+ContextMenuContextData::ContextMenuContextData(const IntPoint& menuLocation, const Vector<WebKit::WebContextMenuItemData>& menuItems, const ContextMenuContext& context)
#if ENABLE(SERVICE_CONTROLS)
: m_type(context.controlledImage() ? Type::ServicesMenu : context.type())
#else
@@ -50,7 +50,6 @@
: m_type(context.type())
#endif
, m_menuLocation(menuLocation)
- , m_hitTestedElementContext(WTFMove(hitTestedElementContext))
, m_menuItems(menuItems)
, m_webHitTestResultData({ context.hitTestResult(), true })
, m_selectedText(context.selectedText())
@@ -95,7 +94,6 @@
{
encoder << m_type;
encoder << m_menuLocation;
- encoder << m_hitTestedElementContext;
encoder << m_menuItems;
encoder << m_webHitTestResultData;
encoder << m_selectedText;
@@ -123,9 +121,6 @@
if (!decoder.decode(result.m_menuLocation))
return false;
- if (!decoder.decode(result.m_hitTestedElementContext))
- return false;
-
if (!decoder.decode(result.m_menuItems))
return false;
Modified: trunk/Source/WebKit/Shared/ContextMenuContextData.h (292799 => 292800)
--- trunk/Source/WebKit/Shared/ContextMenuContextData.h 2022-04-13 04:27:16 UTC (rev 292799)
+++ trunk/Source/WebKit/Shared/ContextMenuContextData.h 2022-04-13 04:58:17 UTC (rev 292800)
@@ -46,13 +46,12 @@
using Type = WebCore::ContextMenuContext::Type;
ContextMenuContextData();
- ContextMenuContextData(const WebCore::IntPoint& menuLocation, std::optional<WebCore::ElementContext>&& hitTestedElementContext, const Vector<WebKit::WebContextMenuItemData>& menuItems, const WebCore::ContextMenuContext&);
+ ContextMenuContextData(const WebCore::IntPoint& menuLocation, const Vector<WebKit::WebContextMenuItemData>& menuItems, const WebCore::ContextMenuContext&);
Type type() const { return m_type; }
const WebCore::IntPoint& menuLocation() const { return m_menuLocation; }
const Vector<WebKit::WebContextMenuItemData>& menuItems() const { return m_menuItems; }
- std::optional<WebCore::ElementContext> hitTestedElementContext() const { return m_hitTestedElementContext; }
const std::optional<WebHitTestResultData>& webHitTestResultData() const { return m_webHitTestResultData; }
const String& selectedText() const { return m_selectedText; }
@@ -87,7 +86,6 @@
Type m_type;
WebCore::IntPoint m_menuLocation;
- std::optional<WebCore::ElementContext> m_hitTestedElementContext;
Vector<WebKit::WebContextMenuItemData> m_menuItems;
std::optional<WebHitTestResultData> m_webHitTestResultData;
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (292799 => 292800)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2022-04-13 04:27:16 UTC (rev 292799)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2022-04-13 04:58:17 UTC (rev 292800)
@@ -7104,11 +7104,6 @@
send(Messages::WebPage::DidDismissContextMenu());
pageClient().didDismissContextMenu();
-
-#if ENABLE(IMAGE_ANALYSIS_ENHANCEMENTS)
- m_croppedImageResult = { };
- m_croppedImageOverlayState = CroppedImageOverlayState::Inactive;
-#endif
}
void WebPageProxy::contextMenuItemSelected(const WebContextMenuItemData& item)
@@ -8263,11 +8258,6 @@
m_currentFullscreenVideoSessionIdentifier = std::nullopt;
#endif
-#if ENABLE(IMAGE_ANALYSIS_ENHANCEMENTS)
- m_croppedImageResult = { };
- m_croppedImageOverlayState = CroppedImageOverlayState::Inactive;
-#endif
-
// FIXME: <rdar://problem/38676604> In case of process swaps, the old process should gracefully suspend instead of terminating.
m_process->processTerminated();
}
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (292799 => 292800)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2022-04-13 04:27:16 UTC (rev 292799)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2022-04-13 04:58:17 UTC (rev 292800)
@@ -1386,7 +1386,6 @@
void didDismissContextMenu();
void contextMenuItemSelected(const WebContextMenuItemData&);
void handleContextMenuKeyEvent();
- void willHighlightContextMenuItem(WebCore::ContextMenuAction);
#endif
// Called by the WebOpenPanelResultListenerProxy.
@@ -3245,17 +3244,6 @@
RunLoop::Timer<WebPageProxy> m_fullscreenVideoExtractionTimer;
#endif
bool m_hasPendingElementFullScreenVideoExtraction { false };
-
-#if ENABLE(IMAGE_ANALYSIS_ENHANCEMENTS)
- enum class CroppedImageOverlayState : uint8_t {
- Inactive,
- Analyzing,
- Hidden,
- Showing,
- };
- WebCore::PlatformImagePtr m_croppedImageResult;
- CroppedImageOverlayState m_croppedImageOverlayState { CroppedImageOverlayState::Inactive };
-#endif // ENABLE(IMAGE_ANALYSIS_ENHANCEMENTS)
};
#ifdef __OBJC__
Modified: trunk/Source/WebKit/UIProcess/mac/WebContextMenuProxyMac.mm (292799 => 292800)
--- trunk/Source/WebKit/UIProcess/mac/WebContextMenuProxyMac.mm 2022-04-13 04:27:16 UTC (rev 292799)
+++ trunk/Source/WebKit/UIProcess/mac/WebContextMenuProxyMac.mm 2022-04-13 04:58:17 UTC (rev 292800)
@@ -186,11 +186,6 @@
_menuProxy->page()->didDismissContextMenu();
}
-- (void)menu:(NSMenu *)menu willHighlightItem:(NSMenuItem *)item
-{
- _menuProxy->page()->willHighlightContextMenuItem(static_cast<WebCore::ContextMenuAction>(item.tag));
-}
-
@end
namespace WebKit {
Modified: trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm (292799 => 292800)
--- trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm 2022-04-13 04:27:16 UTC (rev 292799)
+++ trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm 2022-04-13 04:58:17 UTC (rev 292800)
@@ -779,76 +779,8 @@
#endif // ENABLE(IMAGE_ANALYSIS)
-void WebPageProxy::willHighlightContextMenuItem(ContextMenuAction action)
-{
#if ENABLE(IMAGE_ANALYSIS_ENHANCEMENTS)
- if (action != ContextMenuItemTagCopyCroppedImage) {
- if (m_croppedImageOverlayState == CroppedImageOverlayState::Showing) {
- m_croppedImageOverlayState = CroppedImageOverlayState::Hidden;
- send(Messages::WebPage::SetCroppedImageOverlayVisibility(false));
- }
- return;
- }
- if (m_croppedImageOverlayState == CroppedImageOverlayState::Hidden) {
- m_croppedImageOverlayState = CroppedImageOverlayState::Showing;
- send(Messages::WebPage::SetCroppedImageOverlayVisibility(true));
- return;
- }
-
- if (m_croppedImageOverlayState != CroppedImageOverlayState::Inactive)
- return;
-
- auto elementContext = m_activeContextMenuContextData.hitTestedElementContext();
- if (!elementContext)
- return;
-
- auto& hitTestData = m_activeContextMenuContextData.webHitTestResultData().value();
- auto imageBitmap = hitTestData.imageBitmap;
- if (!imageBitmap)
- return;
-
- auto image = imageBitmap->makeCGImageCopy();
- if (!image)
- return;
-
- m_croppedImageOverlayState = CroppedImageOverlayState::Analyzing;
-
- requestImageAnalysisMarkup(image.get(), [weakPage = WeakPtr { *this }, elementContext = WTFMove(*elementContext)](CGImageRef resultImage, CGRect normalizedCropRect) {
- if (!resultImage || CGRectIsEmpty(normalizedCropRect))
- return;
-
- RefPtr protectedPage = weakPage.get();
- if (!protectedPage)
- return;
-
- protectedPage->m_croppedImageResult = resultImage;
-
- if (protectedPage->m_croppedImageOverlayState != CroppedImageOverlayState::Analyzing)
- return;
-
- auto tiffData = transcode(resultImage, (__bridge CFStringRef)UTTypeTIFF.identifier);
- if (!tiffData)
- return;
-
- auto sharedMemory = SharedMemory::allocate([tiffData length]);
- if (!sharedMemory)
- return;
-
- [tiffData getBytes:sharedMemory->data() length:[tiffData length]];
-
- SharedMemory::Handle handle;
- sharedMemory->createHandle(handle, SharedMemory::Protection::ReadOnly);
- protectedPage->send(Messages::WebPage::InstallCroppedImageOverlay(elementContext, { WTFMove(handle), sharedMemory->size() }, "image/tiff"_s, normalizedCropRect));
- protectedPage->m_croppedImageOverlayState = CroppedImageOverlayState::Showing;
- });
-#else
- UNUSED_PARAM(action);
-#endif
-}
-
-#if ENABLE(IMAGE_ANALYSIS_ENHANCEMENTS)
-
void WebPageProxy::handleContextMenuCopyCroppedImage(ShareableBitmap& imageBitmap, const String& preferredMIMEType)
{
auto changeCount = NSPasteboard.generalPasteboard.changeCount;
@@ -865,11 +797,6 @@
[pasteboard setData:data.get() forType:(__bridge NSString *)type.get()];
};
- if (m_croppedImageResult) {
- performCopy(m_croppedImageResult.get());
- return;
- }
-
auto originalImage = imageBitmap.makeCGImageCopy();
if (!originalImage)
return;
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebContextMenu.cpp (292799 => 292800)
--- trunk/Source/WebKit/WebProcess/WebPage/WebContextMenu.cpp 2022-04-13 04:27:16 UTC (rev 292799)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebContextMenu.cpp 2022-04-13 04:58:17 UTC (rev 292800)
@@ -63,13 +63,9 @@
RefPtr<API::Object> userData;
menuItemsWithUserData(menuItems, userData);
- std::optional<ElementContext> hitTestedElementContext;
- if (RefPtr hitTestedElement = controller.hitTestResult().innerNonSharedElement())
- hitTestedElementContext = m_page->contextForElement(*hitTestedElement);
-
auto menuLocation = view->contentsToRootView(controller.hitTestResult().roundedPointInInnerNodeFrame());
- ContextMenuContextData contextMenuContextData(menuLocation, WTFMove(hitTestedElementContext), menuItems, controller.context());
+ ContextMenuContextData contextMenuContextData(menuLocation, menuItems, controller.context());
// Mark the WebPage has having a shown context menu then notify the UIProcess.
m_page->startWaitingForContextMenuToShow();
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (292799 => 292800)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2022-04-13 04:27:16 UTC (rev 292799)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2022-04-13 04:58:17 UTC (rev 292800)
@@ -3001,10 +3001,6 @@
void WebPage::didDismissContextMenu()
{
corePage()->contextMenuController().didDismissContextMenu();
-
-#if ENABLE(IMAGE_ANALYSIS_ENHANCEMENTS)
- m_croppedImageOverlay = nullptr;
-#endif
}
#endif // ENABLE(CONTEXT_MENUS)
@@ -7925,29 +7921,6 @@
completion(handle, mimeType);
}
-#if ENABLE(IMAGE_ANALYSIS_ENHANCEMENTS)
-
-void WebPage::installCroppedImageOverlay(const ElementContext& context, const SharedMemory::IPCHandle& imageData, const String& mimeType, FloatRect normalizedCropRect)
-{
- auto sharedMemory = SharedMemory::map(imageData.handle, SharedMemory::Protection::ReadOnly);
- if (!sharedMemory)
- return;
-
- RefPtr element = dynamicDowncast<HTMLElement>(elementForContext(context).get());
- if (!element)
- return;
-
- m_croppedImageOverlay = ImageOverlay::CroppedImage::install(*element, sharedMemory->createSharedBuffer(imageData.dataSize), mimeType, normalizedCropRect);
-}
-
-void WebPage::setCroppedImageOverlayVisibility(bool visible)
-{
- if (m_croppedImageOverlay)
- m_croppedImageOverlay->setVisibility(visible);
-}
-
-#endif // ENABLE(IMAGE_ANALYSIS_ENHANCEMENTS)
-
#if ENABLE(MEDIA_CONTROLS_CONTEXT_MENUS) && USE(UICONTEXTMENU)
void WebPage::showMediaControlsContextMenu(FloatRect&& targetFrame, Vector<MediaControlsContextMenuItem>&& items, CompletionHandler<void(MediaControlsContextMenuItem::ID)>&& completionHandler)
{
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (292799 => 292800)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2022-04-13 04:27:16 UTC (rev 292799)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2022-04-13 04:58:17 UTC (rev 292800)
@@ -265,11 +265,7 @@
#if HAVE(TRANSLATION_UI_SERVICES) && ENABLE(CONTEXT_MENUS)
struct TranslationContextMenuInfo;
#endif
-
-namespace ImageOverlay {
-class CroppedImage;
}
-}
namespace WebKit {
@@ -1460,10 +1456,6 @@
#endif
void requestImageBitmap(const WebCore::ElementContext&, CompletionHandler<void(const ShareableBitmap::Handle&, const String& sourceMIMEType)>&&);
-#if ENABLE(IMAGE_ANALYSIS_ENHANCEMENTS)
- void installCroppedImageOverlay(const WebCore::ElementContext&, const SharedMemory::IPCHandle& imageData, const String& mimeType, WebCore::FloatRect normalizedCropRect);
- void setCroppedImageOverlayVisibility(bool);
-#endif
#if HAVE(TRANSLATION_UI_SERVICES) && ENABLE(CONTEXT_MENUS)
void handleContextMenuTranslation(const WebCore::TranslationContextMenuInfo&);
@@ -2463,10 +2455,6 @@
#if ENABLE(APP_HIGHLIGHTS)
WebCore::HighlightVisibility m_appHighlightsVisible { WebCore::HighlightVisibility::Hidden };
#endif
-
-#if ENABLE(IMAGE_ANALYSIS_ENHANCEMENTS)
- std::unique_ptr<WebCore::ImageOverlay::CroppedImage> m_croppedImageOverlay;
-#endif
};
#if !PLATFORM(IOS_FAMILY)
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (292799 => 292800)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2022-04-13 04:27:16 UTC (rev 292799)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2022-04-13 04:58:17 UTC (rev 292800)
@@ -131,11 +131,6 @@
RequestImageBitmap(struct WebCore::ElementContext elementContext) -> (WebKit::ShareableBitmap::Handle image, String sourceMIMEType)
-#if ENABLE(IMAGE_ANALYSIS_ENHANCEMENTS)
- InstallCroppedImageOverlay(struct WebCore::ElementContext elementContext, WebKit::SharedMemory::IPCHandle imageData, String mimeType, WebCore::FloatRect normalizedCropRect)
- SetCroppedImageOverlayVisibility(bool visible)
-#endif
-
SetControlledByAutomation(bool controlled)
ConnectInspector(String targetId, Inspector::FrontendChannel::ConnectionType connectionType)