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

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

Issue 23717008: Remove useless null checks from Node::document() call sites (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/editing/FrameSelection.cpp ('k') | Source/core/editing/markup.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) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
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 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after
1322 1322
1323 bool isEndOfBlock(const VisiblePosition &pos) 1323 bool isEndOfBlock(const VisiblePosition &pos)
1324 { 1324 {
1325 return pos.isNotNull() && pos == endOfBlock(pos, CanCrossEditingBoundary); 1325 return pos.isNotNull() && pos == endOfBlock(pos, CanCrossEditingBoundary);
1326 } 1326 }
1327 1327
1328 // --------- 1328 // ---------
1329 1329
1330 VisiblePosition startOfDocument(const Node* node) 1330 VisiblePosition startOfDocument(const Node* node)
1331 { 1331 {
1332 if (!node || !node->document() || !node->document()->documentElement()) 1332 if (!node || !node->document()->documentElement())
1333 return VisiblePosition(); 1333 return VisiblePosition();
1334 1334
1335 return VisiblePosition(firstPositionInNode(node->document()->documentElement ()), DOWNSTREAM); 1335 return VisiblePosition(firstPositionInNode(node->document()->documentElement ()), DOWNSTREAM);
1336 } 1336 }
1337 1337
1338 VisiblePosition startOfDocument(const VisiblePosition &c) 1338 VisiblePosition startOfDocument(const VisiblePosition &c)
1339 { 1339 {
1340 return startOfDocument(c.deepEquivalent().deprecatedNode()); 1340 return startOfDocument(c.deepEquivalent().deprecatedNode());
1341 } 1341 }
1342 1342
1343 VisiblePosition endOfDocument(const Node* node) 1343 VisiblePosition endOfDocument(const Node* node)
1344 { 1344 {
1345 if (!node || !node->document() || !node->document()->documentElement()) 1345 if (!node || !node->document()->documentElement())
1346 return VisiblePosition(); 1346 return VisiblePosition();
1347 1347
1348 Element* doc = node->document()->documentElement(); 1348 Element* doc = node->document()->documentElement();
1349 return VisiblePosition(lastPositionInNode(doc), DOWNSTREAM); 1349 return VisiblePosition(lastPositionInNode(doc), DOWNSTREAM);
1350 } 1350 }
1351 1351
1352 VisiblePosition endOfDocument(const VisiblePosition &c) 1352 VisiblePosition endOfDocument(const VisiblePosition &c)
1353 { 1353 {
1354 return endOfDocument(c.deepEquivalent().deprecatedNode()); 1354 return endOfDocument(c.deepEquivalent().deprecatedNode());
1355 } 1355 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1407 { 1407 {
1408 return direction == LTR ? logicalStartOfLine(c) : logicalEndOfLine(c); 1408 return direction == LTR ? logicalStartOfLine(c) : logicalEndOfLine(c);
1409 } 1409 }
1410 1410
1411 VisiblePosition rightBoundaryOfLine(const VisiblePosition& c, TextDirection dire ction) 1411 VisiblePosition rightBoundaryOfLine(const VisiblePosition& c, TextDirection dire ction)
1412 { 1412 {
1413 return direction == LTR ? logicalEndOfLine(c) : logicalStartOfLine(c); 1413 return direction == LTR ? logicalEndOfLine(c) : logicalStartOfLine(c);
1414 } 1414 }
1415 1415
1416 } 1416 }
OLDNEW
« no previous file with comments | « Source/core/editing/FrameSelection.cpp ('k') | Source/core/editing/markup.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698