Diff
Modified: trunk/Source/WebCore/ChangeLog (177300 => 177301)
--- trunk/Source/WebCore/ChangeLog 2014-12-15 19:49:24 UTC (rev 177300)
+++ trunk/Source/WebCore/ChangeLog 2014-12-15 20:15:05 UTC (rev 177301)
@@ -1,5 +1,41 @@
2014-12-15 Myles C. Maxfield <[email protected]>
+ Addressing post-review comments in r177035
+ https://bugs.webkit.org/show_bug.cgi?id=139557
+
+ Reviewed by Darin Adler.
+
+ This patch deletes the helper functions rendererBoundingBox() and rendererAnchorRect() and
+ migrates callers to using renderers directly.
+
+ It also improves the comment in RenderElement.h regarding RenderElement::anchorRect().
+
+ No new tests because this is simply refactoring.
+
+ * WebCore.exp.in: Delete exported symbol for rendererBoundingBox()
+ * accessibility/AccessibilitySlider.cpp:
+ (WebCore::AccessibilitySliderThumb::elementRect): Migrate off rendererBoundingBox()
+ * dom/ContainerNode.cpp:
+ (WebCore::rendererAnchorRect): Deleted.
+ * dom/ContainerNode.h:
+ * dom/Node.cpp:
+ (WebCore::rendererBoundingBox): Deleted.
+ * dom/Node.h:
+ * html/ColorInputType.cpp:
+ (WebCore::ColorInputType::elementRectRelativeToRootView): Migrate off rendererBoundingBox().
+ * html/HTMLInputElement.cpp:
+ (WebCore::HTMLInputElement::setupDateTimeChooserParameters): Ditto.
+ * html/ValidationMessage.cpp:
+ (WebCore::ValidationMessage::buildBubbleTree): Ditto.
+ * page/FrameView.cpp:
+ (WebCore::FrameView::scrollElementToRect): Migrate off rendererAnchorRect().
+ (WebCore::FrameView::scrollToAnchor): Ditto.
+ * page/SpatialNavigation.cpp:
+ (WebCore::nodeRectInAbsoluteCoordinates): Migrate off rendererBoundingBox().
+ * rendering/RenderElement.h:
+
+2014-12-15 Myles C. Maxfield <[email protected]>
+
Delete Notation because we don't use it
https://bugs.webkit.org/show_bug.cgi?id=139171
Modified: trunk/Source/WebCore/WebCore.exp.in (177300 => 177301)
--- trunk/Source/WebCore/WebCore.exp.in 2014-12-15 19:49:24 UTC (rev 177300)
+++ trunk/Source/WebCore/WebCore.exp.in 2014-12-15 20:15:05 UTC (rev 177301)
@@ -867,7 +867,6 @@
__ZN7WebCore19enclosingLayoutRectERKNS_9FloatRectE
__ZN7WebCore19floatValueForLengthERKNS_6LengthEf
__ZN7WebCore19getFileCreationTimeERKN3WTF6StringERl
-__ZN7WebCore19rendererBoundingBoxERKNS_4NodeE
__ZN7WebCore19toInt32EnforceRangeEPN3JSC9ExecStateENS0_7JSValueE
__ZN7WebCore20ApplicationCacheHost17maybeLoadResourceEPNS_14ResourceLoaderERKNS_15ResourceRequestERKNS_3URLE
__ZN7WebCore20ApplicationCacheHost25maybeLoadFallbackForErrorEPNS_14ResourceLoaderERKNS_13ResourceErrorE
Modified: trunk/Source/WebCore/accessibility/AccessibilitySlider.cpp (177300 => 177301)
--- trunk/Source/WebCore/accessibility/AccessibilitySlider.cpp 2014-12-15 19:49:24 UTC (rev 177300)
+++ trunk/Source/WebCore/accessibility/AccessibilitySlider.cpp 2014-12-15 20:15:05 UTC (rev 177301)
@@ -159,7 +159,9 @@
RenderObject* sliderRenderer = m_parent->renderer();
if (!sliderRenderer || !sliderRenderer->isSlider())
return LayoutRect();
- return rendererBoundingBox(*downcast<HTMLInputElement>(sliderRenderer->node())->sliderThumbElement());
+ if (RenderElement* thumbRenderer = downcast<HTMLInputElement>(sliderRenderer->node())->sliderThumbElement()->renderer())
+ return thumbRenderer->absoluteBoundingBoxRect();
+ return LayoutRect();
}
bool AccessibilitySliderThumb::computeAccessibilityIsIgnored() const
Modified: trunk/Source/WebCore/dom/ContainerNode.cpp (177300 => 177301)
--- trunk/Source/WebCore/dom/ContainerNode.cpp 2014-12-15 19:49:24 UTC (rev 177300)
+++ trunk/Source/WebCore/dom/ContainerNode.cpp 2014-12-15 20:15:05 UTC (rev 177301)
@@ -910,11 +910,4 @@
return ensureRareData().ensureNodeLists().addCacheWithAtomicName<RadioNodeList>(*this, name);
}
-LayoutRect rendererAnchorRect(const ContainerNode& node)
-{
- if (RenderElement* renderer = node.renderer())
- return renderer->anchorRect();
- return LayoutRect();
-}
-
} // namespace WebCore
Modified: trunk/Source/WebCore/dom/ContainerNode.h (177300 => 177301)
--- trunk/Source/WebCore/dom/ContainerNode.h 2014-12-15 19:49:24 UTC (rev 177300)
+++ trunk/Source/WebCore/dom/ContainerNode.h 2014-12-15 20:15:05 UTC (rev 177301)
@@ -304,8 +304,6 @@
ChildNodesLazySnapshot* m_nextSnapshot;
};
-LayoutRect rendererAnchorRect(const ContainerNode&);
-
} // namespace WebCore
SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::ContainerNode)
Modified: trunk/Source/WebCore/dom/Node.cpp (177300 => 177301)
--- trunk/Source/WebCore/dom/Node.cpp 2014-12-15 19:49:24 UTC (rev 177300)
+++ trunk/Source/WebCore/dom/Node.cpp 2014-12-15 20:15:05 UTC (rev 177301)
@@ -2248,13 +2248,6 @@
return inDocument() && document().hasLivingRenderTree();
}
-IntRect rendererBoundingBox(const Node& node)
-{
- if (RenderObject* renderer = node.renderer())
- return renderer->absoluteBoundingBoxRect();
- return IntRect();
-}
-
} // namespace WebCore
#ifndef NDEBUG
Modified: trunk/Source/WebCore/dom/Node.h (177300 => 177301)
--- trunk/Source/WebCore/dom/Node.h 2014-12-15 19:49:24 UTC (rev 177300)
+++ trunk/Source/WebCore/dom/Node.h 2014-12-15 20:15:05 UTC (rev 177301)
@@ -739,8 +739,6 @@
return parentNode();
}
-WEBCORE_EXPORT IntRect rendererBoundingBox(const Node&);
-
} // namespace WebCore
#ifndef NDEBUG
Modified: trunk/Source/WebCore/html/ColorInputType.cpp (177300 => 177301)
--- trunk/Source/WebCore/html/ColorInputType.cpp 2014-12-15 19:49:24 UTC (rev 177300)
+++ trunk/Source/WebCore/html/ColorInputType.cpp 2014-12-15 20:15:05 UTC (rev 177301)
@@ -204,7 +204,9 @@
IntRect ColorInputType::elementRectRelativeToRootView() const
{
- return element().document().view()->contentsToRootView(rendererBoundingBox(element()));
+ if (!element().renderer())
+ return IntRect();
+ element().document().view()->contentsToRootView(element().renderer()->absoluteBoundingBoxRect());
}
Color ColorInputType::currentColor()
Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (177300 => 177301)
--- trunk/Source/WebCore/html/HTMLInputElement.cpp 2014-12-15 19:49:24 UTC (rev 177300)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp 2014-12-15 20:15:05 UTC (rev 177301)
@@ -1877,7 +1877,10 @@
parameters.stepBase = 0;
}
- parameters.anchorRectInRootView = document().view()->contentsToRootView(rendererBoundingBox(*this));
+ if (RenderObject* renderer = this->renderer())
+ parameters.anchorRectInRootView = document().view()->contentsToRootView(renderer->absoluteBoundingBoxRect());
+ else
+ parameters.anchorRectInRootView = IntRect();
parameters.currentValue = value();
parameters.isAnchorElementRTL = computedStyle()->direction() == RTL;
#if ENABLE(DATALIST_ELEMENT)
Modified: trunk/Source/WebCore/html/ValidationMessage.cpp (177300 => 177301)
--- trunk/Source/WebCore/html/ValidationMessage.cpp 2014-12-15 19:49:24 UTC (rev 177300)
+++ trunk/Source/WebCore/html/ValidationMessage.cpp 2014-12-15 20:15:05 UTC (rev 177301)
@@ -168,6 +168,10 @@
void ValidationMessage::buildBubbleTree()
{
ASSERT(!validationMessageClient());
+
+ if (!m_element->renderer())
+ return;
+
ShadowRoot& shadowRoot = m_element->ensureUserAgentShadowRoot();
Document& document = m_element->document();
@@ -178,7 +182,7 @@
m_bubble->setInlineStyleProperty(CSSPropertyPosition, CSSValueAbsolute);
shadowRoot.appendChild(m_bubble.get(), ASSERT_NO_EXCEPTION);
document.updateLayout();
- adjustBubblePosition(rendererBoundingBox(*m_element), m_bubble.get());
+ adjustBubblePosition(m_element->renderer()->absoluteBoundingBoxRect(), m_bubble.get());
RefPtr<HTMLDivElement> clipper = HTMLDivElement::create(document);
clipper->setPseudo(AtomicString("-webkit-validation-bubble-arrow-clipper", AtomicString::ConstructFromLiteral));
Modified: trunk/Source/WebCore/page/FrameView.cpp (177300 => 177301)
--- trunk/Source/WebCore/page/FrameView.cpp 2014-12-15 19:49:24 UTC (rev 177300)
+++ trunk/Source/WebCore/page/FrameView.cpp 2014-12-15 20:15:05 UTC (rev 177301)
@@ -2018,7 +2018,9 @@
{
frame().document()->updateLayoutIgnorePendingStylesheets();
- LayoutRect bounds = rendererAnchorRect(*element);
+ LayoutRect bounds;
+ if (RenderElement* renderer = element->renderer())
+ bounds = renderer->anchorRect();
int centeringOffsetX = (rect.width() - bounds.width()) / 2;
int centeringOffsetY = (rect.height() - bounds.height()) / 2;
setScrollPosition(IntPoint(bounds.x() - centeringOffsetX - rect.x(), bounds.y() - centeringOffsetY - rect.y()));
@@ -2787,8 +2789,8 @@
return;
LayoutRect rect;
- if (anchorNode != frame().document())
- rect = rendererAnchorRect(*anchorNode.get());
+ if (anchorNode != frame().document() && anchorNode->renderer())
+ rect = anchorNode->renderer()->anchorRect();
// Scroll nested layers and frames to reveal the anchor.
// Align to the top and to the closest side (this matches other browsers).
Modified: trunk/Source/WebCore/page/SpatialNavigation.cpp (177300 => 177301)
--- trunk/Source/WebCore/page/SpatialNavigation.cpp 2014-12-15 19:49:24 UTC (rev 177300)
+++ trunk/Source/WebCore/page/SpatialNavigation.cpp 2014-12-15 20:15:05 UTC (rev 177301)
@@ -523,7 +523,9 @@
if (is<Document>(*node))
return frameRectInAbsoluteCoordinates(downcast<Document>(*node).frame());
- LayoutRect rect = rectToAbsoluteCoordinates(node->document().frame(), rendererBoundingBox(*node));
+ LayoutRect rect;
+ if (RenderObject* renderer = node->renderer())
+ rect = rectToAbsoluteCoordinates(node->document().frame(), renderer->absoluteBoundingBoxRect());
// For authors that use border instead of outline in their CSS, we compensate by ignoring the border when calculating
// the rect of the focused element.
Modified: trunk/Source/WebCore/rendering/RenderElement.h (177300 => 177301)
--- trunk/Source/WebCore/rendering/RenderElement.h 2014-12-15 19:49:24 UTC (rev 177300)
+++ trunk/Source/WebCore/rendering/RenderElement.h 2014-12-15 20:15:05 UTC (rev 177301)
@@ -151,7 +151,8 @@
bool hasHiddenBackface() const { return style().backfaceVisibility() == BackfaceVisibilityHidden; }
// anchorRect() is conceptually similar to absoluteBoundingBoxRect(), but is intended for scrolling to an anchor.
- // It works differently than absoluteBoundingBoxRect() for inline renderers.
+ // For inline renderers, this gets the logical top left of the first leaf child and the logical bottom right of the
+ // last leaf child, converts them to absolute coordinates, and makes a box out of them.
LayoutRect anchorRect() const;
bool hasFilter() const { return style().hasFilter(); }
Modified: trunk/Source/WebKit/mac/ChangeLog (177300 => 177301)
--- trunk/Source/WebKit/mac/ChangeLog 2014-12-15 19:49:24 UTC (rev 177300)
+++ trunk/Source/WebKit/mac/ChangeLog 2014-12-15 20:15:05 UTC (rev 177301)
@@ -1,3 +1,13 @@
+2014-12-15 Myles C. Maxfield <[email protected]>
+
+ Addressing post-review comments in r177035
+ https://bugs.webkit.org/show_bug.cgi?id=139557
+
+ Reviewed by Darin Adler.
+
+ * WebView/WebActionMenuController.mm:
+ (elementBoundingBoxInWindowCoordinatesFromNode): Migrate off rendererBoundingBox().
+
2014-12-15 Timothy Horton <[email protected]>
Implement Data Detectors immediate actions for Legacy WebKit
Modified: trunk/Source/WebKit/mac/WebView/WebActionMenuController.mm (177300 => 177301)
--- trunk/Source/WebKit/mac/WebView/WebActionMenuController.mm 2014-12-15 19:49:24 UTC (rev 177300)
+++ trunk/Source/WebKit/mac/WebView/WebActionMenuController.mm 2014-12-15 20:15:05 UTC (rev 177301)
@@ -256,7 +256,11 @@
if (!view)
return IntRect();
- return view->contentsToWindow(rendererBoundingBox(*node));
+ RenderObject* renderer = node->renderer();
+ if (!renderer)
+ return IntRect();
+
+ return view->contentsToWindow(renderer->absoluteBoundingBoxRect());
}
- (NSArray *)_defaultMenuItemsForLink
Modified: trunk/Source/WebKit2/ChangeLog (177300 => 177301)
--- trunk/Source/WebKit2/ChangeLog 2014-12-15 19:49:24 UTC (rev 177300)
+++ trunk/Source/WebKit2/ChangeLog 2014-12-15 20:15:05 UTC (rev 177301)
@@ -1,3 +1,15 @@
+2014-12-15 Myles C. Maxfield <[email protected]>
+
+ Addressing post-review comments in r177035
+ https://bugs.webkit.org/show_bug.cgi?id=139557
+
+ Reviewed by Darin Adler.
+
+ * Shared/WebHitTestResult.cpp:
+ (WebKit::WebHitTestResult::Data::elementBoundingBoxInWindowCoordinates): Migrate off rendererBoundingBox().
+ * WebProcess/WebPage/CoordinatedGraphics/WebPageCoordinatedGraphics.cpp:
+ (WebKit::WebPage::findZoomableAreaForPoint): Ditto.
+
2014-12-15 Timothy Horton <[email protected]>
Implement Data Detectors immediate actions for WebKit2
Modified: trunk/Source/WebKit2/Shared/WebHitTestResult.cpp (177300 => 177301)
--- trunk/Source/WebKit2/Shared/WebHitTestResult.cpp 2014-12-15 19:49:24 UTC (rev 177300)
+++ trunk/Source/WebKit2/Shared/WebHitTestResult.cpp 2014-12-15 20:15:05 UTC (rev 177301)
@@ -118,7 +118,11 @@
if (!view)
return IntRect();
- return view->contentsToWindow(rendererBoundingBox(*node));
+ RenderObject* renderer = node->renderer();
+ if (!renderer)
+ return IntRect();
+
+ return view->contentsToWindow(renderer->absoluteBoundingBoxRect());
}
} // WebKit
Modified: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/WebPageCoordinatedGraphics.cpp (177300 => 177301)
--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/WebPageCoordinatedGraphics.cpp 2014-12-15 19:49:24 UTC (rev 177300)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/WebPageCoordinatedGraphics.cpp 2014-12-15 20:15:05 UTC (rev 177301)
@@ -55,7 +55,9 @@
if (!node)
return;
- IntRect zoomableArea = rendererBoundingBox(*node);
+ IntRect zoomableArea;
+ if (RenderObject* renderer = node->renderer())
+ zoomableArea = renderer->absoluteBoundingBoxRect();
while (true) {
bool found = !node->isTextNode() && !node->isShadowRoot();
@@ -71,7 +73,8 @@
break;
node = node->parentNode();
- zoomableArea.unite(rendererBoundingBox(*node));
+ if (RenderObject* renderer = node.renderer())
+ zoomableArea.unite(renderer->absoluteBoundingBoxRect());
}
if (node->document().frame() && node->document().frame()->view()) {