Changeset 156256 in webkit for trunk/Source/WebCore/editing/ApplyStyleCommand.cpp
- Timestamp:
- Sep 22, 2013, 8:40:47 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/editing/ApplyStyleCommand.cpp
r156253 r156256 1040 1040 // Along the way, styled elements that contain targetNode are removed and accumulated into elementsToPushDown. 1041 1041 // Each child of the removed element, exclusing ancestors of targetNode, is then wrapped by clones of elements in elementsToPushDown. 1042 Vector<Ref Ptr<Element>> elementsToPushDown;1042 Vector<Ref<Element>> elementsToPushDown; 1043 1043 while (current && current != targetNode && current->contains(targetNode)) { 1044 1044 NodeVector currentChildren; 1045 getChildNodes(current.get(), currentChildren); 1045 getChildNodes(*current.get(), currentChildren); 1046 1046 1047 RefPtr<StyledElement> styledElement; 1047 1048 if (current->isStyledElement() && isStyledInlineElementToRemove(toElement(current.get()))) { 1048 1049 styledElement = static_cast<StyledElement*>(current.get()); 1049 elementsToPushDown.append( styledElement);1050 elementsToPushDown.append(*styledElement); 1050 1051 } 1051 1052 … … 1057 1058 // FIXME: we should aggregate inline child elements together so that we don't wrap each child separately. 1058 1059 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()) 1061 1062 continue; 1062 if (!child ->contains(targetNode) && elementsToPushDown.size()) {1063 if (!child.contains(targetNode) && elementsToPushDown.size()) { 1063 1064 for (size_t i = 0; i < elementsToPushDown.size(); i++) { 1064 1065 RefPtr<Element> wrapper = elementsToPushDown[i]->cloneElementWithoutChildren(); 1065 1066 wrapper->removeAttribute(styleAttr); 1066 surroundNodeRangeWithElement( child,child, wrapper);1067 surroundNodeRangeWithElement(&child, &child, wrapper); 1067 1068 } 1068 1069 } … … 1070 1071 // Apply style to all nodes containing targetNode and their siblings but NOT to targetNode 1071 1072 // 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()); 1074 1075 1075 1076 // We found the next node for the outer loop (contains targetNode) 1076 1077 // 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; 1079 1080 } 1080 1081 }
Note:
See TracChangeset
for help on using the changeset viewer.