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/dom/Position.cpp

Issue 307353002: Use Position instead of VisiblePosition for SurroundingText. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix crash Created 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 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 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after
1279 for (const RenderObject* r = m_anchorNode->renderer(); r; r = r->parent()) { 1279 for (const RenderObject* r = m_anchorNode->renderer(); r; r = r->parent()) {
1280 if (r->isRenderBlockFlow()) { 1280 if (r->isRenderBlockFlow()) {
1281 primaryDirection = r->style()->direction(); 1281 primaryDirection = r->style()->direction();
1282 break; 1282 break;
1283 } 1283 }
1284 } 1284 }
1285 1285
1286 return primaryDirection; 1286 return primaryDirection;
1287 } 1287 }
1288 1288
1289 PassRefPtrWillBeRawPtr<Range> makeRange(const Position& start, const Position& e nd)
1290 {
1291 if (start.isNull() || end.isNull())
1292 return nullptr;
1293
1294 Position s = start.parentAnchoredEquivalent();
1295 Position e = end.parentAnchoredEquivalent();
Yuta Kitamura 2014/06/06 08:57:30 What's the point of getting parent-anchored versio
mlamouri (slow - plz ping) 2014/06/06 09:23:15 Removed. I'm calling directly Range::create() inst
1296 if (s.isNull() || e.isNull())
1297 return nullptr;
1298
1299 return Range::create(s.containerNode()->document(), s.containerNode(), s.off setInContainerNode(), e.containerNode(), e.offsetInContainerNode());
1300 }
1301
1289 void Position::trace(Visitor* visitor) 1302 void Position::trace(Visitor* visitor)
1290 { 1303 {
1291 visitor->trace(m_anchorNode); 1304 visitor->trace(m_anchorNode);
1292 } 1305 }
1293 1306
1294 void Position::debugPosition(const char* msg) const 1307 void Position::debugPosition(const char* msg) const
1295 { 1308 {
1296 if (isNull()) 1309 if (isNull())
1297 fprintf(stderr, "Position [%s]: null\n", msg); 1310 fprintf(stderr, "Position [%s]: null\n", msg);
1298 else 1311 else
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1364 pos.showTreeForThis(); 1377 pos.showTreeForThis();
1365 } 1378 }
1366 1379
1367 void showTree(const WebCore::Position* pos) 1380 void showTree(const WebCore::Position* pos)
1368 { 1381 {
1369 if (pos) 1382 if (pos)
1370 pos->showTreeForThis(); 1383 pos->showTreeForThis();
1371 } 1384 }
1372 1385
1373 #endif 1386 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698