Changeset 154225 in webkit


Ignore:
Timestamp:
Aug 17, 2013, 7:37:25 AM (12 years ago)
Author:
Darin Adler
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.

Location:
trunk/Source/WebCore
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r154224 r154225  
     12013-08-17  Darin Adler  <darin@apple.com>
     2
     3        <https://webkit.org/b/119942> Remove unnecessary uses of Element::ownerDocument
     4
     5        Reviewed by Andreas Kling.
     6
     7        The Element::document is a simpler faster alternative to Element::ownerDocument.
     8        The only behavior difference between the two is that ownerDocument returns 0 when
     9        called on a Document.
     10
     11        * html/HTMLMediaElement.cpp:
     12        (WebCore::HTMLMediaElement::supportsFocus): Call document instead of ownerDocument.
     13        (WebCore::HTMLMediaElement::mediaPlayerOwningDocument): Removed null checking of
     14        document and call to ownerDocument, since ownerDocument will never return non-null
     15        if document returns null.
     16        (WebCore::HTMLMediaElement::mediaPlayerSawUnsupportedTracks): Call document instead
     17        of ownerDocument.
     18
     19        * inspector/DOMEditor.cpp:
     20        (WebCore::DOMEditor::SetOuterHTMLAction::perform): Call document instead of ownerDocument.
     21
     22        * inspector/InspectorCSSAgent.cpp:
     23        (WebCore::InspectorCSSAgent::getMatchedStylesForNode): Call document instead of ownerDocument.
     24        (WebCore::InspectorCSSAgent::forcePseudoState): Call document instead of ownerDocument.
     25        (WebCore::InspectorCSSAgent::resetPseudoStates): Call document instead of ownerDocument.
     26
     27        * inspector/InspectorDOMAgent.cpp:
     28        (WebCore::InspectorDOMAgent::setOuterHTML): Call document instead of expression that
     29        does the same thing in a roundabout way.
     30        (WebCore::InspectorDOMAgent::focusNode): Call document instead of ownerDocument.
     31        (WebCore::InspectorDOMAgent::resolveNode): Call document instead of expression that
     32        does the same thing in a roundabout way.
     33
     34        * page/DragController.cpp:
     35        (WebCore::DragController::concludeEditDrag): Call document instead of ownerDocument.
     36
     37        * svg/SVGElementInstance.cpp:
     38        (WebCore::SVGElementInstance::ownerDocument): Call document instead of ownerDocument.
     39
    1402013-08-17  Darin Adler  <darin@apple.com>
    241
  • trunk/Source/WebCore/html/HTMLMediaElement.cpp

    r154201 r154225  
    425425bool HTMLMediaElement::supportsFocus() const
    426426{
    427     if (ownerDocument()->isMediaDocument())
     427    if (document()->isMediaDocument())
    428428        return false;
    429429
     
    16681668Document* HTMLMediaElement::mediaPlayerOwningDocument()
    16691669{
    1670     Document* d = document();
    1671    
    1672     if (!d)
    1673         d = ownerDocument();
    1674    
    1675     return d;
     1670    return document();
    16761671}
    16771672
     
    37683763    // This is normally acceptable except when we are in a standalone
    37693764    // MediaDocument. If so, tell the document what has happened.
    3770     if (ownerDocument()->isMediaDocument()) {
    3771         MediaDocument* mediaDocument = toMediaDocument(ownerDocument());
     3765    if (document()->isMediaDocument()) {
     3766        MediaDocument* mediaDocument = toMediaDocument(document());
    37723767        mediaDocument->mediaElementSawUnsupportedTracks();
    37733768    }
  • trunk/Source/WebCore/inspector/DOMEditor.cpp

    r110854 r154225  
    221221    {
    222222        m_oldHTML = createMarkup(m_node.get());
    223         DOMPatchSupport domPatchSupport(m_domEditor.get(), m_node->ownerDocument());
     223        DOMPatchSupport domPatchSupport(m_domEditor.get(), m_node->document());
    224224        m_newNode = domPatchSupport.patchNode(m_node.get(), m_html, ec);
    225225        return !ec;
  • trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp

    r154201 r154225  
    810810
    811811    // Matched rules.
    812     StyleResolver& styleResolver = element->ownerDocument()->ensureStyleResolver();
     812    StyleResolver& styleResolver = element->document()->ensureStyleResolver();
    813813    Vector<RefPtr<StyleRuleBase> > matchedRules = styleResolver.styleRulesForElement(element, StyleResolver::AllCSSRules);
    814814    matchedCSSRules = buildArrayForMatchedRuleList(matchedRules, styleResolver, element);
     
    835835        Element* parentElement = element->parentElement();
    836836        while (parentElement) {
    837             StyleResolver& parentStyleResolver = parentElement->ownerDocument()->ensureStyleResolver();
     837            StyleResolver& parentStyleResolver = parentElement->document()->ensureStyleResolver();
    838838            Vector<RefPtr<StyleRuleBase> > parentMatchedRules = parentStyleResolver.styleRulesForElement(parentElement, StyleResolver::AllCSSRules);
    839839            RefPtr<TypeBuilder::CSS::InheritedStyleEntry> entry = TypeBuilder::CSS::InheritedStyleEntry::create()
     
    10541054    else
    10551055        m_nodeIdToForcedPseudoState.remove(nodeId);
    1056     element->ownerDocument()->styleResolverChanged(RecalcStyleImmediately);
     1056    element->document()->styleResolverChanged(RecalcStyleImmediately);
    10571057}
    10581058
     
    14551455    for (NodeIdToForcedPseudoState::iterator it = m_nodeIdToForcedPseudoState.begin(), end = m_nodeIdToForcedPseudoState.end(); it != end; ++it) {
    14561456        Element* element = toElement(m_domAgent->nodeForId(it->key));
    1457         if (element && element->ownerDocument())
    1458             documentsToChange.add(element->ownerDocument());
     1457        if (element && element->document())
     1458            documentsToChange.add(element->document());
    14591459    }
    14601460
  • trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp

    r154106 r154225  
    785785        return;
    786786
    787     Document* document = node->isDocumentNode() ? toDocument(node) : node->ownerDocument();
     787    Document* document = node->document();
    788788    if (!document || (!document->isHTMLDocument() && !document->isXHTMLDocument()
    789789#if ENABLE(SVG)
     
    10871087    m_nodeToFocus = 0;
    10881088
    1089     Document* document = node->ownerDocument();
     1089    Document* document = node->document();
    10901090    if (!document)
    10911091        return;
     
    18171817PassRefPtr<TypeBuilder::Runtime::RemoteObject> InspectorDOMAgent::resolveNode(Node* node, const String& objectGroup)
    18181818{
    1819     Document* document = node->isDocumentNode() ? node->document() : node->ownerDocument();
     1819    Document* document = node->document();
    18201820    Frame* frame = document ? document->frame() : 0;
    18211821    if (!frame)
  • trunk/Source/WebCore/page/DragController.cpp

    r154224 r154225  
    463463    if (!element)
    464464        return false;
    465     RefPtr<Frame> innerFrame = element->ownerDocument()->frame();
     465    RefPtr<Frame> innerFrame = element->document()->frame();
    466466    ASSERT(innerFrame);
    467467
  • trunk/Source/WebCore/svg/SVGElementInstance.cpp

    r153926 r154225  
    167167Document* SVGElementInstance::ownerDocument() const
    168168{
    169     return m_element ? m_element->ownerDocument() : 0;
     169    return m_element ? m_element->document() : 0;
    170170}
    171171
Note: See TracChangeset for help on using the changeset viewer.