Diff
Modified: trunk/Source/WebCore/ChangeLog (293041 => 293042)
--- trunk/Source/WebCore/ChangeLog 2022-04-19 22:32:38 UTC (rev 293041)
+++ trunk/Source/WebCore/ChangeLog 2022-04-19 23:13:45 UTC (rev 293042)
@@ -1,3 +1,48 @@
+2022-04-19 Chris Dumez <[email protected]>
+
+ Inline Element::shadowRoot()
+ https://bugs.webkit.org/show_bug.cgi?id=239460
+
+ Reviewed by Darin Adler.
+
+ Inline Element::shadowRoot() given that it is small and shows up in Speedometer profiles.
+
+ * bindings/js/JSCustomElementInterface.cpp:
+ * css/CSSComputedStyleDeclaration.cpp:
+ * css/SelectorChecker.cpp:
+ * dom/ComposedTreeAncestorIterator.h:
+ * dom/ComposedTreeIterator.cpp:
+ * dom/ComposedTreeIterator.h:
+ * dom/ContainerNode.cpp:
+ * dom/ContainerNodeAlgorithms.cpp:
+ * dom/Document.cpp:
+ * dom/Element.cpp:
+ (WebCore::Element::elementRareData const): Deleted.
+ (WebCore::Element::shadowRoot const): Deleted.
+ * dom/Element.h:
+ * dom/ElementInlines.h:
+ * dom/ElementRareData.h:
+ (WebCore::Element::elementRareData const):
+ (WebCore::Element::shadowRoot const):
+ * dom/EventPath.cpp:
+ * dom/ImageOverlay.cpp:
+ * dom/mac/ImageControlsMac.cpp:
+ * editing/TextIterator.cpp:
+ * editing/cocoa/DataDetection.h:
+ * editing/cocoa/DataDetection.mm:
+ (WebCore::DataDetection::findDataDetectionResultElementInImageOverlay):
+ * editing/cocoa/HTMLConverter.mm:
+ * editing/markup.cpp:
+ * html/HTMLDetailsElement.cpp:
+ * html/HTMLImageElement.cpp:
+ * page/ios/FrameIOS.mm:
+ * rendering/RenderFileUploadControl.cpp:
+ * style/PseudoClassChangeInvalidation.cpp:
+ * style/StyleInvalidator.cpp:
+ * style/StyleScope.cpp:
+ * svg/SVGTRefElement.cpp:
+ * testing/Internals.cpp:
+
2022-04-19 Commit Queue <[email protected]>
Unreviewed, reverting r292947.
Modified: trunk/Source/WebCore/bindings/js/JSCustomElementInterface.cpp (293041 => 293042)
--- trunk/Source/WebCore/bindings/js/JSCustomElementInterface.cpp 2022-04-19 22:32:38 UTC (rev 293041)
+++ trunk/Source/WebCore/bindings/js/JSCustomElementInterface.cpp 2022-04-19 23:13:45 UTC (rev 293042)
@@ -29,6 +29,7 @@
#include "JSCustomElementInterface.h"
#include "DOMWrapperWorld.h"
+#include "ElementRareData.h"
#include "HTMLUnknownElement.h"
#include "JSDOMBinding.h"
#include "JSDOMConvertNullable.h"
Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (293041 => 293042)
--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp 2022-04-19 22:32:38 UTC (rev 293041)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp 2022-04-19 23:13:45 UTC (rev 293042)
@@ -54,6 +54,7 @@
#include "CursorList.h"
#include "DeprecatedCSSOMValue.h"
#include "Document.h"
+#include "ElementRareData.h"
#include "FontCascade.h"
#include "FontSelectionValueInlines.h"
#include "FontTaggedSettings.h"
Modified: trunk/Source/WebCore/css/SelectorChecker.cpp (293041 => 293042)
--- trunk/Source/WebCore/css/SelectorChecker.cpp 2022-04-19 22:32:38 UTC (rev 293041)
+++ trunk/Source/WebCore/css/SelectorChecker.cpp 2022-04-19 23:13:45 UTC (rev 293042)
@@ -33,6 +33,7 @@
#include "CSSSelectorList.h"
#include "Document.h"
#include "ElementInlines.h"
+#include "ElementRareData.h"
#include "ElementTraversal.h"
#include "Frame.h"
#include "FrameSelection.h"
Modified: trunk/Source/WebCore/dom/ComposedTreeAncestorIterator.h (293041 => 293042)
--- trunk/Source/WebCore/dom/ComposedTreeAncestorIterator.h 2022-04-19 22:32:38 UTC (rev 293041)
+++ trunk/Source/WebCore/dom/ComposedTreeAncestorIterator.h 2022-04-19 23:13:45 UTC (rev 293042)
@@ -25,6 +25,7 @@
#pragma once
+#include "ElementRareData.h"
#include "HTMLSlotElement.h"
#include "PseudoElement.h"
#include "ShadowRoot.h"
Modified: trunk/Source/WebCore/dom/ComposedTreeIterator.cpp (293041 => 293042)
--- trunk/Source/WebCore/dom/ComposedTreeIterator.cpp 2022-04-19 22:32:38 UTC (rev 293041)
+++ trunk/Source/WebCore/dom/ComposedTreeIterator.cpp 2022-04-19 23:13:45 UTC (rev 293042)
@@ -27,6 +27,7 @@
#include "ComposedTreeIterator.h"
#include "ElementInlines.h"
+#include "ElementRareData.h"
#include "HTMLSlotElement.h"
#include <wtf/text/TextStream.h>
Modified: trunk/Source/WebCore/dom/ComposedTreeIterator.h (293041 => 293042)
--- trunk/Source/WebCore/dom/ComposedTreeIterator.h 2022-04-19 22:32:38 UTC (rev 293041)
+++ trunk/Source/WebCore/dom/ComposedTreeIterator.h 2022-04-19 23:13:45 UTC (rev 293042)
@@ -26,6 +26,7 @@
#pragma once
#include "ElementAndTextDescendantIterator.h"
+#include "ElementRareData.h"
#include "HTMLSlotElement.h"
#include "ShadowRoot.h"
Modified: trunk/Source/WebCore/dom/ContainerNode.cpp (293041 => 293042)
--- trunk/Source/WebCore/dom/ContainerNode.cpp 2022-04-19 22:32:38 UTC (rev 293041)
+++ trunk/Source/WebCore/dom/ContainerNode.cpp 2022-04-19 23:13:45 UTC (rev 293042)
@@ -31,6 +31,7 @@
#include "CommonVM.h"
#include "ContainerNodeAlgorithms.h"
#include "Editor.h"
+#include "ElementRareData.h"
#include "EventNames.h"
#include "FloatRect.h"
#include "FrameView.h"
Modified: trunk/Source/WebCore/dom/ContainerNodeAlgorithms.cpp (293041 => 293042)
--- trunk/Source/WebCore/dom/ContainerNodeAlgorithms.cpp 2022-04-19 22:32:38 UTC (rev 293041)
+++ trunk/Source/WebCore/dom/ContainerNodeAlgorithms.cpp 2022-04-19 23:13:45 UTC (rev 293042)
@@ -26,6 +26,7 @@
#include "config.h"
#include "ContainerNodeAlgorithms.h"
+#include "ElementRareData.h"
#include "HTMLFrameOwnerElement.h"
#include "HTMLTextAreaElement.h"
#include "InspectorInstrumentation.h"
Modified: trunk/Source/WebCore/dom/Document.cpp (293041 => 293042)
--- trunk/Source/WebCore/dom/Document.cpp 2022-04-19 22:32:38 UTC (rev 293041)
+++ trunk/Source/WebCore/dom/Document.cpp 2022-04-19 23:13:45 UTC (rev 293042)
@@ -75,6 +75,7 @@
#include "Editing.h"
#include "Editor.h"
#include "ElementIterator.h"
+#include "ElementRareData.h"
#include "EventHandler.h"
#include "ExtensionStyleSheets.h"
#include "FocusController.h"
Modified: trunk/Source/WebCore/dom/Element.cpp (293041 => 293042)
--- trunk/Source/WebCore/dom/Element.cpp 2022-04-19 22:32:38 UTC (rev 293041)
+++ trunk/Source/WebCore/dom/Element.cpp 2022-04-19 23:13:45 UTC (rev 293042)
@@ -261,12 +261,6 @@
}
}
-inline ElementRareData* Element::elementRareData() const
-{
- ASSERT_WITH_SECURITY_IMPLICATION(hasRareData());
- return static_cast<ElementRareData*>(rareData());
-}
-
inline ElementRareData& Element::ensureElementRareData()
{
return static_cast<ElementRareData&>(ensureRareData());
@@ -2437,11 +2431,6 @@
}
}
-ShadowRoot* Element::shadowRoot() const
-{
- return hasRareData() ? elementRareData()->shadowRoot() : nullptr;
-}
-
void Element::addShadowRoot(Ref<ShadowRoot>&& newShadowRoot)
{
ASSERT(!newShadowRoot->hasChildNodes());
Modified: trunk/Source/WebCore/dom/Element.h (293041 => 293042)
--- trunk/Source/WebCore/dom/Element.h 2022-04-19 22:32:38 UTC (rev 293041)
+++ trunk/Source/WebCore/dom/Element.h 2022-04-19 23:13:45 UTC (rev 293042)
@@ -315,7 +315,7 @@
virtual bool rendererIsNeeded(const RenderStyle&);
virtual bool rendererIsEverNeeded() { return true; }
- WEBCORE_EXPORT ShadowRoot* shadowRoot() const;
+ inline ShadowRoot* shadowRoot() const; // Defined in ElementRareData.h
ShadowRoot* shadowRootForBindings(JSC::JSGlobalObject&) const;
WEBCORE_EXPORT ExceptionOr<ShadowRoot&> attachShadow(const ShadowRootInit&);
@@ -765,7 +765,7 @@
void createUniqueElementData();
- ElementRareData* elementRareData() const;
+ inline ElementRareData* elementRareData() const;
ElementRareData& ensureElementRareData();
ElementAnimationRareData* animationRareData(PseudoId) const;
Modified: trunk/Source/WebCore/dom/ElementInlines.h (293041 => 293042)
--- trunk/Source/WebCore/dom/ElementInlines.h 2022-04-19 22:32:38 UTC (rev 293041)
+++ trunk/Source/WebCore/dom/ElementInlines.h 2022-04-19 23:13:45 UTC (rev 293042)
@@ -185,5 +185,4 @@
return (element && element->isInTopLayer()) || style.styleType() == PseudoId::Backdrop;
}
-
}
Modified: trunk/Source/WebCore/dom/ElementRareData.h (293041 => 293042)
--- trunk/Source/WebCore/dom/ElementRareData.h 2022-04-19 22:32:38 UTC (rev 293041)
+++ trunk/Source/WebCore/dom/ElementRareData.h 2022-04-19 23:13:45 UTC (rev 293042)
@@ -242,4 +242,22 @@
return *m_animationRareData.last().get();
}
+inline ElementRareData* Element::elementRareData() const
+{
+ ASSERT_WITH_SECURITY_IMPLICATION(hasRareData());
+ return static_cast<ElementRareData*>(rareData());
+}
+
+inline ShadowRoot* Node::shadowRoot() const
+{
+ if (!is<Element>(*this))
+ return nullptr;
+ return downcast<Element>(*this).shadowRoot();
+}
+
+inline ShadowRoot* Element::shadowRoot() const
+{
+ return hasRareData() ? elementRareData()->shadowRoot() : nullptr;
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/dom/EventPath.cpp (293041 => 293042)
--- trunk/Source/WebCore/dom/EventPath.cpp 2022-04-19 22:32:38 UTC (rev 293041)
+++ trunk/Source/WebCore/dom/EventPath.cpp 2022-04-19 23:13:45 UTC (rev 293042)
@@ -22,6 +22,7 @@
#include "EventPath.h"
#include "DOMWindow.h"
+#include "ElementRareData.h"
#include "Event.h"
#include "EventContext.h"
#include "EventNames.h"
Modified: trunk/Source/WebCore/dom/ImageOverlay.cpp (293041 => 293042)
--- trunk/Source/WebCore/dom/ImageOverlay.cpp 2022-04-19 22:32:38 UTC (rev 293041)
+++ trunk/Source/WebCore/dom/ImageOverlay.cpp 2022-04-19 23:13:45 UTC (rev 293042)
@@ -32,6 +32,7 @@
#include "DOMURL.h"
#include "Document.h"
#include "ElementChildIterator.h"
+#include "ElementRareData.h"
#include "EventHandler.h"
#include "EventLoop.h"
#include "FloatRect.h"
Modified: trunk/Source/WebCore/dom/Node.h (293041 => 293042)
--- trunk/Source/WebCore/dom/Node.h 2022-04-19 22:32:38 UTC (rev 293041)
+++ trunk/Source/WebCore/dom/Node.h 2022-04-19 23:13:45 UTC (rev 293042)
@@ -235,7 +235,7 @@
// If this node is in a shadow tree, returns its shadow host. Otherwise, returns null.
WEBCORE_EXPORT Element* shadowHost() const;
ShadowRoot* containingShadowRoot() const;
- ShadowRoot* shadowRoot() const; // Defined in ShadowRoot.h
+ inline ShadowRoot* shadowRoot() const; // Defined in ElementRareData.h
bool isClosedShadowHidden(const Node&) const;
HTMLSlotElement* assignedSlot() const;
Modified: trunk/Source/WebCore/dom/ShadowRoot.h (293041 => 293042)
--- trunk/Source/WebCore/dom/ShadowRoot.h 2022-04-19 22:32:38 UTC (rev 293041)
+++ trunk/Source/WebCore/dom/ShadowRoot.h 2022-04-19 23:13:45 UTC (rev 293042)
@@ -149,13 +149,6 @@
return treeScope().focusedElementInScope();
}
-inline ShadowRoot* Node::shadowRoot() const
-{
- if (!is<Element>(*this))
- return nullptr;
- return downcast<Element>(*this).shadowRoot();
-}
-
inline bool Node::isUserAgentShadowRoot() const
{
return isShadowRoot() && downcast<ShadowRoot>(*this).mode() == ShadowRootMode::UserAgent;
Modified: trunk/Source/WebCore/dom/mac/ImageControlsMac.cpp (293041 => 293042)
--- trunk/Source/WebCore/dom/mac/ImageControlsMac.cpp 2022-04-19 22:32:38 UTC (rev 293041)
+++ trunk/Source/WebCore/dom/mac/ImageControlsMac.cpp 2022-04-19 23:13:45 UTC (rev 293042)
@@ -30,6 +30,7 @@
#include "ChromeClient.h"
#include "ContextMenuController.h"
#include "ElementInlines.h"
+#include "ElementRareData.h"
#include "Event.h"
#include "EventHandler.h"
#include "EventNames.h"
Modified: trunk/Source/WebCore/editing/TextIterator.cpp (293041 => 293042)
--- trunk/Source/WebCore/editing/TextIterator.cpp 2022-04-19 22:32:38 UTC (rev 293041)
+++ trunk/Source/WebCore/editing/TextIterator.cpp 2022-04-19 23:13:45 UTC (rev 293042)
@@ -31,6 +31,7 @@
#include "Document.h"
#include "Editing.h"
#include "ElementInlines.h"
+#include "ElementRareData.h"
#include "FontCascade.h"
#include "Frame.h"
#include "HTMLBodyElement.h"
Modified: trunk/Source/WebCore/editing/cocoa/DataDetection.h (293041 => 293042)
--- trunk/Source/WebCore/editing/cocoa/DataDetection.h 2022-04-19 22:32:38 UTC (rev 293041)
+++ trunk/Source/WebCore/editing/cocoa/DataDetection.h 2022-04-19 23:13:45 UTC (rev 293042)
@@ -41,6 +41,7 @@
class Document;
class HTMLDivElement;
+class HTMLElement;
class HitTestResult;
class QualifiedName;
struct TextRecognitionDataDetector;
@@ -65,6 +66,7 @@
WEBCORE_EXPORT static bool canPresentDataDetectorsUIForElement(Element&);
WEBCORE_EXPORT static bool requiresExtendedContext(Element&);
#endif
+ WEBCORE_EXPORT static std::optional<std::pair<Ref<HTMLElement>, IntRect>> findDataDetectionResultElementInImageOverlay(const FloatPoint& location, const HTMLElement& imageOverlayHost);
#if ENABLE(IMAGE_ANALYSIS)
static Ref<HTMLDivElement> createElementForImageOverlay(Document&, const TextRecognitionDataDetector&);
Modified: trunk/Source/WebCore/editing/cocoa/DataDetection.mm (293041 => 293042)
--- trunk/Source/WebCore/editing/cocoa/DataDetection.mm 2022-04-19 22:32:38 UTC (rev 293041)
+++ trunk/Source/WebCore/editing/cocoa/DataDetection.mm 2022-04-19 23:13:45 UTC (rev 293042)
@@ -35,6 +35,7 @@
#import "DataDetectionResultsStorage.h"
#import "Editing.h"
#import "ElementAncestorIterator.h"
+#import "ElementRareData.h"
#import "ElementTraversal.h"
#import "FrameView.h"
#import "HTMLAnchorElement.h"
@@ -42,6 +43,7 @@
#import "HTMLNames.h"
#import "HTMLTextFormControlElement.h"
#import "HitTestResult.h"
+#import "ImageOverlay.h"
#import "NodeList.h"
#import "NodeTraversal.h"
#import "QualifiedName.h"
@@ -689,6 +691,23 @@
return is<HTMLAnchorElement>(element) && equalIgnoringASCIICase(element.attributeWithoutSynchronization(x_apple_data_detectorsAttr), "true");
}
+std::optional<std::pair<Ref<HTMLElement>, IntRect>> DataDetection::findDataDetectionResultElementInImageOverlay(const FloatPoint& location, const HTMLElement& imageOverlayHost)
+{
+ Vector<Ref<HTMLElement>> dataDetectorElements;
+ for (auto& child : descendantsOfType<HTMLElement>(*imageOverlayHost.shadowRoot())) {
+ if (ImageOverlay::isDataDetectorResult(child))
+ dataDetectorElements.append(child);
+ }
+
+ for (auto& element : dataDetectorElements) {
+ auto elementBounds = element->boundsInRootViewSpace();
+ if (elementBounds.contains(roundedIntPoint(location)))
+ return { { WTFMove(element), elementBounds } };
+ }
+
+ return std::nullopt;
+}
+
#if ENABLE(IMAGE_ANALYSIS)
Ref<HTMLDivElement> DataDetection::createElementForImageOverlay(Document& document, const TextRecognitionDataDetector& info)
Modified: trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm (293041 => 293042)
--- trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm 2022-04-19 22:32:38 UTC (rev 293041)
+++ trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm 2022-04-19 23:13:45 UTC (rev 293042)
@@ -39,6 +39,7 @@
#import "DocumentLoader.h"
#import "Editing.h"
#import "ElementInlines.h"
+#import "ElementRareData.h"
#import "ElementTraversal.h"
#import "File.h"
#import "FontCascade.h"
Modified: trunk/Source/WebCore/editing/markup.cpp (293041 => 293042)
--- trunk/Source/WebCore/editing/markup.cpp 2022-04-19 22:32:38 UTC (rev 293041)
+++ trunk/Source/WebCore/editing/markup.cpp 2022-04-19 23:13:45 UTC (rev 293042)
@@ -45,6 +45,7 @@
#include "Editor.h"
#include "EditorClient.h"
#include "ElementIterator.h"
+#include "ElementRareData.h"
#include "EmptyClients.h"
#include "File.h"
#include "Frame.h"
Modified: trunk/Source/WebCore/html/ColorInputType.cpp (293041 => 293042)
--- trunk/Source/WebCore/html/ColorInputType.cpp 2022-04-19 22:32:38 UTC (rev 293041)
+++ trunk/Source/WebCore/html/ColorInputType.cpp 2022-04-19 23:13:45 UTC (rev 293042)
@@ -40,6 +40,7 @@
#include "Color.h"
#include "ColorSerialization.h"
#include "ElementChildIterator.h"
+#include "ElementRareData.h"
#include "Event.h"
#include "HTMLDataListElement.h"
#include "HTMLDivElement.h"
Modified: trunk/Source/WebCore/html/FileInputType.cpp (293041 => 293042)
--- trunk/Source/WebCore/html/FileInputType.cpp 2022-04-19 22:32:38 UTC (rev 293041)
+++ trunk/Source/WebCore/html/FileInputType.cpp 2022-04-19 23:13:45 UTC (rev 293042)
@@ -27,6 +27,7 @@
#include "DirectoryFileListCreator.h"
#include "DragData.h"
#include "ElementChildIterator.h"
+#include "ElementRareData.h"
#include "Event.h"
#include "File.h"
#include "FileList.h"
Modified: trunk/Source/WebCore/html/HTMLDetailsElement.cpp (293041 => 293042)
--- trunk/Source/WebCore/html/HTMLDetailsElement.cpp 2022-04-19 22:32:38 UTC (rev 293041)
+++ trunk/Source/WebCore/html/HTMLDetailsElement.cpp 2022-04-19 23:13:45 UTC (rev 293042)
@@ -25,6 +25,7 @@
#include "AXObjectCache.h"
#include "DocumentInlines.h"
#include "ElementIterator.h"
+#include "ElementRareData.h"
#include "EventLoop.h"
#include "EventNames.h"
#include "GCReachableRef.h"
Modified: trunk/Source/WebCore/html/HTMLImageElement.cpp (293041 => 293042)
--- trunk/Source/WebCore/html/HTMLImageElement.cpp 2022-04-19 22:32:38 UTC (rev 293041)
+++ trunk/Source/WebCore/html/HTMLImageElement.cpp 2022-04-19 23:13:45 UTC (rev 293042)
@@ -30,6 +30,7 @@
#include "ChromeClient.h"
#include "Editor.h"
#include "ElementIterator.h"
+#include "ElementRareData.h"
#include "EventLoop.h"
#include "EventNames.h"
#include "FrameView.h"
Modified: trunk/Source/WebCore/html/RangeInputType.cpp (293041 => 293042)
--- trunk/Source/WebCore/html/RangeInputType.cpp 2022-04-19 22:32:38 UTC (rev 293041)
+++ trunk/Source/WebCore/html/RangeInputType.cpp 2022-04-19 23:13:45 UTC (rev 293042)
@@ -35,6 +35,7 @@
#include "Decimal.h"
#include "DocumentInlines.h"
#include "ElementChildIterator.h"
+#include "ElementRareData.h"
#include "EventNames.h"
#include "HTMLCollection.h"
#include "HTMLInputElement.h"
Modified: trunk/Source/WebCore/html/TextFieldInputType.cpp (293041 => 293042)
--- trunk/Source/WebCore/html/TextFieldInputType.cpp 2022-04-19 22:32:38 UTC (rev 293041)
+++ trunk/Source/WebCore/html/TextFieldInputType.cpp 2022-04-19 23:13:45 UTC (rev 293042)
@@ -38,6 +38,7 @@
#include "DOMFormData.h"
#include "Editor.h"
#include "ElementInlines.h"
+#include "ElementRareData.h"
#include "EventNames.h"
#include "Frame.h"
#include "FrameSelection.h"
Modified: trunk/Source/WebCore/page/ios/FrameIOS.mm (293041 => 293042)
--- trunk/Source/WebCore/page/ios/FrameIOS.mm 2022-04-19 22:32:38 UTC (rev 293041)
+++ trunk/Source/WebCore/page/ios/FrameIOS.mm 2022-04-19 23:13:45 UTC (rev 293042)
@@ -34,6 +34,7 @@
#import "DocumentMarkerController.h"
#import "Editor.h"
#import "EditorClient.h"
+#import "ElementRareData.h"
#import "EventHandler.h"
#import "EventNames.h"
#import "FormController.h"
Modified: trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp (293041 => 293042)
--- trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp 2022-04-19 22:32:38 UTC (rev 293041)
+++ trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp 2022-04-19 23:13:45 UTC (rev 293042)
@@ -21,6 +21,7 @@
#include "config.h"
#include "RenderFileUploadControl.h"
+#include "ElementRareData.h"
#include "FileList.h"
#include "FontCascade.h"
#include "GraphicsContext.h"
Modified: trunk/Source/WebCore/style/PseudoClassChangeInvalidation.cpp (293041 => 293042)
--- trunk/Source/WebCore/style/PseudoClassChangeInvalidation.cpp 2022-04-19 22:32:38 UTC (rev 293041)
+++ trunk/Source/WebCore/style/PseudoClassChangeInvalidation.cpp 2022-04-19 23:13:45 UTC (rev 293042)
@@ -27,6 +27,7 @@
#include "PseudoClassChangeInvalidation.h"
#include "ElementChildIterator.h"
+#include "ElementRareData.h"
#include "StyleInvalidationFunctions.h"
namespace WebCore {
Modified: trunk/Source/WebCore/style/StyleInvalidator.cpp (293041 => 293042)
--- trunk/Source/WebCore/style/StyleInvalidator.cpp 2022-04-19 22:32:38 UTC (rev 293041)
+++ trunk/Source/WebCore/style/StyleInvalidator.cpp 2022-04-19 23:13:45 UTC (rev 293042)
@@ -29,6 +29,7 @@
#include "CSSSelectorList.h"
#include "Document.h"
#include "ElementIterator.h"
+#include "ElementRareData.h"
#include "ElementRuleCollector.h"
#include "HTMLSlotElement.h"
#include "RuleSetBuilder.h"
Modified: trunk/Source/WebCore/style/StyleScope.cpp (293041 => 293042)
--- trunk/Source/WebCore/style/StyleScope.cpp 2022-04-19 22:32:38 UTC (rev 293041)
+++ trunk/Source/WebCore/style/StyleScope.cpp 2022-04-19 23:13:45 UTC (rev 293042)
@@ -32,6 +32,7 @@
#include "CSSStyleSheet.h"
#include "Element.h"
#include "ElementChildIterator.h"
+#include "ElementRareData.h"
#include "ExtensionStyleSheets.h"
#include "HTMLHeadElement.h"
#include "HTMLIFrameElement.h"
Modified: trunk/Source/WebCore/svg/SVGTRefElement.cpp (293041 => 293042)
--- trunk/Source/WebCore/svg/SVGTRefElement.cpp 2022-04-19 22:32:38 UTC (rev 293041)
+++ trunk/Source/WebCore/svg/SVGTRefElement.cpp 2022-04-19 23:13:45 UTC (rev 293042)
@@ -24,6 +24,7 @@
#include "SVGTRefElement.h"
#include "AddEventListenerOptions.h"
+#include "ElementRareData.h"
#include "EventListener.h"
#include "EventNames.h"
#include "MutationEvent.h"
Modified: trunk/Source/WebCore/testing/Internals.cpp (293041 => 293042)
--- trunk/Source/WebCore/testing/Internals.cpp 2022-04-19 22:32:38 UTC (rev 293041)
+++ trunk/Source/WebCore/testing/Internals.cpp 2022-04-19 23:13:45 UTC (rev 293042)
@@ -72,6 +72,7 @@
#include "DocumentTimelinesController.h"
#include "Editor.h"
#include "Element.h"
+#include "ElementRareData.h"
#include "EventHandler.h"
#include "EventListener.h"
#include "EventLoop.h"
Modified: trunk/Source/WebKit/ChangeLog (293041 => 293042)
--- trunk/Source/WebKit/ChangeLog 2022-04-19 22:32:38 UTC (rev 293041)
+++ trunk/Source/WebKit/ChangeLog 2022-04-19 23:13:45 UTC (rev 293042)
@@ -1,3 +1,21 @@
+2022-04-19 Chris Dumez <[email protected]>
+
+ Inline Element::shadowRoot()
+ https://bugs.webkit.org/show_bug.cgi?id=239460
+
+ Reviewed by Darin Adler.
+
+ I moved findDataDetectionResultElementInImageOverlay() to WebCore since it only relies on WebCore
+ things. This function relies on ElementRareData but ElementRareData.h is not currently exported
+ from WebCore.
+
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::updateWithTextRecognitionResult):
+ (WebKit::WebPage::findDataDetectionResultElementInImageOverlay): Deleted.
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::dataDetectorImageOverlayPositionInformation):
+
2022-04-19 Sihui Liu <[email protected]>
Add logging for WebsiteDataStore data fetch and removal
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (293041 => 293042)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2022-04-19 22:32:38 UTC (rev 293041)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2022-04-19 23:13:45 UTC (rev 293042)
@@ -4310,23 +4310,6 @@
completionHandler(WTFMove(mainFrameResult));
}
-std::optional<std::pair<Ref<WebCore::HTMLElement>, WebCore::IntRect>> WebPage::findDataDetectionResultElementInImageOverlay(const FloatPoint& location, const HTMLElement& imageOverlayHost)
-{
- Vector<Ref<HTMLElement>> dataDetectorElements;
- for (auto& child : descendantsOfType<HTMLElement>(*imageOverlayHost.shadowRoot())) {
- if (ImageOverlay::isDataDetectorResult(child))
- dataDetectorElements.append(child);
- }
-
- for (auto& element : dataDetectorElements) {
- auto elementBounds = element->boundsInRootViewSpace();
- if (elementBounds.contains(roundedIntPoint(location)))
- return {{ WTFMove(element), elementBounds }};
- }
-
- return std::nullopt;
-}
-
#endif // ENABLE(DATA_DETECTION)
#if PLATFORM(COCOA)
@@ -7864,7 +7847,7 @@
return TextRecognitionUpdateResult::NoText;
#if ENABLE(DATA_DETECTION)
- if (findDataDetectionResultElementInImageOverlay(location, downcast<HTMLElement>(*elementToUpdate)))
+ if (DataDetection::findDataDetectionResultElementInImageOverlay(location, downcast<HTMLElement>(*elementToUpdate)))
return TextRecognitionUpdateResult::DataDetector;
#endif
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (293041 => 293042)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2022-04-19 22:32:38 UTC (rev 293041)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2022-04-19 23:13:45 UTC (rev 293042)
@@ -1198,7 +1198,6 @@
void detectDataInAllFrames(OptionSet<WebCore::DataDetectorType>, CompletionHandler<void(const DataDetectionResult&)>&&);
void removeDataDetectedLinks(CompletionHandler<void(const DataDetectionResult&)>&&);
void handleClickForDataDetectionResult(const WebCore::DataDetectorElementInfo&, const WebCore::IntPoint&);
- static std::optional<std::pair<Ref<WebCore::HTMLElement>, WebCore::IntRect>> findDataDetectionResultElementInImageOverlay(const WebCore::FloatPoint& locationInRootView, const WebCore::HTMLElement& host);
#endif
unsigned extendIncrementalRenderingSuppression();
Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (293041 => 293042)
--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2022-04-19 22:32:38 UTC (rev 293041)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2022-04-19 23:13:45 UTC (rev 293042)
@@ -2794,7 +2794,7 @@
if (!frame)
return;
- auto elementAndBounds = WebPage::findDataDetectionResultElementInImageOverlay(request.point, overlayHost);
+ auto elementAndBounds = DataDetection::findDataDetectionResultElementInImageOverlay(request.point, overlayHost);
if (!elementAndBounds)
return;