Changeset 185682 in webkit
- Timestamp:
- Jun 17, 2015, 5:49:54 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
dom/Position.cpp (modified) (9 diffs)
-
dom/Position.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r185681 r185682 1 2015-06-16 Jon Honeycutt <jhoneycutt@apple.com> 2 3 Position::findParent() should take a reference 4 https://bugs.webkit.org/show_bug.cgi?id=146038 5 6 Reviewed by Darin Adler. 7 8 * dom/Position.cpp: 9 (WebCore::Position::containerNode): 10 (WebCore::Position::parentAnchoredEquivalent): 11 Pass a reference; there is already a null check. 12 (WebCore::Position::previous): 13 Add a missing null check. Code below this expects that node is non-null. 14 (WebCore::Position::next): 15 Ditto. 16 (WebCore::Position::atStartOfTree): 17 (WebCore::Position::atEndOfTree): 18 Pass a reference. 19 (WebCore::Position::findParent): 20 Changed to take a reference. 21 22 * dom/Position.h: 23 Ditto. 24 1 25 2015-06-17 Brent Fulgham <bfulgham@apple.com> 2 26 -
trunk/Source/WebCore/dom/Position.cpp
r185613 r185682 163 163 case PositionIsBeforeAnchor: 164 164 case PositionIsAfterAnchor: 165 return findParent( m_anchorNode.get());165 return findParent(*m_anchorNode); 166 166 } 167 167 ASSERT_NOT_REACHED(); … … 223 223 // FIXME: This should only be necessary for legacy positions, but is also needed for positions before and after Tables 224 224 if (m_offset <= 0 && (m_anchorType != PositionIsAfterAnchor && m_anchorType != PositionIsAfterChildren)) { 225 if (findParent( m_anchorNode.get()) && (editingIgnoresContent(m_anchorNode.get()) || isRenderedTable(m_anchorNode.get())))225 if (findParent(*m_anchorNode) && (editingIgnoresContent(m_anchorNode.get()) || isRenderedTable(m_anchorNode.get()))) 226 226 return positionInParentBeforeNode(m_anchorNode.get()); 227 227 return Position(m_anchorNode.get(), 0, PositionIsOffsetInAnchor); … … 311 311 if (anchorType() == PositionIsBeforeAnchor) { 312 312 node = containerNode(); 313 if (!node) 314 return *this; 315 313 316 offset = computeOffsetInContainerNode(); 314 317 } … … 333 336 } 334 337 335 ContainerNode* parent = findParent( node);338 ContainerNode* parent = findParent(*node); 336 339 if (!parent) 337 340 return *this; … … 361 364 if (anchorType() == PositionIsAfterAnchor) { 362 365 node = containerNode(); 366 if (!node) 367 return *this; 368 363 369 offset = computeOffsetInContainerNode(); 364 370 } … … 377 383 } 378 384 379 ContainerNode* parent = findParent( node);385 ContainerNode* parent = findParent(*node); 380 386 if (!parent) 381 387 return *this; … … 479 485 480 486 Node* container = containerNode(); 481 if (container && findParent( container))487 if (container && findParent(*container)) 482 488 return false; 483 489 … … 504 510 505 511 Node* container = containerNode(); 506 if (container && findParent( container))512 if (container && findParent(*container)) 507 513 return false; 508 514 … … 939 945 } 940 946 941 ContainerNode* Position::findParent(const Node *node)942 { 943 return node ->nonShadowBoundaryParentNode();947 ContainerNode* Position::findParent(const Node& node) 948 { 949 return node.nonShadowBoundaryParentNode(); 944 950 } 945 951 -
trunk/Source/WebCore/dom/Position.h
r182207 r185682 199 199 static Node* rootUserSelectAllForNode(Node*) { return 0; } 200 200 #endif 201 static ContainerNode* findParent(const Node *);201 static ContainerNode* findParent(const Node&); 202 202 203 203 void debugPosition(const char* msg = "") const;
Note:
See TracChangeset
for help on using the changeset viewer.