Diff
Modified: trunk/Source/WebCore/ChangeLog (281253 => 281254)
--- trunk/Source/WebCore/ChangeLog 2021-08-19 18:12:29 UTC (rev 281253)
+++ trunk/Source/WebCore/ChangeLog 2021-08-19 18:24:00 UTC (rev 281254)
@@ -1,3 +1,26 @@
+2021-08-19 Simon Fraser <[email protected]>
+
+ Rename Element::clientRect() which does not return a value in web-exposed "client" coordinates
+ https://bugs.webkit.org/show_bug.cgi?id=229243
+
+ Reviewed by Wenson Hsieh.
+
+ The result of Element::clientRect() is in the coordinate space of the root view,
+ not in the space of the Element's Frame, so does not match the other functions on Element
+ with "client" in the name.
+
+ Rename to Element::boundingBoxInRootViewCoordinates() for clarity.
+
+ * dom/Element.cpp:
+ (WebCore::Element::boundingBoxInRootViewCoordinates const):
+ (WebCore::Element::clientRect const): Deleted.
+ * dom/Element.h:
+ * html/MediaElementSession.cpp:
+ (WebCore::isElementMainContentForPurposesOfAutoplay):
+ (WebCore::isElementRectMostlyInMainFrame):
+ * page/Page.cpp:
+ (WebCore::Page::editableElementsInRect const):
+
2021-08-13 Tim Nguyen <[email protected]>
Top layer: handle display: contents and non out-of-flow position values
Modified: trunk/Source/WebCore/dom/Element.cpp (281253 => 281254)
--- trunk/Source/WebCore/dom/Element.cpp 2021-08-19 18:12:29 UTC (rev 281253)
+++ trunk/Source/WebCore/dom/Element.cpp 2021-08-19 18:24:00 UTC (rev 281254)
@@ -1467,6 +1467,13 @@
return view->contentsToRootView(enclosingIntRect(unitedBoundingBoxes(quads)));
}
+IntRect Element::boundingBoxInRootViewCoordinates() const
+{
+ if (RenderObject* renderer = this->renderer())
+ return document().view()->contentsToRootView(renderer->absoluteBoundingBoxRect());
+ return IntRect();
+}
+
static bool layoutOverflowRectContainsAllDescendants(const RenderBox& renderBox)
{
if (renderBox.isRenderView())
@@ -1682,14 +1689,6 @@
{
return DOMRect::create(boundingClientRect());
}
-
-// Note that this is not web-exposed, and does not use the same coordinate system as getBoundingClientRect() and friends.
-IntRect Element::clientRect() const
-{
- if (RenderObject* renderer = this->renderer())
- return document().view()->contentsToRootView(renderer->absoluteBoundingBoxRect());
- return IntRect();
-}
IntRect Element::screenRect() const
{
Modified: trunk/Source/WebCore/dom/Element.h (281253 => 281254)
--- trunk/Source/WebCore/dom/Element.h 2021-08-19 18:12:29 UTC (rev 281253)
+++ trunk/Source/WebCore/dom/Element.h 2021-08-19 18:24:00 UTC (rev 281254)
@@ -194,7 +194,10 @@
virtual int scrollWidth();
virtual int scrollHeight();
+ // This updates layout, and has custom handling for SVG.
WEBCORE_EXPORT IntRect boundsInRootViewSpace();
+ // This does not update layout, and uses absoluteBoundingBoxRect().
+ WEBCORE_EXPORT IntRect boundingBoxInRootViewCoordinates() const;
std::optional<std::pair<RenderObject*, FloatRect>> boundingAbsoluteRectWithoutLayout();
@@ -203,9 +206,6 @@
WEBCORE_EXPORT Ref<DOMRectList> getClientRects();
Ref<DOMRect> getBoundingClientRect();
- // Returns the absolute bounding box translated into client coordinates.
- WEBCORE_EXPORT IntRect clientRect() const;
-
// Returns the absolute bounding box translated into screen coordinates.
WEBCORE_EXPORT IntRect screenRect() const;
Modified: trunk/Source/WebCore/html/MediaElementSession.cpp (281253 => 281254)
--- trunk/Source/WebCore/html/MediaElementSession.cpp 2021-08-19 18:12:29 UTC (rev 281253)
+++ trunk/Source/WebCore/html/MediaElementSession.cpp 2021-08-19 18:24:00 UTC (rev 281254)
@@ -989,7 +989,7 @@
// Hit test the area of the main frame where the element appears, to determine if the element is being obscured.
// Elements which are obscured by other elements cannot be main content.
- IntRect rectRelativeToView = element.clientRect();
+ IntRect rectRelativeToView = element.boundingBoxInRootViewCoordinates();
ScrollPosition scrollPosition = mainFrame.view()->documentScrollPositionRelativeToViewOrigin();
IntRect rectRelativeToTopDocument(rectRelativeToView.location() + scrollPosition, rectRelativeToView.size());
OptionSet<HitTestRequest::Type> hitType { HitTestRequest::Type::ReadOnly, HitTestRequest::Type::Active, HitTestRequest::Type::AllowChildFrameContent, HitTestRequest::Type::IgnoreClipping, HitTestRequest::Type::DisallowUserAgentShadowContent };
@@ -1018,7 +1018,7 @@
return false;
IntRect mainFrameRectAdjustedForScrollPosition = IntRect(-mainFrameView->documentScrollPositionRelativeToViewOrigin(), mainFrameView->contentsSize());
- IntRect elementRectInMainFrame = element.clientRect();
+ IntRect elementRectInMainFrame = element.boundingBoxInRootViewCoordinates();
auto totalElementArea = elementRectInMainFrame.area<RecordOverflow>();
if (totalElementArea.hasOverflowed())
return false;
Modified: trunk/Source/WebCore/page/Page.cpp (281253 => 281254)
--- trunk/Source/WebCore/page/Page.cpp 2021-08-19 18:12:29 UTC (rev 281253)
+++ trunk/Source/WebCore/page/Page.cpp 2021-08-19 18:24:00 UTC (rev 281254)
@@ -1006,7 +1006,7 @@
auto& nodeSet = hitTestResult.listBasedTestResult();
for (auto& node : nodeSet) {
if (auto* editableElement = rootEditableElement(node)) {
- ASSERT(searchRectInRootViewCoordinates.inclusivelyIntersects(editableElement->clientRect()));
+ ASSERT(searchRectInRootViewCoordinates.inclusivelyIntersects(editableElement->boundingBoxInRootViewCoordinates()));
rootEditableElements.add(*editableElement);
}
}
@@ -1017,7 +1017,7 @@
// focused element is inside the search rect it's the most likely target for future editing operations,
// even if it's empty. So, we special case it here.
if (auto* focusedElement = focusController().focusedOrMainFrame().document()->focusedElement()) {
- if (searchRectInRootViewCoordinates.inclusivelyIntersects(focusedElement->clientRect())) {
+ if (searchRectInRootViewCoordinates.inclusivelyIntersects(focusedElement->boundingBoxInRootViewCoordinates())) {
if (auto* editableElement = rootEditableElement(*focusedElement))
rootEditableElements.add(*editableElement);
}
Modified: trunk/Source/WebKit/ChangeLog (281253 => 281254)
--- trunk/Source/WebKit/ChangeLog 2021-08-19 18:12:29 UTC (rev 281253)
+++ trunk/Source/WebKit/ChangeLog 2021-08-19 18:24:00 UTC (rev 281254)
@@ -1,5 +1,27 @@
2021-08-19 Simon Fraser <[email protected]>
+ Rename Element::clientRect() which does not return a value in web-exposed "client" coordinates
+ https://bugs.webkit.org/show_bug.cgi?id=229243
+
+ Reviewed by Wenson Hsieh.
+
+ The result of Element::clientRect() is in the coordinate space of the root view,
+ not in the space of the Element's Frame, so does not match the other functions on Element
+ with "client" in the name.
+
+ Rename to Element::boundingBoxInRootViewCoordinates() for clarity.
+
+ * WebProcess/WebCoreSupport/WebValidationMessageClient.cpp:
+ (WebKit::WebValidationMessageClient::showValidationMessage):
+ (WebKit::WebValidationMessageClient::updateValidationBubbleStateIfNeeded):
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::contextForElement const):
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::isObscuredElement):
+ (WebKit::WebPage::textInputContextsInRect):
+
+2021-08-19 Simon Fraser <[email protected]>
+
Fix the typo in horiontalRubberbandAmountInContentCoordinates
https://bugs.webkit.org/show_bug.cgi?id=229255
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebValidationMessageClient.cpp (281253 => 281254)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebValidationMessageClient.cpp 2021-08-19 18:12:29 UTC (rev 281253)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebValidationMessageClient.cpp 2021-08-19 18:24:00 UTC (rev 281254)
@@ -60,7 +60,7 @@
hideValidationMessage(*m_currentAnchor);
m_currentAnchor = &anchor;
- m_currentAnchorRect = anchor.clientRect();
+ m_currentAnchorRect = anchor.boundingBoxInRootViewCoordinates();
m_page.send(Messages::WebPageProxy::ShowValidationMessage(m_currentAnchorRect, message));
}
@@ -96,7 +96,7 @@
// We currently hide the validation bubble if its position is outdated instead of trying
// to update its position.
- if (m_currentAnchorRect != m_currentAnchor->clientRect())
+ if (m_currentAnchorRect != m_currentAnchor->boundingBoxInRootViewCoordinates())
hideValidationMessage(*m_currentAnchor);
}
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (281253 => 281254)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2021-08-19 18:12:29 UTC (rev 281253)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2021-08-19 18:24:00 UTC (rev 281254)
@@ -7260,7 +7260,7 @@
if (!frame)
return std::nullopt;
- return WebCore::ElementContext { element.clientRect(), m_identifier, document.identifier(), document.identifierForElement(element) };
+ return WebCore::ElementContext { element.boundingBoxInRootViewCoordinates(), m_identifier, document.identifier(), document.identifierForElement(element) };
}
void WebPage::startTextManipulations(Vector<WebCore::TextManipulationController::ExclusionRule>&& exclusionRules, CompletionHandler<void()>&& completionHandler)
Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (281253 => 281254)
--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2021-08-19 18:12:29 UTC (rev 281253)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2021-08-19 18:24:00 UTC (rev 281254)
@@ -2647,7 +2647,7 @@
static inline bool isObscuredElement(Element& element)
{
auto topDocument = makeRef(element.document().topDocument());
- auto elementRectInMainFrame = element.clientRect();
+ auto elementRectInMainFrame = element.boundingBoxInRootViewCoordinates();
constexpr OptionSet<HitTestRequest::Type> hitType { HitTestRequest::Type::ReadOnly, HitTestRequest::Type::Active, HitTestRequest::Type::AllowChildFrameContent, HitTestRequest::Type::DisallowUserAgentShadowContent, HitTestRequest::Type::IgnoreClipping };
HitTestResult result(elementRectInMainFrame.center());
@@ -4571,7 +4571,7 @@
context.webPageIdentifier = m_identifier;
context.documentIdentifier = document.identifier();
context.elementIdentifier = document.identifierForElement(element);
- context.boundingRect = element->clientRect();
+ context.boundingRect = element->boundingBoxInRootViewCoordinates();
return context;
});
completionHandler(contexts);
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (281253 => 281254)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2021-08-19 18:12:29 UTC (rev 281253)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2021-08-19 18:24:00 UTC (rev 281254)
@@ -1,5 +1,22 @@
2021-08-19 Simon Fraser <[email protected]>
+ Rename Element::clientRect() which does not return a value in web-exposed "client" coordinates
+ https://bugs.webkit.org/show_bug.cgi?id=229243
+
+ Reviewed by Wenson Hsieh.
+
+ The result of Element::clientRect() is in the coordinate space of the root view,
+ not in the space of the Element's Frame, so does not match the other functions on Element
+ with "client" in the name.
+
+ Rename to Element::boundingBoxInRootViewCoordinates() for clarity.
+
+ * WebCoreSupport/WebValidationMessageClient.mm:
+ (WebValidationMessageClient::showValidationMessage):
+ (WebValidationMessageClient::updateValidationBubbleStateIfNeeded):
+
+2021-08-19 Simon Fraser <[email protected]>
+
Rename EventHandler::sendScrollEvent() to scheduleScrollEvent() since the event is not sent synchronously
https://bugs.webkit.org/show_bug.cgi?id=229256
Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebValidationMessageClient.mm (281253 => 281254)
--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebValidationMessageClient.mm 2021-08-19 18:12:29 UTC (rev 281253)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebValidationMessageClient.mm 2021-08-19 18:24:00 UTC (rev 281254)
@@ -56,7 +56,7 @@
hideValidationMessage(*m_currentAnchor);
m_currentAnchor = &anchor;
- m_currentAnchorRect = anchor.clientRect();
+ m_currentAnchorRect = anchor.boundingBoxInRootViewCoordinates();
[m_view showFormValidationMessage:message withAnchorRect:m_currentAnchorRect];
}
@@ -92,6 +92,6 @@
// We currently hide the validation bubble if its position is outdated instead of trying
// to update its position.
- if (m_currentAnchorRect != m_currentAnchor->clientRect())
+ if (m_currentAnchorRect != m_currentAnchor->boundingBoxInRootViewCoordinates())
hideValidationMessage(*m_currentAnchor);
}