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

Side by Side Diff: Source/WebCore/page/DOMSelection.cpp

Issue 9250025: Merge 104317 - Crash with range selection across different documents. (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/912/
Patch Set: Created 8 years, 11 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/fast/dom/Range/range-selection-across-documents-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) 2007, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 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 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 if (r->compareBoundaryPoints(Range::START_TO_END, range.get(), ec) > -1) { 414 if (r->compareBoundaryPoints(Range::START_TO_END, range.get(), ec) > -1) {
415 if (r->compareBoundaryPoints(Range::END_TO_END, range.get(), ec) == -1) 415 if (r->compareBoundaryPoints(Range::END_TO_END, range.get(), ec) == -1)
416 // The original range and r intersect. 416 // The original range and r intersect.
417 selection->setSelection(VisibleSelection(r->startPosition(), ran ge->endPosition(), DOWNSTREAM)); 417 selection->setSelection(VisibleSelection(r->startPosition(), ran ge->endPosition(), DOWNSTREAM));
418 else 418 else
419 // r contains the original range. 419 // r contains the original range.
420 selection->setSelection(VisibleSelection(r)); 420 selection->setSelection(VisibleSelection(r));
421 } 421 }
422 } else { 422 } else {
423 // We don't support discontiguous selection. We don't do anything if r a nd range don't intersect. 423 // We don't support discontiguous selection. We don't do anything if r a nd range don't intersect.
424 if (r->compareBoundaryPoints(Range::END_TO_START, range.get(), ec) < 1) { 424 if (r->compareBoundaryPoints(Range::END_TO_START, range.get(), ec) < 1 & & !ec) {
425 if (r->compareBoundaryPoints(Range::END_TO_END, range.get(), ec) == -1) 425 if (r->compareBoundaryPoints(Range::END_TO_END, range.get(), ec) == -1)
426 // The original range contains r. 426 // The original range contains r.
427 selection->setSelection(VisibleSelection(range.get())); 427 selection->setSelection(VisibleSelection(range.get()));
428 else 428 else
429 // The original range and r intersect. 429 // The original range and r intersect.
430 selection->setSelection(VisibleSelection(range->startPosition(), r->endPosition(), DOWNSTREAM)); 430 selection->setSelection(VisibleSelection(range->startPosition(), r->endPosition(), DOWNSTREAM));
431 } 431 }
432 } 432 }
433 } 433 }
434 434
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 509
510 bool DOMSelection::isValidForPosition(Node* node) const 510 bool DOMSelection::isValidForPosition(Node* node) const
511 { 511 {
512 ASSERT(m_frame); 512 ASSERT(m_frame);
513 if (!node) 513 if (!node)
514 return true; 514 return true;
515 return node->document() == m_frame->document(); 515 return node->document() == m_frame->document();
516 } 516 }
517 517
518 } // namespace WebCore 518 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/Range/range-selection-across-documents-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698