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

Side by Side Diff: Source/core/editing/Editor.cpp

Issue 1112513005: Reload image bypassing the cache (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
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 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 urlString = toHTMLElement(node)->getAttribute(srcAttr); 456 urlString = toHTMLElement(node)->getAttribute(srcAttr);
457 else if (isSVGImageElement(*node)) 457 else if (isSVGImageElement(*node))
458 urlString = toSVGElement(node)->getAttribute(XLinkNames::hrefAttr); 458 urlString = toSVGElement(node)->getAttribute(XLinkNames::hrefAttr);
459 else if (isHTMLEmbedElement(*node) || isHTMLObjectElement(*node) || isHTMLCa nvasElement(*node)) 459 else if (isHTMLEmbedElement(*node) || isHTMLObjectElement(*node) || isHTMLCa nvasElement(*node))
460 urlString = toHTMLElement(node)->imageSourceURL(); 460 urlString = toHTMLElement(node)->imageSourceURL();
461 KURL url = urlString.isEmpty() ? KURL() : node->document().completeURL(strip LeadingAndTrailingHTMLSpaces(urlString)); 461 KURL url = urlString.isEmpty() ? KURL() : node->document().completeURL(strip LeadingAndTrailingHTMLSpaces(urlString));
462 462
463 pasteboard->writeImage(image.get(), url, title); 463 pasteboard->writeImage(image.get(), url, title);
464 } 464 }
465 465
466 static void reloadImageNode(Node* node, bool bypassCache)
467 {
468 ASSERT(node);
469 if (isHTMLImageElement(*node)) {
470 HTMLImageElement& element = toHTMLImageElement(*node);
471 element.imageLoader().updateFromElement(ImageLoader::UpdateIgnorePreviou sError, bypassCache);
472 }
473 }
474
466 // Returns whether caller should continue with "the default processing", which i s the same as 475 // Returns whether caller should continue with "the default processing", which i s the same as
467 // the event handler NOT setting the return value to false 476 // the event handler NOT setting the return value to false
468 bool Editor::dispatchCPPEvent(const AtomicString& eventType, DataTransferAccessP olicy policy, PasteMode pasteMode) 477 bool Editor::dispatchCPPEvent(const AtomicString& eventType, DataTransferAccessP olicy policy, PasteMode pasteMode)
469 { 478 {
470 Element* target = findEventTargetFromSelection(); 479 Element* target = findEventTargetFromSelection();
471 if (!target) 480 if (!target)
472 return true; 481 return true;
473 482
474 DataTransfer* dataTransfer = DataTransfer::create( 483 DataTransfer* dataTransfer = DataTransfer::create(
475 DataTransfer::CopyAndPaste, 484 DataTransfer::CopyAndPaste,
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 UseCounter::WebkitEditableContentChangedOnContentEditable, 963 UseCounter::WebkitEditableContentChangedOnContentEditable,
955 UseCounter::WebkitEditableContentChangedOnNotNode); 964 UseCounter::WebkitEditableContentChangedOnNotNode);
956 } 965 }
957 } 966 }
958 967
959 void Editor::copyImage(const HitTestResult& result) 968 void Editor::copyImage(const HitTestResult& result)
960 { 969 {
961 writeImageNodeToPasteboard(Pasteboard::generalPasteboard(), result.innerNode OrImageMapImage(), result.altDisplayString()); 970 writeImageNodeToPasteboard(Pasteboard::generalPasteboard(), result.innerNode OrImageMapImage(), result.altDisplayString());
962 } 971 }
963 972
973 void Editor::reloadImage(const HitTestResult& result, bool bypassCache)
Nate Chapin 2015/04/30 20:59:41 This doesn't really have anything to do with Edito
megjablon 2015/04/30 22:00:54 Do you have any ideas for an alternate path? I was
974 {
975 reloadImageNode(result.innerNodeOrImageMapImage(), bypassCache);
976 }
977
964 bool Editor::canUndo() 978 bool Editor::canUndo()
965 { 979 {
966 if (UndoStack* undoStack = this->undoStack()) 980 if (UndoStack* undoStack = this->undoStack())
967 return undoStack->canUndo(); 981 return undoStack->canUndo();
968 return false; 982 return false;
969 } 983 }
970 984
971 void Editor::undo() 985 void Editor::undo()
972 { 986 {
973 if (UndoStack* undoStack = this->undoStack()) 987 if (UndoStack* undoStack = this->undoStack())
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
1273 } 1287 }
1274 1288
1275 DEFINE_TRACE(Editor) 1289 DEFINE_TRACE(Editor)
1276 { 1290 {
1277 visitor->trace(m_frame); 1291 visitor->trace(m_frame);
1278 visitor->trace(m_lastEditCommand); 1292 visitor->trace(m_lastEditCommand);
1279 visitor->trace(m_mark); 1293 visitor->trace(m_mark);
1280 } 1294 }
1281 1295
1282 } // namespace blink 1296 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698