Ignore:
Timestamp:
Sep 22, 2013, 8:40:47 PM (12 years ago)
Author:
[email protected]
Message:

CTTE: Use references more in ContainerNode, ContainerNodeAlgorithms and related classes
https://bugs.webkit.org/show_bug.cgi?id=121772

Reviewed by Andreas Kling.

../WebCore:

Use references for never null Nodes in ContainerNode and related classes.

../WebKit/qt:

  • Api/qwebelement.cpp:

(QWebElementCollection::append):
Update to work with the new StaticNodeList adopt function.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/editing/ApplyStyleCommand.cpp

    r156253 r156256  
    10401040    // Along the way, styled elements that contain targetNode are removed and accumulated into elementsToPushDown.
    10411041    // Each child of the removed element, exclusing ancestors of targetNode, is then wrapped by clones of elements in elementsToPushDown.
    1042     Vector<RefPtr<Element> > elementsToPushDown;
     1042    Vector<Ref<Element>> elementsToPushDown;
    10431043    while (current && current != targetNode && current->contains(targetNode)) {
    10441044        NodeVector currentChildren;
    1045         getChildNodes(current.get(), currentChildren);
     1045        getChildNodes(*current.get(), currentChildren);
     1046
    10461047        RefPtr<StyledElement> styledElement;
    10471048        if (current->isStyledElement() && isStyledInlineElementToRemove(toElement(current.get()))) {
    10481049            styledElement = static_cast<StyledElement*>(current.get());
    1049             elementsToPushDown.append(styledElement);
     1050            elementsToPushDown.append(*styledElement);
    10501051        }
    10511052
     
    10571058        // FIXME: we should aggregate inline child elements together so that we don't wrap each child separately.
    10581059        for (size_t i = 0; i < currentChildren.size(); ++i) {
    1059             Node* child = currentChildren[i].get();
    1060             if (!child->parentNode())
     1060            Node& child = currentChildren[i].get();
     1061            if (!child.parentNode())
    10611062                continue;
    1062             if (!child->contains(targetNode) && elementsToPushDown.size()) {
     1063            if (!child.contains(targetNode) && elementsToPushDown.size()) {
    10631064                for (size_t i = 0; i < elementsToPushDown.size(); i++) {
    10641065                    RefPtr<Element> wrapper = elementsToPushDown[i]->cloneElementWithoutChildren();
    10651066                    wrapper->removeAttribute(styleAttr);
    1066                     surroundNodeRangeWithElement(child, child, wrapper);
     1067                    surroundNodeRangeWithElement(&child, &child, wrapper);
    10671068                }
    10681069            }
     
    10701071            // Apply style to all nodes containing targetNode and their siblings but NOT to targetNode
    10711072            // But if we've removed styledElement then go ahead and always apply the style.
    1072             if (child != targetNode || styledElement)
    1073                 applyInlineStyleToPushDown(child, styleToPushDown.get());
     1073            if (&child != targetNode || styledElement)
     1074                applyInlineStyleToPushDown(&child, styleToPushDown.get());
    10741075
    10751076            // We found the next node for the outer loop (contains targetNode)
    10761077            // When reached targetNode, stop the outer loop upon the completion of the current inner loop
    1077             if (child == targetNode || child->contains(targetNode))
    1078                 current = child;
     1078            if (&child == targetNode || child.contains(targetNode))
     1079                current = &child;
    10791080        }
    10801081    }
Note: See TracChangeset for help on using the changeset viewer.