| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 #include "sky/engine/core/dom/NodeTraversal.h" | 87 #include "sky/engine/core/dom/NodeTraversal.h" |
| 88 #include "sky/engine/core/dom/shadow/ShadowRoot.h" | 88 #include "sky/engine/core/dom/shadow/ShadowRoot.h" |
| 89 #include "sky/engine/core/editing/Editor.h" | 89 #include "sky/engine/core/editing/Editor.h" |
| 90 #include "sky/engine/core/editing/FrameSelection.h" | 90 #include "sky/engine/core/editing/FrameSelection.h" |
| 91 #include "sky/engine/core/editing/InputMethodController.h" | 91 #include "sky/engine/core/editing/InputMethodController.h" |
| 92 #include "sky/engine/core/editing/PlainTextRange.h" | 92 #include "sky/engine/core/editing/PlainTextRange.h" |
| 93 #include "sky/engine/core/editing/SpellChecker.h" | 93 #include "sky/engine/core/editing/SpellChecker.h" |
| 94 #include "sky/engine/core/editing/TextAffinity.h" | 94 #include "sky/engine/core/editing/TextAffinity.h" |
| 95 #include "sky/engine/core/editing/TextIterator.h" | 95 #include "sky/engine/core/editing/TextIterator.h" |
| 96 #include "sky/engine/core/editing/htmlediting.h" | 96 #include "sky/engine/core/editing/htmlediting.h" |
| 97 #include "sky/engine/core/editing/markup.h" | |
| 98 #include "sky/engine/core/frame/Console.h" | 97 #include "sky/engine/core/frame/Console.h" |
| 99 #include "sky/engine/core/frame/FrameHost.h" | 98 #include "sky/engine/core/frame/FrameHost.h" |
| 100 #include "sky/engine/core/frame/FrameView.h" | 99 #include "sky/engine/core/frame/FrameView.h" |
| 101 #include "sky/engine/core/frame/LocalDOMWindow.h" | 100 #include "sky/engine/core/frame/LocalDOMWindow.h" |
| 102 #include "sky/engine/core/frame/Settings.h" | 101 #include "sky/engine/core/frame/Settings.h" |
| 103 #include "sky/engine/core/html/HTMLAnchorElement.h" | 102 #include "sky/engine/core/html/HTMLAnchorElement.h" |
| 104 #include "sky/engine/core/inspector/ConsoleMessage.h" | 103 #include "sky/engine/core/inspector/ConsoleMessage.h" |
| 105 #include "sky/engine/core/inspector/ScriptCallStack.h" | 104 #include "sky/engine/core/inspector/ScriptCallStack.h" |
| 106 #include "sky/engine/core/loader/MojoLoader.h" | 105 #include "sky/engine/core/loader/MojoLoader.h" |
| 107 #include "sky/engine/core/page/Chrome.h" | 106 #include "sky/engine/core/page/Chrome.h" |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 { | 533 { |
| 535 RefPtr<Range> range = frame()->selection().toNormalizedRange(); | 534 RefPtr<Range> range = frame()->selection().toNormalizedRange(); |
| 536 if (!range) | 535 if (!range) |
| 537 return WebString(); | 536 return WebString(); |
| 538 | 537 |
| 539 String text = range->text(); | 538 String text = range->text(); |
| 540 replaceNBSPWithSpace(text); | 539 replaceNBSPWithSpace(text); |
| 541 return text; | 540 return text; |
| 542 } | 541 } |
| 543 | 542 |
| 544 WebString WebLocalFrameImpl::selectionAsMarkup() const | |
| 545 { | |
| 546 RefPtr<Range> range = frame()->selection().toNormalizedRange(); | |
| 547 if (!range) | |
| 548 return WebString(); | |
| 549 | |
| 550 return createMarkup(range.get(), 0, AnnotateForInterchange, false, ResolveNo
nLocalURLs); | |
| 551 } | |
| 552 | |
| 553 void WebLocalFrameImpl::selectWordAroundPosition(LocalFrame* frame, VisiblePosit
ion position) | 543 void WebLocalFrameImpl::selectWordAroundPosition(LocalFrame* frame, VisiblePosit
ion position) |
| 554 { | 544 { |
| 555 VisibleSelection selection(position); | 545 VisibleSelection selection(position); |
| 556 selection.expandUsingGranularity(WordGranularity); | 546 selection.expandUsingGranularity(WordGranularity); |
| 557 | 547 |
| 558 TextGranularity granularity = selection.isRange() ? WordGranularity : Charac
terGranularity; | 548 TextGranularity granularity = selection.isRange() ? WordGranularity : Charac
terGranularity; |
| 559 frame->selection().setSelection(selection, granularity); | 549 frame->selection().setSelection(selection, granularity); |
| 560 } | 550 } |
| 561 | 551 |
| 562 bool WebLocalFrameImpl::selectWordAroundCaret() | 552 bool WebLocalFrameImpl::selectWordAroundCaret() |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 | 631 |
| 642 WebString WebLocalFrameImpl::contentAsText(size_t maxChars) const | 632 WebString WebLocalFrameImpl::contentAsText(size_t maxChars) const |
| 643 { | 633 { |
| 644 if (!frame()) | 634 if (!frame()) |
| 645 return WebString(); | 635 return WebString(); |
| 646 StringBuilder text; | 636 StringBuilder text; |
| 647 frameContentAsPlainText(maxChars, frame(), text); | 637 frameContentAsPlainText(maxChars, frame(), text); |
| 648 return text.toString(); | 638 return text.toString(); |
| 649 } | 639 } |
| 650 | 640 |
| 651 WebString WebLocalFrameImpl::contentAsMarkup() const | |
| 652 { | |
| 653 if (!frame()) | |
| 654 return WebString(); | |
| 655 return createMarkup(frame()->document()); | |
| 656 } | |
| 657 | |
| 658 WebString WebLocalFrameImpl::renderTreeAsText(RenderAsTextControls toShow) const | 641 WebString WebLocalFrameImpl::renderTreeAsText(RenderAsTextControls toShow) const |
| 659 { | 642 { |
| 660 RenderAsTextBehavior behavior = RenderAsTextBehaviorNormal; | 643 RenderAsTextBehavior behavior = RenderAsTextBehaviorNormal; |
| 661 | 644 |
| 662 if (toShow & RenderAsTextDebug) | 645 if (toShow & RenderAsTextDebug) |
| 663 behavior |= RenderAsTextShowCompositedLayers | RenderAsTextShowAddresses
| RenderAsTextShowIDAndClass | RenderAsTextShowLayerNesting; | 646 behavior |= RenderAsTextShowCompositedLayers | RenderAsTextShowAddresses
| RenderAsTextShowIDAndClass | RenderAsTextShowLayerNesting; |
| 664 | 647 |
| 665 return externalRepresentation(frame(), behavior); | 648 return externalRepresentation(frame(), behavior); |
| 666 } | 649 } |
| 667 | 650 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 } | 757 } |
| 775 | 758 |
| 776 void WebLocalFrameImpl::invalidateAll() const | 759 void WebLocalFrameImpl::invalidateAll() const |
| 777 { | 760 { |
| 778 ASSERT(frame() && frame()->view()); | 761 ASSERT(frame() && frame()->view()); |
| 779 FrameView* view = frame()->view(); | 762 FrameView* view = frame()->view(); |
| 780 view->invalidateRect(view->frameRect()); | 763 view->invalidateRect(view->frameRect()); |
| 781 } | 764 } |
| 782 | 765 |
| 783 } // namespace blink | 766 } // namespace blink |
| OLD | NEW |