Commit 06d89a01 authored by oliver's avatar oliver

2007-03-28 Oliver Hunt <oliver@apple.com>

        Reviewed by Hyatt.

        Rename DocLoader::setPasteInProgress, etc to more generic 
        setAllowStaleResources, etc

        * editing/Editor.cpp:
        (WebCore::Editor::paste):
        * loader/DocLoader.cpp:
        (WebCore::DocLoader::DocLoader):
        (WebCore::DocLoader::checkForReload):
        * loader/DocLoader.h:
        (WebCore::DocLoader::setAllowStaleResources):
        * page/DragController.cpp:
        (WebCore::DragController::concludeDrag):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@20568 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 1c8a4876
2007-03-28 Oliver Hunt <oliver@apple.com>
Reviewed by Hyatt.
Rename DocLoader::setPasteInProgress, etc to more generic
setAllowStaleResources, etc
* editing/Editor.cpp:
(WebCore::Editor::paste):
* loader/DocLoader.cpp:
(WebCore::DocLoader::DocLoader):
(WebCore::DocLoader::checkForReload):
* loader/DocLoader.h:
(WebCore::DocLoader::setAllowStaleResources):
* page/DragController.cpp:
(WebCore::DragController::concludeDrag):
2007-03-28 Oliver Hunt <oliver@apple.com>
Reviewed by Anders and Steve.
......
......@@ -1423,20 +1423,20 @@ void Editor::paste()
#if PLATFORM(MAC)
// using the platform independent code below requires moving all of
// WEBHTMLView: _documentFragmentFromPasteboard over to PasteboardMac.
loader->setPasteInProgress(true);
loader->setAllowStaleResources(true);
m_frame->issuePasteCommand();
loader->setPasteInProgress(false);
loader->setAllowStaleResources(false);
#else
if (tryDHTMLPaste())
return; // DHTML did the whole operation
if (!canPaste())
return;
loader->setPasteInProgress(true);
loader->setAllowStaleResources(true);
if (m_frame->selectionController()->isContentRichlyEditable())
pasteWithPasteboard(Pasteboard::generalPasteboard(), true);
else
pasteAsPlainTextWithPasteboard(Pasteboard::generalPasteboard());
loader->setPasteInProgress(false);
loader->setAllowStaleResources(false);
#endif
}
......
......@@ -48,7 +48,7 @@ DocLoader::DocLoader(Frame *frame, Document* doc)
, m_doc(doc)
, m_autoLoadImages(true)
, m_loadInProgress(false)
, m_pasteInProgress(false)
, m_allowStaleResources(false)
{
m_cache->addDocLoader(this);
}
......@@ -65,7 +65,7 @@ void DocLoader::setExpireDate(time_t _expireDate)
void DocLoader::checkForReload(const KURL& fullURL)
{
if (m_pasteInProgress)
if (m_allowStaleResources)
return; //Don't reload resources while pasting
if (m_cachePolicy == CachePolicyVerify) {
if (!m_reloadedURLs.contains(fullURL.url())) {
......
......@@ -87,7 +87,7 @@ public:
void setLoadInProgress(bool);
bool loadInProgress() const { return m_loadInProgress; }
void setPasteInProgress(bool pasteInProgress) { m_pasteInProgress = pasteInProgress; }
void setAllowStaleResources(bool allowStaleResources) { m_allowStaleResources = allowStaleResources; }
private:
CachedResource* requestResource(CachedResource::Type, const String& url, const String* charset = 0, bool skipCanLoadCheck = false);
......@@ -106,7 +106,7 @@ private:
//29 bits left
bool m_autoLoadImages : 1;
bool m_loadInProgress : 1;
bool m_pasteInProgress : 1;
bool m_allowStaleResources : 1;
};
}
......
......@@ -351,12 +351,12 @@ bool DragController::concludeDrag(DragData* dragData, DragDestinationAction acti
m_page->dragCaretController()->clear();
RefPtr<Range> range = dragCaret.toRange();
DocLoader* loader = range->ownerDocument()->docLoader();
loader->setPasteInProgress(true);
loader->setAllowStaleResources(true);
if (dragIsMove(innerFrame->selectionController(), dragData) || dragCaret.isContentRichlyEditable()) {
bool chosePlainText = false;
RefPtr<DocumentFragment> fragment = documentFragmentFromDragData(dragData, range, true, chosePlainText);
if (!fragment || !innerFrame->editor()->shouldInsertFragment(fragment, range, EditorInsertActionDropped)) {
loader->setPasteInProgress(false);
loader->setAllowStaleResources(false);
return false;
}
......@@ -373,7 +373,7 @@ bool DragController::concludeDrag(DragData* dragData, DragDestinationAction acti
} else {
String text = dragData->asPlainText();
if (text.isEmpty() || !innerFrame->editor()->shouldInsertText(text, range.get(), EditorInsertActionDropped)) {
loader->setPasteInProgress(false);
loader->setAllowStaleResources(false);
return false;
}
......@@ -381,7 +381,7 @@ bool DragController::concludeDrag(DragData* dragData, DragDestinationAction acti
if (setSelectionToDragCaret(innerFrame, dragCaret, range, point))
applyCommand(new ReplaceSelectionCommand(m_document, createFragmentFromText(range.get(), text), true, false, true));
}
loader->setPasteInProgress(false);
loader->setAllowStaleResources(false);
return true;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment