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

Side by Side Diff: Source/core/editing/ApplyStyleCommand.cpp

Issue 1213483003: Get rid of redundant parameter PositionIsOffsetInAnchor from PositionAlgorithm constructor (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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 | « Source/core/dom/Position.cpp ('k') | Source/core/editing/EditingTestBase.cpp » ('j') | 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 1302 matching lines...) Expand 10 before | Expand all | Expand 10 after
1313 1313
1314 if (previousSibling && areIdenticalElements(startNode, previousSibling)) { 1314 if (previousSibling && areIdenticalElements(startNode, previousSibling)) {
1315 Element* previousElement = toElement(previousSibling); 1315 Element* previousElement = toElement(previousSibling);
1316 Element* element = toElement(startNode); 1316 Element* element = toElement(startNode);
1317 Node* startChild = element->firstChild(); 1317 Node* startChild = element->firstChild();
1318 ASSERT(startChild); 1318 ASSERT(startChild);
1319 mergeIdenticalElements(previousElement, element); 1319 mergeIdenticalElements(previousElement, element);
1320 1320
1321 int startOffsetAdjustment = startChild->nodeIndex(); 1321 int startOffsetAdjustment = startChild->nodeIndex();
1322 int endOffsetAdjustment = startNode == end.deprecatedNode() ? startOffse tAdjustment : 0; 1322 int endOffsetAdjustment = startNode == end.deprecatedNode() ? startOffse tAdjustment : 0;
1323 updateStartEnd(Position(startNode, startOffsetAdjustment, Position::Posi tionIsOffsetInAnchor), 1323 updateStartEnd(Position(startNode, startOffsetAdjustment),
1324 Position(end.deprecatedNode(), end.deprecatedEditingOffse t() + endOffsetAdjustment, Position::PositionIsOffsetInAnchor)); 1324 Position(end.deprecatedNode(), end.deprecatedEditingOffset() + endOf fsetAdjustment));
1325 return true; 1325 return true;
1326 } 1326 }
1327 1327
1328 return false; 1328 return false;
1329 } 1329 }
1330 1330
1331 bool ApplyStyleCommand::mergeEndWithNextIfIdentical(const Position& start, const Position& end) 1331 bool ApplyStyleCommand::mergeEndWithNextIfIdentical(const Position& start, const Position& end)
1332 { 1332 {
1333 Node* endNode = end.containerNode(); 1333 Node* endNode = end.containerNode();
1334 1334
(...skipping 14 matching lines...) Expand all
1349 Node* nextSibling = endNode->nextSibling(); 1349 Node* nextSibling = endNode->nextSibling();
1350 if (nextSibling && areIdenticalElements(endNode, nextSibling)) { 1350 if (nextSibling && areIdenticalElements(endNode, nextSibling)) {
1351 Element* nextElement = toElement(nextSibling); 1351 Element* nextElement = toElement(nextSibling);
1352 Element* element = toElement(endNode); 1352 Element* element = toElement(endNode);
1353 Node* nextChild = nextElement->firstChild(); 1353 Node* nextChild = nextElement->firstChild();
1354 1354
1355 mergeIdenticalElements(element, nextElement); 1355 mergeIdenticalElements(element, nextElement);
1356 1356
1357 bool shouldUpdateStart = start.containerNode() == endNode; 1357 bool shouldUpdateStart = start.containerNode() == endNode;
1358 int endOffset = nextChild ? nextChild->nodeIndex() : nextElement->childN odes()->length(); 1358 int endOffset = nextChild ? nextChild->nodeIndex() : nextElement->childN odes()->length();
1359 updateStartEnd(shouldUpdateStart ? Position(nextElement, start.offsetInC ontainerNode(), Position::PositionIsOffsetInAnchor) : start, 1359 updateStartEnd(shouldUpdateStart ? Position(nextElement, start.offsetInC ontainerNode()) : start,
1360 Position(nextElement, endOffset, Position::PositionIsOffs etInAnchor)); 1360 Position(nextElement, endOffset));
1361 return true; 1361 return true;
1362 } 1362 }
1363 1363
1364 return false; 1364 return false;
1365 } 1365 }
1366 1366
1367 void ApplyStyleCommand::surroundNodeRangeWithElement(PassRefPtrWillBeRawPtr<Node > passedStartNode, PassRefPtrWillBeRawPtr<Node> endNode, PassRefPtrWillBeRawPtr< Element> elementToInsert) 1367 void ApplyStyleCommand::surroundNodeRangeWithElement(PassRefPtrWillBeRawPtr<Node > passedStartNode, PassRefPtrWillBeRawPtr<Node> endNode, PassRefPtrWillBeRawPtr< Element> elementToInsert)
1368 { 1368 {
1369 ASSERT(passedStartNode); 1369 ASSERT(passedStartNode);
1370 ASSERT(endNode); 1370 ASSERT(endNode);
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
1591 DEFINE_TRACE(ApplyStyleCommand) 1591 DEFINE_TRACE(ApplyStyleCommand)
1592 { 1592 {
1593 visitor->trace(m_style); 1593 visitor->trace(m_style);
1594 visitor->trace(m_start); 1594 visitor->trace(m_start);
1595 visitor->trace(m_end); 1595 visitor->trace(m_end);
1596 visitor->trace(m_styledInlineElement); 1596 visitor->trace(m_styledInlineElement);
1597 CompositeEditCommand::trace(visitor); 1597 CompositeEditCommand::trace(visitor);
1598 } 1598 }
1599 1599
1600 } 1600 }
OLDNEW
« no previous file with comments | « Source/core/dom/Position.cpp ('k') | Source/core/editing/EditingTestBase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698