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

Side by Side Diff: webkit/glue/webframe_impl.cc

Issue 155650: WebFrameImpl::GetSelection(): Replace NBSPs with spaces.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 Samuel Weinig (sam.weinig@gmail.com) 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
3 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. 3 * Copyright (C) 2006 Apple Computer, 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 * 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 #include "base/compiler_specific.h" 69 #include "base/compiler_specific.h"
70 #include "build/build_config.h" 70 #include "build/build_config.h"
71 71
72 #include <algorithm> 72 #include <algorithm>
73 #include <string> 73 #include <string>
74 74
75 MSVC_PUSH_WARNING_LEVEL(0); 75 MSVC_PUSH_WARNING_LEVEL(0);
76 #include "HTMLFormElement.h" // need this before Document.h 76 #include "HTMLFormElement.h" // need this before Document.h
77 #include "Chrome.h" 77 #include "Chrome.h"
78 #include "ChromeClientChromium.h" 78 #include "ChromeClientChromium.h"
79 #include "ClipboardUtilitiesChromium.h"
79 #include "Console.h" 80 #include "Console.h"
80 #include "Document.h" 81 #include "Document.h"
81 #include "DocumentFragment.h" // Only needed for ReplaceSelectionCommand.h :( 82 #include "DocumentFragment.h" // Only needed for ReplaceSelectionCommand.h :(
82 #include "DocumentLoader.h" 83 #include "DocumentLoader.h"
83 #include "DocumentMarker.h" 84 #include "DocumentMarker.h"
84 #include "DOMWindow.h" 85 #include "DOMWindow.h"
85 #include "Editor.h" 86 #include "Editor.h"
86 #include "EventHandler.h" 87 #include "EventHandler.h"
87 #include "FormState.h" 88 #include "FormState.h"
88 #include "Frame.h" 89 #include "Frame.h"
(...skipping 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after
1380 1381
1381 std::string WebFrameImpl::GetSelection(bool as_html) { 1382 std::string WebFrameImpl::GetSelection(bool as_html) {
1382 RefPtr<Range> range = frame()->selection()->toNormalizedRange(); 1383 RefPtr<Range> range = frame()->selection()->toNormalizedRange();
1383 if (!range.get()) 1384 if (!range.get())
1384 return std::string(); 1385 return std::string();
1385 1386
1386 if (as_html) { 1387 if (as_html) {
1387 String markup = WebCore::createMarkup(range.get(), 0); 1388 String markup = WebCore::createMarkup(range.get(), 0);
1388 return webkit_glue::StringToStdString(markup); 1389 return webkit_glue::StringToStdString(markup);
1389 } else { 1390 } else {
1390 return webkit_glue::StringToStdString(range->text()); 1391 String text = range->text();
1392 #if defined(OS_WIN)
1393 WebCore::replaceNewlinesWithWindowsStyleNewlines(text);
1394 #endif
1395 WebCore::replaceNBSPWithSpace(text);
1396 return webkit_glue::StringToStdString(text);
1391 } 1397 }
1392 } 1398 }
1393 1399
1394 std::string WebFrameImpl::GetFullPageHtml() { 1400 std::string WebFrameImpl::GetFullPageHtml() {
1395 return webkit_glue::StringToStdString(createFullMarkup(frame_->document())); 1401 return webkit_glue::StringToStdString(createFullMarkup(frame_->document()));
1396 } 1402 }
1397 1403
1398 void WebFrameImpl::CreateFrameView() { 1404 void WebFrameImpl::CreateFrameView() {
1399 ASSERT(frame_); // If frame_ doesn't exist, we probably didn't init properly. 1405 ASSERT(frame_); // If frame_ doesn't exist, we probably didn't init properly.
1400 1406
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
1818 1824
1819 SecurityOrigin* security_origin = frame_->document()->securityOrigin(); 1825 SecurityOrigin* security_origin = frame_->document()->securityOrigin();
1820 1826
1821 if (!frame_->loader()->isScheduledLocationChangePending()) { 1827 if (!frame_->loader()->isScheduledLocationChangePending()) {
1822 frame_->loader()->stopAllLoaders(); 1828 frame_->loader()->stopAllLoaders();
1823 frame_->loader()->begin(frame_->loader()->url(), true, security_origin); 1829 frame_->loader()->begin(frame_->loader()->url(), true, security_origin);
1824 frame_->loader()->write(script_result); 1830 frame_->loader()->write(script_result);
1825 frame_->loader()->end(); 1831 frame_->loader()->end();
1826 } 1832 }
1827 } 1833 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698