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

Side by Side 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: Cleanup patch 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005, 2006, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2008, 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 } 489 }
490 return unsplitAncestor; 490 return unsplitAncestor;
491 } 491 }
492 492
493 void ApplyStyleCommand::removeEmbeddingUpToEnclosingBlock(Node* node, Node* unsp litAncestor) 493 void ApplyStyleCommand::removeEmbeddingUpToEnclosingBlock(Node* node, Node* unsp litAncestor)
494 { 494 {
495 Node* block = enclosingBlock(node); 495 Node* block = enclosingBlock(node);
496 if (!block) 496 if (!block)
497 return; 497 return;
498 498
499 Node* parent = 0; 499 for (Node* n = node->parentNode(); n != block && n != unsplitAncestor; n = n ->parentNode()) {
500 for (Node* n = node->parentNode(); n != block && n != unsplitAncestor; n = p arent) {
501 parent = n->parentNode();
502 if (!n->isStyledElement()) 500 if (!n->isStyledElement())
503 continue; 501 continue;
504 502
505 Element* element = toElement(n); 503 Element* element = toElement(n);
506 int unicodeBidi = getIdentifierValue(CSSComputedStyleDeclaration::create (element).get(), CSSPropertyUnicodeBidi); 504 int unicodeBidi = getIdentifierValue(CSSComputedStyleDeclaration::create (element).get(), CSSPropertyUnicodeBidi);
507 if (!unicodeBidi || unicodeBidi == CSSValueNormal) 505 if (!unicodeBidi || unicodeBidi == CSSValueNormal)
508 continue; 506 continue;
509 507
510 // FIXME: This code should really consider the mapped attribute 'dir', t he inline style declaration, 508 // FIXME: This code should really consider the mapped attribute 'dir', t he inline style declaration,
511 // and all matching style rules in order to determine how to best set th e unicode-bidi property to 'normal'. 509 // and all matching style rules in order to determine how to best set th e unicode-bidi property to 'normal'.
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after
1326 } 1324 }
1327 1325
1328 return false; 1326 return false;
1329 } 1327 }
1330 1328
1331 void ApplyStyleCommand::surroundNodeRangeWithElement(PassRefPtr<Node> passedStar tNode, PassRefPtr<Node> endNode, PassRefPtr<Element> elementToInsert) 1329 void ApplyStyleCommand::surroundNodeRangeWithElement(PassRefPtr<Node> passedStar tNode, PassRefPtr<Node> endNode, PassRefPtr<Element> elementToInsert)
1332 { 1330 {
1333 ASSERT(passedStartNode); 1331 ASSERT(passedStartNode);
1334 ASSERT(endNode); 1332 ASSERT(endNode);
1335 ASSERT(elementToInsert); 1333 ASSERT(elementToInsert);
1336 RefPtr<Node> startNode = passedStartNode; 1334 RefPtr<Node> node = passedStartNode;
1337 RefPtr<Element> element = elementToInsert; 1335 RefPtr<Element> element = elementToInsert;
1338 1336
1339 insertNodeBefore(element, startNode); 1337 insertNodeBefore(element, node);
1340 1338
1341 RefPtr<Node> node = startNode;
1342 while (node) { 1339 while (node) {
1343 RefPtr<Node> next = node->nextSibling(); 1340 RefPtr<Node> next = node->nextSibling();
1344 if (node->isContentEditable(Node::UserSelectAllIsAlwaysNonEditable)) { 1341 if (node->isContentEditable(Node::UserSelectAllIsAlwaysNonEditable)) {
1345 removeNode(node); 1342 removeNode(node);
1346 appendNode(node, element); 1343 appendNode(node, element);
1347 } 1344 }
1348 if (node == endNode) 1345 if (node == endNode)
1349 break; 1346 break;
1350 node = next; 1347 node = next;
1351 } 1348 }
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
1543 String textToMove = nextText->data(); 1540 String textToMove = nextText->data();
1544 insertTextIntoNode(childText, childText->length(), textToMove); 1541 insertTextIntoNode(childText, childText->length(), textToMove);
1545 removeNode(next); 1542 removeNode(next);
1546 // don't move child node pointer. it may want to merge with more text no des. 1543 // don't move child node pointer. it may want to merge with more text no des.
1547 } 1544 }
1548 1545
1549 updateStartEnd(newStart, newEnd); 1546 updateStartEnd(newStart, newEnd);
1550 } 1547 }
1551 1548
1552 } 1549 }
OLDNEW
« 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