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

Side by Side Diff: Source/core/rendering/HitTestResult.cpp

Issue 26168008: [blink] Avoid null pointer dereference in HitTestResult::isMisspelled() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Original fix Created 6 years, 9 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 | « LayoutTests/editing/spelling/right-click-no-renderer-crash-expected.txt ('k') | 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) 2006, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2008, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 return toHTMLAnchorElement(m_innerURLElement)->isLiveLink(); 340 return toHTMLAnchorElement(m_innerURLElement)->isLiveLink();
341 341
342 if (m_innerURLElement->hasTagName(SVGNames::aTag)) 342 if (m_innerURLElement->hasTagName(SVGNames::aTag))
343 return m_innerURLElement->isLink(); 343 return m_innerURLElement->isLink();
344 344
345 return false; 345 return false;
346 } 346 }
347 347
348 bool HitTestResult::isMisspelled() const 348 bool HitTestResult::isMisspelled() const
349 { 349 {
350 if (!targetNode()) 350 if (!targetNode() || !targetNode()->renderer())
351 return false; 351 return false;
352 VisiblePosition pos(targetNode()->renderer()->positionForPoint(localPoint()) ); 352 VisiblePosition pos(targetNode()->renderer()->positionForPoint(localPoint()) );
353 if (pos.isNull()) 353 if (pos.isNull())
354 return false; 354 return false;
355 return m_innerNonSharedNode->document().markers().markersInRange( 355 return m_innerNonSharedNode->document().markers().markersInRange(
356 makeRange(pos, pos).get(), DocumentMarker::MisspellingMarkers()).size() > 0; 356 makeRange(pos, pos).get(), DocumentMarker::MisspellingMarkers()).size() > 0;
357 } 357 }
358 358
359 bool HitTestResult::isOverLink() const 359 bool HitTestResult::isOverLink() const
360 { 360 {
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 { 492 {
493 for (Node* node = m_innerNode.get(); node; node = NodeRenderingTraversal::pa rent(node)) { 493 for (Node* node = m_innerNode.get(); node; node = NodeRenderingTraversal::pa rent(node)) {
494 if (node->isElementNode()) 494 if (node->isElementNode())
495 return toElement(node); 495 return toElement(node);
496 } 496 }
497 497
498 return 0; 498 return 0;
499 } 499 }
500 500
501 } // namespace WebCore 501 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/editing/spelling/right-click-no-renderer-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698