Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: WebCore/editing/ApplyStyleCommand.h
- ===================================================================
- --- WebCore/editing/ApplyStyleCommand.h (revision 71319)
- +++ WebCore/editing/ApplyStyleCommand.h (working copy)
- @@ -99,7 +99,7 @@
- void fixRangeAndApplyInlineStyle(CSSMutableStyleDeclaration*, const Position& start, const Position& end);
- void applyInlineStyleToNodeRange(CSSMutableStyleDeclaration*, Node* startNode, Node* pastEndNode);
- void addBlockStyle(const StyleChange&, HTMLElement*);
- - void addInlineStyleIfNeeded(CSSMutableStyleDeclaration*, Node* start, Node* end, EAddStyledElement addStyledElement = AddStyledElement);
- + void addInlineStyleIfNeeded(CSSMutableStyleDeclaration*, PassRefPtr<Node> start, PassRefPtr<Node> end, EAddStyledElement addStyledElement = AddStyledElement);
- void splitTextAtStart(const Position& start, const Position& end);
- void splitTextAtEnd(const Position& start, const Position& end);
- void splitTextElementAtStart(const Position& start, const Position& end);
- @@ -110,7 +110,7 @@
- bool mergeEndWithNextIfIdentical(const Position& start, const Position& end);
- void cleanupUnstyledAppleStyleSpans(Node* dummySpanAncestor);
- - void surroundNodeRangeWithElement(Node* start, Node* end, PassRefPtr<Element>);
- + void surroundNodeRangeWithElement(PassRefPtr<Node> start, PassRefPtr<Node> end, PassRefPtr<Element>);
- float computedFontSize(const Node*);
- void joinChildTextNodes(Node*, const Position& start, const Position& end);
- Index: WebCore/editing/ApplyStyleCommand.cpp
- ===================================================================
- --- WebCore/editing/ApplyStyleCommand.cpp (revision 71319)
- +++ WebCore/editing/ApplyStyleCommand.cpp (working copy)
- @@ -1046,6 +1046,8 @@
- removeInlineStyle(styleWithoutEmbedding ? styleWithoutEmbedding.get() : style, removeStart, end);
- start = startPosition();
- end = endPosition();
- + if (start.isNull() || start.isOrphan() || end.isNull() || end.isOrphan())
- + return;
- if (splitStart) {
- if (mergeStartWithPreviousIfIdentical(start, end)) {
- @@ -1659,9 +1661,7 @@
- break;
- node = next.get();
- }
- -
- - ASSERT(s.node()->inDocument());
- - ASSERT(e.node()->inDocument());
- +
- updateStartEnd(s, e);
- }
- @@ -1860,18 +1860,19 @@
- return false;
- }
- -void ApplyStyleCommand::surroundNodeRangeWithElement(Node* startNode, Node* endNode, PassRefPtr<Element> elementToInsert)
- +void ApplyStyleCommand::surroundNodeRangeWithElement(PassRefPtr<Node> passedStartNode, PassRefPtr<Node> endNode, PassRefPtr<Element> elementToInsert)
- {
- - ASSERT(startNode);
- + ASSERT(passedStartNode);
- ASSERT(endNode);
- ASSERT(elementToInsert);
- + RefPtr<Node> startNode = passedStartNode;
- RefPtr<Element> element = elementToInsert;
- insertNodeBefore(element, startNode);
- -
- - Node* node = startNode;
- - while (1) {
- - Node* next = node->nextSibling();
- +
- + RefPtr<Node> node = startNode;
- + while (node) {
- + RefPtr<Node> next = node->nextSibling();
- removeNode(node);
- appendNode(node, element);
- if (node == endNode)
- @@ -1879,17 +1880,17 @@
- node = next;
- }
- - Node* nextSibling = element->nextSibling();
- - Node* previousSibling = element->previousSibling();
- + RefPtr<Node> nextSibling = element->nextSibling();
- + RefPtr<Node> previousSibling = element->previousSibling();
- if (nextSibling && nextSibling->isElementNode() && nextSibling->isContentEditable()
- - && areIdenticalElements(element.get(), static_cast<Element*>(nextSibling)))
- - mergeIdenticalElements(element, static_cast<Element*>(nextSibling));
- + && areIdenticalElements(element.get(), static_cast<Element*>(nextSibling.get())))
- + mergeIdenticalElements(element.get(), static_cast<Element*>(nextSibling.get()));
- if (previousSibling && previousSibling->isElementNode() && previousSibling->isContentEditable()) {
- Node* mergedElement = previousSibling->nextSibling();
- if (mergedElement->isElementNode() && mergedElement->isContentEditable()
- - && areIdenticalElements(static_cast<Element*>(previousSibling), static_cast<Element*>(mergedElement)))
- - mergeIdenticalElements(static_cast<Element*>(previousSibling), static_cast<Element*>(mergedElement));
- + && areIdenticalElements(static_cast<Element*>(previousSibling.get()), static_cast<Element*>(mergedElement)))
- + mergeIdenticalElements(static_cast<Element*>(previousSibling.get()), static_cast<Element*>(mergedElement));
- }
- // FIXME: We should probably call updateStartEnd if the start or end was in the node
- @@ -1911,17 +1912,22 @@
- setNodeAttribute(block, styleAttr, cssText);
- }
- -void ApplyStyleCommand::addInlineStyleIfNeeded(CSSMutableStyleDeclaration *style, Node *startNode, Node *endNode, EAddStyledElement addStyledElement)
- +void ApplyStyleCommand::addInlineStyleIfNeeded(CSSMutableStyleDeclaration *style, PassRefPtr<Node> passedStart, PassRefPtr<Node> passedEnd, EAddStyledElement addStyledElement)
- {
- + if (!passedStart || !passedEnd || !passedStart->inDocument() || !passedEnd->inDocument())
- + return;
- + RefPtr<Node> startNode = passedStart;
- + RefPtr<Node> endNode = passedEnd;
- +
- // It's okay to obtain the style at the startNode because we've removed all relevant styles from the current run.
- RefPtr<HTMLElement> dummyElement;
- Position positionForStyleComparison;
- if (!startNode->isElementNode()) {
- dummyElement = createStyleSpanElement(document());
- - insertNodeAt(dummyElement, positionBeforeNode(startNode));
- + insertNodeAt(dummyElement, positionBeforeNode(startNode.get()));
- positionForStyleComparison = positionBeforeNode(dummyElement.get());
- } else
- - positionForStyleComparison = firstPositionInNode(startNode);
- + positionForStyleComparison = firstPositionInNode(startNode.get());
- StyleChange styleChange(style, positionForStyleComparison);
- @@ -1931,7 +1937,7 @@
- // Find appropriate font and span elements top-down.
- HTMLElement* fontContainer = 0;
- HTMLElement* styleContainer = 0;
- - for (Node* container = startNode; container && startNode == endNode; container = container->firstChild()) {
- + for (Node* container = startNode.get(); container && startNode == endNode; container = container->firstChild()) {
- if (container->isHTMLElement() && container->hasTagName(fontTag))
- fontContainer = static_cast<HTMLElement*>(container);
- bool styleContainerIsNotSpan = !styleContainer || !styleContainer->hasTagName(spanTag);
- Index: WebCore/WebCore.xcodeproj/project.pbxproj
- ===================================================================
- --- WebCore/WebCore.xcodeproj/project.pbxproj (revision 71319)
- +++ WebCore/WebCore.xcodeproj/project.pbxproj (working copy)
- @@ -21285,7 +21285,7 @@
- 97DD4D870FDF4D6E00ECF9A4 /* XSSAuditor.h in Headers */,
- 6E67D2A71280E8A4008758F7 /* Extensions3DOpenGL.h in Headers */,
- 6E67D2A91280E8BD008758F7 /* Extensions3D.h in Headers */,
- - 93F6F1EE127F70B10055CB06 /* WebGLContextEvent.h in Headers */,
- + 93F6F1EE127F70B10055CB06 /* WebGLContextEvent.h in Headers */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
- @@ -21345,6 +21345,7 @@
- isa = PBXProject;
- buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
- compatibilityVersion = "Xcode 2.4";
- + developmentRegion = English;
- hasScannedForEncodings = 1;
- knownRegions = (
- English,
- @@ -23848,7 +23849,7 @@
- E1BE512D0CF6C512002EA959 /* XSLTUnicodeSort.cpp in Sources */,
- 97DD4D860FDF4D6E00ECF9A4 /* XSSAuditor.cpp in Sources */,
- 6E67D2A61280E8A4008758F7 /* Extensions3DOpenGL.cpp in Sources */,
- - 93F6F1ED127F70B10055CB06 /* WebGLContextEvent.cpp in Sources */,
- + 93F6F1ED127F70B10055CB06 /* WebGLContextEvent.cpp in Sources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
Add Comment
Please, Sign In to add comment