- Revision
- 154225
- Author
- [email protected]
- Date
- 2013-08-17 07:37:25 -0700 (Sat, 17 Aug 2013)
Log Message
<https://webkit.org/b/119942> Remove unnecessary uses of Element::ownerDocument
Reviewed by Andreas Kling.
The Element::document is a simpler faster alternative to Element::ownerDocument.
The only behavior difference between the two is that ownerDocument returns 0 when
called on a Document.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::supportsFocus): Call document instead of ownerDocument.
(WebCore::HTMLMediaElement::mediaPlayerOwningDocument): Removed null checking of
document and call to ownerDocument, since ownerDocument will never return non-null
if document returns null.
(WebCore::HTMLMediaElement::mediaPlayerSawUnsupportedTracks): Call document instead
of ownerDocument.
* inspector/DOMEditor.cpp:
(WebCore::DOMEditor::SetOuterHTMLAction::perform): Call document instead of ownerDocument.
* inspector/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::getMatchedStylesForNode): Call document instead of ownerDocument.
(WebCore::InspectorCSSAgent::forcePseudoState): Call document instead of ownerDocument.
(WebCore::InspectorCSSAgent::resetPseudoStates): Call document instead of ownerDocument.
* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::setOuterHTML): Call document instead of _expression_ that
does the same thing in a roundabout way.
(WebCore::InspectorDOMAgent::focusNode): Call document instead of ownerDocument.
(WebCore::InspectorDOMAgent::resolveNode): Call document instead of _expression_ that
does the same thing in a roundabout way.
* page/DragController.cpp:
(WebCore::DragController::concludeEditDrag): Call document instead of ownerDocument.
* svg/SVGElementInstance.cpp:
(WebCore::SVGElementInstance::ownerDocument): Call document instead of ownerDocument.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (154224 => 154225)
--- trunk/Source/WebCore/ChangeLog 2013-08-17 14:27:20 UTC (rev 154224)
+++ trunk/Source/WebCore/ChangeLog 2013-08-17 14:37:25 UTC (rev 154225)
@@ -1,5 +1,44 @@
2013-08-17 Darin Adler <[email protected]>
+ <https://webkit.org/b/119942> Remove unnecessary uses of Element::ownerDocument
+
+ Reviewed by Andreas Kling.
+
+ The Element::document is a simpler faster alternative to Element::ownerDocument.
+ The only behavior difference between the two is that ownerDocument returns 0 when
+ called on a Document.
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::supportsFocus): Call document instead of ownerDocument.
+ (WebCore::HTMLMediaElement::mediaPlayerOwningDocument): Removed null checking of
+ document and call to ownerDocument, since ownerDocument will never return non-null
+ if document returns null.
+ (WebCore::HTMLMediaElement::mediaPlayerSawUnsupportedTracks): Call document instead
+ of ownerDocument.
+
+ * inspector/DOMEditor.cpp:
+ (WebCore::DOMEditor::SetOuterHTMLAction::perform): Call document instead of ownerDocument.
+
+ * inspector/InspectorCSSAgent.cpp:
+ (WebCore::InspectorCSSAgent::getMatchedStylesForNode): Call document instead of ownerDocument.
+ (WebCore::InspectorCSSAgent::forcePseudoState): Call document instead of ownerDocument.
+ (WebCore::InspectorCSSAgent::resetPseudoStates): Call document instead of ownerDocument.
+
+ * inspector/InspectorDOMAgent.cpp:
+ (WebCore::InspectorDOMAgent::setOuterHTML): Call document instead of _expression_ that
+ does the same thing in a roundabout way.
+ (WebCore::InspectorDOMAgent::focusNode): Call document instead of ownerDocument.
+ (WebCore::InspectorDOMAgent::resolveNode): Call document instead of _expression_ that
+ does the same thing in a roundabout way.
+
+ * page/DragController.cpp:
+ (WebCore::DragController::concludeEditDrag): Call document instead of ownerDocument.
+
+ * svg/SVGElementInstance.cpp:
+ (WebCore::SVGElementInstance::ownerDocument): Call document instead of ownerDocument.
+
+2013-08-17 Darin Adler <[email protected]>
+
<https://webkit.org/b/119941> Make Page::dragController return a reference
Reviewed by Andreas Kling.
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (154224 => 154225)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2013-08-17 14:27:20 UTC (rev 154224)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2013-08-17 14:37:25 UTC (rev 154225)
@@ -424,7 +424,7 @@
bool HTMLMediaElement::supportsFocus() const
{
- if (ownerDocument()->isMediaDocument())
+ if (document()->isMediaDocument())
return false;
// If no controls specified, we should still be able to focus the element if it has tabIndex.
@@ -1667,12 +1667,7 @@
Document* HTMLMediaElement::mediaPlayerOwningDocument()
{
- Document* d = document();
-
- if (!d)
- d = ownerDocument();
-
- return d;
+ return document();
}
void HTMLMediaElement::mediaPlayerNetworkStateChanged(MediaPlayer*)
@@ -3767,8 +3762,8 @@
// The MediaPlayer came across content it cannot completely handle.
// This is normally acceptable except when we are in a standalone
// MediaDocument. If so, tell the document what has happened.
- if (ownerDocument()->isMediaDocument()) {
- MediaDocument* mediaDocument = toMediaDocument(ownerDocument());
+ if (document()->isMediaDocument()) {
+ MediaDocument* mediaDocument = toMediaDocument(document());
mediaDocument->mediaElementSawUnsupportedTracks();
}
}
Modified: trunk/Source/WebCore/inspector/DOMEditor.cpp (154224 => 154225)
--- trunk/Source/WebCore/inspector/DOMEditor.cpp 2013-08-17 14:27:20 UTC (rev 154224)
+++ trunk/Source/WebCore/inspector/DOMEditor.cpp 2013-08-17 14:37:25 UTC (rev 154225)
@@ -220,7 +220,7 @@
virtual bool perform(ExceptionCode& ec)
{
m_oldHTML = createMarkup(m_node.get());
- DOMPatchSupport domPatchSupport(m_domEditor.get(), m_node->ownerDocument());
+ DOMPatchSupport domPatchSupport(m_domEditor.get(), m_node->document());
m_newNode = domPatchSupport.patchNode(m_node.get(), m_html, ec);
return !ec;
}
Modified: trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp (154224 => 154225)
--- trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp 2013-08-17 14:27:20 UTC (rev 154224)
+++ trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp 2013-08-17 14:37:25 UTC (rev 154225)
@@ -809,7 +809,7 @@
return;
// Matched rules.
- StyleResolver& styleResolver = element->ownerDocument()->ensureStyleResolver();
+ StyleResolver& styleResolver = element->document()->ensureStyleResolver();
Vector<RefPtr<StyleRuleBase> > matchedRules = styleResolver.styleRulesForElement(element, StyleResolver::AllCSSRules);
matchedCSSRules = buildArrayForMatchedRuleList(matchedRules, styleResolver, element);
@@ -834,7 +834,7 @@
RefPtr<TypeBuilder::Array<TypeBuilder::CSS::InheritedStyleEntry> > entries = TypeBuilder::Array<TypeBuilder::CSS::InheritedStyleEntry>::create();
Element* parentElement = element->parentElement();
while (parentElement) {
- StyleResolver& parentStyleResolver = parentElement->ownerDocument()->ensureStyleResolver();
+ StyleResolver& parentStyleResolver = parentElement->document()->ensureStyleResolver();
Vector<RefPtr<StyleRuleBase> > parentMatchedRules = parentStyleResolver.styleRulesForElement(parentElement, StyleResolver::AllCSSRules);
RefPtr<TypeBuilder::CSS::InheritedStyleEntry> entry = TypeBuilder::CSS::InheritedStyleEntry::create()
.setMatchedCSSRules(buildArrayForMatchedRuleList(parentMatchedRules, styleResolver, parentElement));
@@ -1053,7 +1053,7 @@
m_nodeIdToForcedPseudoState.set(nodeId, forcedPseudoState);
else
m_nodeIdToForcedPseudoState.remove(nodeId);
- element->ownerDocument()->styleResolverChanged(RecalcStyleImmediately);
+ element->document()->styleResolverChanged(RecalcStyleImmediately);
}
void InspectorCSSAgent::getNamedFlowCollection(ErrorString* errorString, int documentNodeId, RefPtr<TypeBuilder::Array<TypeBuilder::CSS::NamedFlow> >& result)
@@ -1454,8 +1454,8 @@
HashSet<Document*> documentsToChange;
for (NodeIdToForcedPseudoState::iterator it = m_nodeIdToForcedPseudoState.begin(), end = m_nodeIdToForcedPseudoState.end(); it != end; ++it) {
Element* element = toElement(m_domAgent->nodeForId(it->key));
- if (element && element->ownerDocument())
- documentsToChange.add(element->ownerDocument());
+ if (element && element->document())
+ documentsToChange.add(element->document());
}
m_nodeIdToForcedPseudoState.clear();
Modified: trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp (154224 => 154225)
--- trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp 2013-08-17 14:27:20 UTC (rev 154224)
+++ trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp 2013-08-17 14:37:25 UTC (rev 154225)
@@ -784,7 +784,7 @@
if (!node)
return;
- Document* document = node->isDocumentNode() ? toDocument(node) : node->ownerDocument();
+ Document* document = node->document();
if (!document || (!document->isHTMLDocument() && !document->isXHTMLDocument()
#if ENABLE(SVG)
&& !document->isSVGDocument()
@@ -1086,7 +1086,7 @@
RefPtr<Node> node = m_nodeToFocus.get();
m_nodeToFocus = 0;
- Document* document = node->ownerDocument();
+ Document* document = node->document();
if (!document)
return;
Frame* frame = document->frame();
@@ -1816,7 +1816,7 @@
PassRefPtr<TypeBuilder::Runtime::RemoteObject> InspectorDOMAgent::resolveNode(Node* node, const String& objectGroup)
{
- Document* document = node->isDocumentNode() ? node->document() : node->ownerDocument();
+ Document* document = node->document();
Frame* frame = document ? document->frame() : 0;
if (!frame)
return 0;
Modified: trunk/Source/WebCore/page/DragController.cpp (154224 => 154225)
--- trunk/Source/WebCore/page/DragController.cpp 2013-08-17 14:27:20 UTC (rev 154224)
+++ trunk/Source/WebCore/page/DragController.cpp 2013-08-17 14:37:25 UTC (rev 154225)
@@ -462,7 +462,7 @@
Element* element = elementUnderMouse(m_documentUnderMouse.get(), point);
if (!element)
return false;
- RefPtr<Frame> innerFrame = element->ownerDocument()->frame();
+ RefPtr<Frame> innerFrame = element->document()->frame();
ASSERT(innerFrame);
if (m_page->dragCaretController()->hasCaret() && !dispatchTextInputEventFor(innerFrame.get(), dragData))
Modified: trunk/Source/WebCore/svg/SVGElementInstance.cpp (154224 => 154225)
--- trunk/Source/WebCore/svg/SVGElementInstance.cpp 2013-08-17 14:27:20 UTC (rev 154224)
+++ trunk/Source/WebCore/svg/SVGElementInstance.cpp 2013-08-17 14:37:25 UTC (rev 154225)
@@ -166,7 +166,7 @@
Document* SVGElementInstance::ownerDocument() const
{
- return m_element ? m_element->ownerDocument() : 0;
+ return m_element ? m_element->document() : 0;
}
void SVGElementInstance::setShadowTreeElement(SVGElement* element)