Changeset 106646 in webkit
- Timestamp:
- Feb 3, 2012 3:39:51 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r106645 r106646 1 2012-02-03 MORITA Hajime <morrita@google.com> 2 3 TypingCommand should be prepared against detached document. 4 https://bugs.webkit.org/show_bug.cgi?id=77216 5 6 Reviewed by Ryosuke Niwa. 7 8 Added null checks for document()->frame(). 9 10 No new tests. Just tighten guards for possible codepaths. 11 12 * editing/TypingCommand.cpp: 13 (WebCore::TypingCommand::markMisspellingsAfterTyping): 14 (WebCore::TypingCommand::typingAddedToOpenCommand): 15 (WebCore::TypingCommand::deleteKeyPressed): 16 (WebCore::TypingCommand::forwardDeleteKeyPressed): 17 1 18 2012-02-03 Kentaro Hara <haraken@chromium.org> 2 19 -
trunk/Source/WebCore/editing/TypingCommand.cpp
r105441 r106646 297 297 void TypingCommand::markMisspellingsAfterTyping(ETypingCommand commandType) 298 298 { 299 Frame* frame = document()->frame(); 300 if (!frame) 301 return; 302 299 303 #if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) 300 if (! document()->frame()->editor()->isContinuousSpellCheckingEnabled()301 && ! document()->frame()->editor()->isAutomaticQuoteSubstitutionEnabled()302 && ! document()->frame()->editor()->isAutomaticLinkDetectionEnabled()303 && ! document()->frame()->editor()->isAutomaticDashSubstitutionEnabled()304 && ! document()->frame()->editor()->isAutomaticTextReplacementEnabled())304 if (!frame->editor()->isContinuousSpellCheckingEnabled() 305 && !frame->editor()->isAutomaticQuoteSubstitutionEnabled() 306 && !frame->editor()->isAutomaticLinkDetectionEnabled() 307 && !frame->editor()->isAutomaticDashSubstitutionEnabled() 308 && !frame->editor()->isAutomaticTextReplacementEnabled()) 305 309 return; 306 310 #else 307 if (! document()->frame()->editor()->isContinuousSpellCheckingEnabled())311 if (!frame->editor()->isContinuousSpellCheckingEnabled()) 308 312 return; 309 313 #endif … … 322 326 if (range && (commandType == TypingCommand::InsertText || commandType == TypingCommand::InsertLineBreak || commandType == TypingCommand::InsertParagraphSeparator || commandType == TypingCommand::InsertParagraphSeparatorInQuotedContent)) 323 327 strippedPreviousWord = plainText(range.get()).stripWhiteSpace(); 324 document()->frame()->editor()->markMisspellingsAfterTypingToWord(p1, endingSelection(), !strippedPreviousWord.isEmpty());328 frame->editor()->markMisspellingsAfterTypingToWord(p1, endingSelection(), !strippedPreviousWord.isEmpty()); 325 329 } else if (commandType == TypingCommand::InsertText) 326 document()->frame()->editor()->startCorrectionPanelTimer();330 frame->editor()->startCorrectionPanelTimer(); 327 331 } 328 332 } … … 330 334 void TypingCommand::typingAddedToOpenCommand(ETypingCommand commandTypeForAddedTyping) 331 335 { 336 Frame* frame = document()->frame(); 337 if (!frame) 338 return; 339 332 340 updatePreservesTypingStyle(commandTypeForAddedTyping); 333 341 334 342 #if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) 335 document()->frame()->editor()->appliedEditing(this);343 frame->editor()->appliedEditing(this); 336 344 // Since the spellchecking code may also perform corrections and other replacements, it should happen after the typing changes. 337 345 if (!m_shouldPreventSpellChecking) … … 340 348 // The old spellchecking code requires that checking be done first, to prevent issues like that in 6864072, where <doesn't> is marked as misspelled. 341 349 markMisspellingsAfterTyping(commandTypeForAddedTyping); 342 document()->frame()->editor()->appliedEditing(this);350 frame->editor()->appliedEditing(this); 343 351 #endif 344 352 } … … 432 440 void TypingCommand::deleteKeyPressed(TextGranularity granularity, bool killRing) 433 441 { 434 document()->frame()->editor()->updateMarkersForWordsAffectedByEditing(false); 442 Frame* frame = document()->frame(); 443 if (!frame) 444 return; 445 446 frame->editor()->updateMarkersForWordsAffectedByEditing(false); 435 447 436 448 VisibleSelection selectionToDelete; … … 514 526 return; 515 527 516 if (selectionToDelete.isCaret() || ! document()->frame()->selection()->shouldDeleteSelection(selectionToDelete))528 if (selectionToDelete.isCaret() || !frame->selection()->shouldDeleteSelection(selectionToDelete)) 517 529 return; 518 530 519 531 if (killRing) 520 document()->frame()->editor()->addToKillRing(selectionToDelete.toNormalizedRange().get(), false);532 frame->editor()->addToKillRing(selectionToDelete.toNormalizedRange().get(), false); 521 533 // Make undo select everything that has been deleted, unless an undo will undo more than just this deletion. 522 534 // FIXME: This behaves like TextEdit except for the case where you open with text insertion and then delete … … 531 543 void TypingCommand::forwardDeleteKeyPressed(TextGranularity granularity, bool killRing) 532 544 { 533 document()->frame()->editor()->updateMarkersForWordsAffectedByEditing(false); 545 Frame* frame = document()->frame(); 546 if (!frame) 547 return; 548 549 frame->editor()->updateMarkersForWordsAffectedByEditing(false); 534 550 535 551 VisibleSelection selectionToDelete; … … 600 616 return; 601 617 602 if (selectionToDelete.isCaret() || ! document()->frame()->selection()->shouldDeleteSelection(selectionToDelete))618 if (selectionToDelete.isCaret() || !frame->selection()->shouldDeleteSelection(selectionToDelete)) 603 619 return; 604 620 605 621 if (killRing) 606 document()->frame()->editor()->addToKillRing(selectionToDelete.toNormalizedRange().get(), false);622 frame->editor()->addToKillRing(selectionToDelete.toNormalizedRange().get(), false); 607 623 // make undo select what was deleted 608 624 setStartingSelection(selectionAfterUndo);
Note: See TracChangeset
for help on using the changeset viewer.