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

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

Issue 124973002: Cleanup - Get rid of unnecessary local variables. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 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 | « no previous file | no next file » | 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 eeb18cb903bc437e0a70737c3d25d95f9ff6b7da..3ae65b2ab8d22fec6f4e1a23a3bd1a4759093b49 100644
--- a/Source/core/editing/ApplyStyleCommand.cpp
+++ b/Source/core/editing/ApplyStyleCommand.cpp
@@ -396,7 +396,6 @@ void ApplyStyleCommand::applyRelativeFontStyleChange(EditingStyle* style)
RefPtr<CSSValue> value = inlineStyle->getPropertyCSSValue(CSSPropertyFontSize);
if (value) {
element->removeInlineStyleProperty(CSSPropertyFontSize);
- currentFontSize = computedFontSize(node);
vanihegde 2014/01/06 09:01:37 computedFontSize() is already done at line 394.
ojan 2014/01/06 18:55:41 Doesn't the line above this invalidate the compute
vanihegde 2014/01/07 08:30:46 Yes, it does. Sorry I missed it!
}
if (currentFontSize != desiredFontSize) {
inlineStyle->setProperty(CSSPropertyFontSize, cssValuePool().createValue(desiredFontSize, CSSPrimitiveValue::CSS_PX), false);
@@ -496,9 +495,7 @@ void ApplyStyleCommand::removeEmbeddingUpToEnclosingBlock(Node* node, Node* unsp
if (!block)
return;
- Node* parent = 0;
- for (Node* n = node->parentNode(); n != block && n != unsplitAncestor; n = parent) {
- parent = n->parentNode();
+ for (Node* n = node->parentNode(); n != block && n != unsplitAncestor; n = n->parentNode()) {
if (!n->isStyledElement())
continue;
@@ -695,8 +692,11 @@ void ApplyStyleCommand::fixRangeAndApplyInlineStyle(EditingStyle* style, const P
RefPtr<Range> range = Range::create(startNode->document(), start, end);
Element* editableRoot = startNode->rootEditableElement();
if (startNode != editableRoot) {
- while (editableRoot && startNode->parentNode() != editableRoot && isNodeVisiblyContainedWithin(startNode->parentNode(), range.get()))
- startNode = startNode->parentNode();
+ Node* parentNode = startNode->parentNode();
ojan 2014/01/06 18:55:41 I'm not sure this code is any cleaner and I'd be s
vanihegde 2014/01/07 08:30:46 Reverting.
+ while (editableRoot && parentNode != editableRoot && isNodeVisiblyContainedWithin(parentNode, range.get())) {
+ startNode = parentNode;
+ parentNode = startNode->parentNode();
+ }
}
applyInlineStyleToNodeRange(style, startNode, pastEndNode);
@@ -1333,12 +1333,11 @@ void ApplyStyleCommand::surroundNodeRangeWithElement(PassRefPtr<Node> passedStar
ASSERT(passedStartNode);
ASSERT(endNode);
ASSERT(elementToInsert);
- RefPtr<Node> startNode = passedStartNode;
+ RefPtr<Node> node = passedStartNode;
RefPtr<Element> element = elementToInsert;
- insertNodeBefore(element, startNode);
+ insertNodeBefore(element, node);
- RefPtr<Node> node = startNode;
while (node) {
RefPtr<Node> next = node->nextSibling();
if (node->isContentEditable(Node::UserSelectAllIsAlwaysNonEditable)) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698