Guest User

Untitled

a guest
Jun 20th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.88 KB | None | 0 0
  1. Index: WebCore/editing/ApplyStyleCommand.h
  2. ===================================================================
  3. --- WebCore/editing/ApplyStyleCommand.h (revision 71319)
  4. +++ WebCore/editing/ApplyStyleCommand.h (working copy)
  5. @@ -99,7 +99,7 @@
  6. void fixRangeAndApplyInlineStyle(CSSMutableStyleDeclaration*, const Position& start, const Position& end);
  7. void applyInlineStyleToNodeRange(CSSMutableStyleDeclaration*, Node* startNode, Node* pastEndNode);
  8. void addBlockStyle(const StyleChange&, HTMLElement*);
  9. - void addInlineStyleIfNeeded(CSSMutableStyleDeclaration*, Node* start, Node* end, EAddStyledElement addStyledElement = AddStyledElement);
  10. + void addInlineStyleIfNeeded(CSSMutableStyleDeclaration*, PassRefPtr<Node> start, PassRefPtr<Node> end, EAddStyledElement addStyledElement = AddStyledElement);
  11. void splitTextAtStart(const Position& start, const Position& end);
  12. void splitTextAtEnd(const Position& start, const Position& end);
  13. void splitTextElementAtStart(const Position& start, const Position& end);
  14. @@ -110,7 +110,7 @@
  15. bool mergeEndWithNextIfIdentical(const Position& start, const Position& end);
  16. void cleanupUnstyledAppleStyleSpans(Node* dummySpanAncestor);
  17.  
  18. - void surroundNodeRangeWithElement(Node* start, Node* end, PassRefPtr<Element>);
  19. + void surroundNodeRangeWithElement(PassRefPtr<Node> start, PassRefPtr<Node> end, PassRefPtr<Element>);
  20. float computedFontSize(const Node*);
  21. void joinChildTextNodes(Node*, const Position& start, const Position& end);
  22.  
  23. Index: WebCore/editing/ApplyStyleCommand.cpp
  24. ===================================================================
  25. --- WebCore/editing/ApplyStyleCommand.cpp (revision 71319)
  26. +++ WebCore/editing/ApplyStyleCommand.cpp (working copy)
  27. @@ -1046,6 +1046,8 @@
  28. removeInlineStyle(styleWithoutEmbedding ? styleWithoutEmbedding.get() : style, removeStart, end);
  29. start = startPosition();
  30. end = endPosition();
  31. + if (start.isNull() || start.isOrphan() || end.isNull() || end.isOrphan())
  32. + return;
  33.  
  34. if (splitStart) {
  35. if (mergeStartWithPreviousIfIdentical(start, end)) {
  36. @@ -1659,9 +1661,7 @@
  37. break;
  38. node = next.get();
  39. }
  40. -
  41. - ASSERT(s.node()->inDocument());
  42. - ASSERT(e.node()->inDocument());
  43. +
  44. updateStartEnd(s, e);
  45. }
  46.  
  47. @@ -1860,18 +1860,19 @@
  48. return false;
  49. }
  50.  
  51. -void ApplyStyleCommand::surroundNodeRangeWithElement(Node* startNode, Node* endNode, PassRefPtr<Element> elementToInsert)
  52. +void ApplyStyleCommand::surroundNodeRangeWithElement(PassRefPtr<Node> passedStartNode, PassRefPtr<Node> endNode, PassRefPtr<Element> elementToInsert)
  53. {
  54. - ASSERT(startNode);
  55. + ASSERT(passedStartNode);
  56. ASSERT(endNode);
  57. ASSERT(elementToInsert);
  58. + RefPtr<Node> startNode = passedStartNode;
  59. RefPtr<Element> element = elementToInsert;
  60.  
  61. insertNodeBefore(element, startNode);
  62. -
  63. - Node* node = startNode;
  64. - while (1) {
  65. - Node* next = node->nextSibling();
  66. +
  67. + RefPtr<Node> node = startNode;
  68. + while (node) {
  69. + RefPtr<Node> next = node->nextSibling();
  70. removeNode(node);
  71. appendNode(node, element);
  72. if (node == endNode)
  73. @@ -1879,17 +1880,17 @@
  74. node = next;
  75. }
  76.  
  77. - Node* nextSibling = element->nextSibling();
  78. - Node* previousSibling = element->previousSibling();
  79. + RefPtr<Node> nextSibling = element->nextSibling();
  80. + RefPtr<Node> previousSibling = element->previousSibling();
  81. if (nextSibling && nextSibling->isElementNode() && nextSibling->isContentEditable()
  82. - && areIdenticalElements(element.get(), static_cast<Element*>(nextSibling)))
  83. - mergeIdenticalElements(element, static_cast<Element*>(nextSibling));
  84. + && areIdenticalElements(element.get(), static_cast<Element*>(nextSibling.get())))
  85. + mergeIdenticalElements(element.get(), static_cast<Element*>(nextSibling.get()));
  86.  
  87. if (previousSibling && previousSibling->isElementNode() && previousSibling->isContentEditable()) {
  88. Node* mergedElement = previousSibling->nextSibling();
  89. if (mergedElement->isElementNode() && mergedElement->isContentEditable()
  90. - && areIdenticalElements(static_cast<Element*>(previousSibling), static_cast<Element*>(mergedElement)))
  91. - mergeIdenticalElements(static_cast<Element*>(previousSibling), static_cast<Element*>(mergedElement));
  92. + && areIdenticalElements(static_cast<Element*>(previousSibling.get()), static_cast<Element*>(mergedElement)))
  93. + mergeIdenticalElements(static_cast<Element*>(previousSibling.get()), static_cast<Element*>(mergedElement));
  94. }
  95.  
  96. // FIXME: We should probably call updateStartEnd if the start or end was in the node
  97. @@ -1911,17 +1912,22 @@
  98. setNodeAttribute(block, styleAttr, cssText);
  99. }
  100.  
  101. -void ApplyStyleCommand::addInlineStyleIfNeeded(CSSMutableStyleDeclaration *style, Node *startNode, Node *endNode, EAddStyledElement addStyledElement)
  102. +void ApplyStyleCommand::addInlineStyleIfNeeded(CSSMutableStyleDeclaration *style, PassRefPtr<Node> passedStart, PassRefPtr<Node> passedEnd, EAddStyledElement addStyledElement)
  103. {
  104. + if (!passedStart || !passedEnd || !passedStart->inDocument() || !passedEnd->inDocument())
  105. + return;
  106. + RefPtr<Node> startNode = passedStart;
  107. + RefPtr<Node> endNode = passedEnd;
  108. +
  109. // It's okay to obtain the style at the startNode because we've removed all relevant styles from the current run.
  110. RefPtr<HTMLElement> dummyElement;
  111. Position positionForStyleComparison;
  112. if (!startNode->isElementNode()) {
  113. dummyElement = createStyleSpanElement(document());
  114. - insertNodeAt(dummyElement, positionBeforeNode(startNode));
  115. + insertNodeAt(dummyElement, positionBeforeNode(startNode.get()));
  116. positionForStyleComparison = positionBeforeNode(dummyElement.get());
  117. } else
  118. - positionForStyleComparison = firstPositionInNode(startNode);
  119. + positionForStyleComparison = firstPositionInNode(startNode.get());
  120.  
  121. StyleChange styleChange(style, positionForStyleComparison);
  122.  
  123. @@ -1931,7 +1937,7 @@
  124. // Find appropriate font and span elements top-down.
  125. HTMLElement* fontContainer = 0;
  126. HTMLElement* styleContainer = 0;
  127. - for (Node* container = startNode; container && startNode == endNode; container = container->firstChild()) {
  128. + for (Node* container = startNode.get(); container && startNode == endNode; container = container->firstChild()) {
  129. if (container->isHTMLElement() && container->hasTagName(fontTag))
  130. fontContainer = static_cast<HTMLElement*>(container);
  131. bool styleContainerIsNotSpan = !styleContainer || !styleContainer->hasTagName(spanTag);
  132. Index: WebCore/WebCore.xcodeproj/project.pbxproj
  133. ===================================================================
  134. --- WebCore/WebCore.xcodeproj/project.pbxproj (revision 71319)
  135. +++ WebCore/WebCore.xcodeproj/project.pbxproj (working copy)
  136. @@ -21285,7 +21285,7 @@
  137. 97DD4D870FDF4D6E00ECF9A4 /* XSSAuditor.h in Headers */,
  138. 6E67D2A71280E8A4008758F7 /* Extensions3DOpenGL.h in Headers */,
  139. 6E67D2A91280E8BD008758F7 /* Extensions3D.h in Headers */,
  140. - 93F6F1EE127F70B10055CB06 /* WebGLContextEvent.h in Headers */,
  141. + 93F6F1EE127F70B10055CB06 /* WebGLContextEvent.h in Headers */,
  142. );
  143. runOnlyForDeploymentPostprocessing = 0;
  144. };
  145. @@ -21345,6 +21345,7 @@
  146. isa = PBXProject;
  147. buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
  148. compatibilityVersion = "Xcode 2.4";
  149. + developmentRegion = English;
  150. hasScannedForEncodings = 1;
  151. knownRegions = (
  152. English,
  153. @@ -23848,7 +23849,7 @@
  154. E1BE512D0CF6C512002EA959 /* XSLTUnicodeSort.cpp in Sources */,
  155. 97DD4D860FDF4D6E00ECF9A4 /* XSSAuditor.cpp in Sources */,
  156. 6E67D2A61280E8A4008758F7 /* Extensions3DOpenGL.cpp in Sources */,
  157. - 93F6F1ED127F70B10055CB06 /* WebGLContextEvent.cpp in Sources */,
  158. + 93F6F1ED127F70B10055CB06 /* WebGLContextEvent.cpp in Sources */,
  159. );
  160. runOnlyForDeploymentPostprocessing = 0;
  161. };
Add Comment
Please, Sign In to add comment