Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(897)

Unified Diff: Source/core/editing/ApplyStyleCommand.cpp

Issue 23548010: Have htmlediting create functions take a Document reference in argument (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/editing/ApplyStyleCommand.h ('k') | Source/core/editing/BreakBlockquoteCommand.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/ApplyStyleCommand.cpp
diff --git a/Source/core/editing/ApplyStyleCommand.cpp b/Source/core/editing/ApplyStyleCommand.cpp
index 81e24d949bd37379653f329ae7ec3947167abc42..d825478324f62d0c3ecb5317af6bf915478c6df6 100644
--- a/Source/core/editing/ApplyStyleCommand.cpp
+++ b/Source/core/editing/ApplyStyleCommand.cpp
@@ -104,13 +104,13 @@ bool isEmptyFontTag(const Element* element, ShouldStyleAttributeBeEmpty shouldSt
return hasNoAttributeOrOnlyStyleAttribute(toHTMLElement(element), shouldStyleAttributeBeEmpty);
}
-static PassRefPtr<Element> createFontElement(Document* document)
+static PassRefPtr<Element> createFontElement(Document& document)
{
RefPtr<Element> fontNode = createHTMLElement(document, fontTag);
return fontNode.release();
}
-PassRefPtr<HTMLElement> createStyleSpanElement(Document* document)
+PassRefPtr<HTMLElement> createStyleSpanElement(Document& document)
{
RefPtr<HTMLElement> styleElement = createHTMLElement(document, spanTag);
return styleElement.release();
@@ -379,7 +379,7 @@ void ApplyStyleCommand::applyRelativeFontStyleChange(EditingStyle* style)
} else if (node->isTextNode() && node->renderer() && node->parentNode() != lastStyledNode) {
// Last styled node was not parent node of this text node, but we wish to style this
// text node. To make this possible, add a style span to surround this text node.
- RefPtr<HTMLElement> span = createStyleSpanElement(&document());
+ RefPtr<HTMLElement> span = createStyleSpanElement(document());
surroundNodeRangeWithElement(node, node, span.get());
element = span.release();
} else {
@@ -1404,7 +1404,7 @@ Position ApplyStyleCommand::positionToComputeInlineStyleChange(PassRefPtr<Node>
// It's okay to obtain the style at the startNode because we've removed all relevant styles from the current run.
Position positionForStyleComparison;
if (!startNode->isElementNode()) {
- dummyElement = createStyleSpanElement(&document());
+ dummyElement = createStyleSpanElement(document());
insertNodeAt(dummyElement, positionBeforeNode(startNode.get()));
return positionBeforeNode(dummyElement.get());
}
@@ -1444,7 +1444,7 @@ void ApplyStyleCommand::applyInlineStyleChange(PassRefPtr<Node> passedStart, Pas
if (styleChange.applyFontSize())
setNodeAttribute(fontContainer, sizeAttr, styleChange.fontSize());
} else {
- RefPtr<Element> fontElement = createFontElement(&document());
+ RefPtr<Element> fontElement = createFontElement(document());
if (styleChange.applyFontColor())
fontElement->setAttribute(colorAttr, styleChange.fontColor());
if (styleChange.applyFontFace())
@@ -1468,28 +1468,28 @@ void ApplyStyleCommand::applyInlineStyleChange(PassRefPtr<Node> passedStart, Pas
} else
setNodeAttribute(styleContainer, styleAttr, styleChange.cssStyle());
} else {
- RefPtr<Element> styleElement = createStyleSpanElement(&document());
+ RefPtr<Element> styleElement = createStyleSpanElement(document());
styleElement->setAttribute(styleAttr, styleChange.cssStyle());
surroundNodeRangeWithElement(startNode, endNode, styleElement.release());
}
}
if (styleChange.applyBold())
- surroundNodeRangeWithElement(startNode, endNode, createHTMLElement(&document(), bTag));
+ surroundNodeRangeWithElement(startNode, endNode, createHTMLElement(document(), bTag));
if (styleChange.applyItalic())
- surroundNodeRangeWithElement(startNode, endNode, createHTMLElement(&document(), iTag));
+ surroundNodeRangeWithElement(startNode, endNode, createHTMLElement(document(), iTag));
if (styleChange.applyUnderline())
- surroundNodeRangeWithElement(startNode, endNode, createHTMLElement(&document(), uTag));
+ surroundNodeRangeWithElement(startNode, endNode, createHTMLElement(document(), uTag));
if (styleChange.applyLineThrough())
- surroundNodeRangeWithElement(startNode, endNode, createHTMLElement(&document(), strikeTag));
+ surroundNodeRangeWithElement(startNode, endNode, createHTMLElement(document(), strikeTag));
if (styleChange.applySubscript())
- surroundNodeRangeWithElement(startNode, endNode, createHTMLElement(&document(), subTag));
+ surroundNodeRangeWithElement(startNode, endNode, createHTMLElement(document(), subTag));
else if (styleChange.applySuperscript())
- surroundNodeRangeWithElement(startNode, endNode, createHTMLElement(&document(), supTag));
+ surroundNodeRangeWithElement(startNode, endNode, createHTMLElement(document(), supTag));
if (m_styledInlineElement && addStyledElement == AddStyledElement)
surroundNodeRangeWithElement(startNode, endNode, m_styledInlineElement->cloneElementWithoutChildren());
« no previous file with comments | « Source/core/editing/ApplyStyleCommand.h ('k') | Source/core/editing/BreakBlockquoteCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698