OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2009 Apple Inc. All rights reserved. |
3 * Copyright (C) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2012 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 new_range); | 394 new_range); |
395 } | 395 } |
396 | 396 |
397 void DOMSelection::modify(const String& alter_string, | 397 void DOMSelection::modify(const String& alter_string, |
398 const String& direction_string, | 398 const String& direction_string, |
399 const String& granularity_string) { | 399 const String& granularity_string) { |
400 if (!IsAvailable()) | 400 if (!IsAvailable()) |
401 return; | 401 return; |
402 | 402 |
403 FrameSelection::EAlteration alter; | 403 FrameSelection::EAlteration alter; |
404 if (EqualIgnoringCase(alter_string, "extend")) | 404 if (DeprecatedEqualIgnoringCase(alter_string, "extend")) |
405 alter = FrameSelection::kAlterationExtend; | 405 alter = FrameSelection::kAlterationExtend; |
406 else if (EqualIgnoringCase(alter_string, "move")) | 406 else if (DeprecatedEqualIgnoringCase(alter_string, "move")) |
407 alter = FrameSelection::kAlterationMove; | 407 alter = FrameSelection::kAlterationMove; |
408 else | 408 else |
409 return; | 409 return; |
410 | 410 |
411 SelectionDirection direction; | 411 SelectionDirection direction; |
412 if (EqualIgnoringCase(direction_string, "forward")) | 412 if (DeprecatedEqualIgnoringCase(direction_string, "forward")) |
413 direction = kDirectionForward; | 413 direction = kDirectionForward; |
414 else if (EqualIgnoringCase(direction_string, "backward")) | 414 else if (DeprecatedEqualIgnoringCase(direction_string, "backward")) |
415 direction = kDirectionBackward; | 415 direction = kDirectionBackward; |
416 else if (EqualIgnoringCase(direction_string, "left")) | 416 else if (DeprecatedEqualIgnoringCase(direction_string, "left")) |
417 direction = kDirectionLeft; | 417 direction = kDirectionLeft; |
418 else if (EqualIgnoringCase(direction_string, "right")) | 418 else if (DeprecatedEqualIgnoringCase(direction_string, "right")) |
419 direction = kDirectionRight; | 419 direction = kDirectionRight; |
420 else | 420 else |
421 return; | 421 return; |
422 | 422 |
423 TextGranularity granularity; | 423 TextGranularity granularity; |
424 if (EqualIgnoringCase(granularity_string, "character")) | 424 if (DeprecatedEqualIgnoringCase(granularity_string, "character")) |
425 granularity = kCharacterGranularity; | 425 granularity = kCharacterGranularity; |
426 else if (EqualIgnoringCase(granularity_string, "word")) | 426 else if (DeprecatedEqualIgnoringCase(granularity_string, "word")) |
427 granularity = kWordGranularity; | 427 granularity = kWordGranularity; |
428 else if (EqualIgnoringCase(granularity_string, "sentence")) | 428 else if (DeprecatedEqualIgnoringCase(granularity_string, "sentence")) |
429 granularity = kSentenceGranularity; | 429 granularity = kSentenceGranularity; |
430 else if (EqualIgnoringCase(granularity_string, "line")) | 430 else if (DeprecatedEqualIgnoringCase(granularity_string, "line")) |
431 granularity = kLineGranularity; | 431 granularity = kLineGranularity; |
432 else if (EqualIgnoringCase(granularity_string, "paragraph")) | 432 else if (DeprecatedEqualIgnoringCase(granularity_string, "paragraph")) |
433 granularity = kParagraphGranularity; | 433 granularity = kParagraphGranularity; |
434 else if (EqualIgnoringCase(granularity_string, "lineboundary")) | 434 else if (DeprecatedEqualIgnoringCase(granularity_string, "lineboundary")) |
435 granularity = kLineBoundary; | 435 granularity = kLineBoundary; |
436 else if (EqualIgnoringCase(granularity_string, "sentenceboundary")) | 436 else if (DeprecatedEqualIgnoringCase(granularity_string, "sentenceboundary")) |
437 granularity = kSentenceBoundary; | 437 granularity = kSentenceBoundary; |
438 else if (EqualIgnoringCase(granularity_string, "paragraphboundary")) | 438 else if (DeprecatedEqualIgnoringCase(granularity_string, "paragraphboundary")) |
439 granularity = kParagraphBoundary; | 439 granularity = kParagraphBoundary; |
440 else if (EqualIgnoringCase(granularity_string, "documentboundary")) | 440 else if (DeprecatedEqualIgnoringCase(granularity_string, "documentboundary")) |
441 granularity = kDocumentBoundary; | 441 granularity = kDocumentBoundary; |
442 else | 442 else |
443 return; | 443 return; |
444 | 444 |
445 Element* focused_element = GetFrame()->GetDocument()->FocusedElement(); | 445 Element* focused_element = GetFrame()->GetDocument()->FocusedElement(); |
446 GetFrame()->Selection().Modify(alter, direction, granularity); | 446 GetFrame()->Selection().Modify(alter, direction, granularity); |
447 if (GetFrame() && GetFrame()->GetDocument() && | 447 if (GetFrame() && GetFrame()->GetDocument() && |
448 focused_element != GetFrame()->GetDocument()->FocusedElement()) | 448 focused_element != GetFrame()->GetDocument()->FocusedElement()) |
449 UseCounter::Count(GetFrame(), UseCounter::kSelectionFuncionsChangeFocus); | 449 UseCounter::Count(GetFrame(), UseCounter::kSelectionFuncionsChangeFocus); |
450 } | 450 } |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
824 tree_scope_->GetDocument().AddConsoleMessage( | 824 tree_scope_->GetDocument().AddConsoleMessage( |
825 ConsoleMessage::Create(kJSMessageSource, kErrorMessageLevel, message)); | 825 ConsoleMessage::Create(kJSMessageSource, kErrorMessageLevel, message)); |
826 } | 826 } |
827 | 827 |
828 DEFINE_TRACE(DOMSelection) { | 828 DEFINE_TRACE(DOMSelection) { |
829 visitor->Trace(tree_scope_); | 829 visitor->Trace(tree_scope_); |
830 ContextClient::Trace(visitor); | 830 ContextClient::Trace(visitor); |
831 } | 831 } |
832 | 832 |
833 } // namespace blink | 833 } // namespace blink |
OLD | NEW |