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

Unified Diff: Source/core/page/DragController.cpp

Issue 23467007: Have Range constructor take a Document reference in argument (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/page/DragController.cpp
diff --git a/Source/core/page/DragController.cpp b/Source/core/page/DragController.cpp
index 307b2b687d08005b0b8bdb6d14bfc2ac3d00b7ec..0ccae8bebd26d82c41ad8c5997c9cfed8b48f263 100644
--- a/Source/core/page/DragController.cpp
+++ b/Source/core/page/DragController.cpp
@@ -149,9 +149,8 @@ static PassRefPtr<DocumentFragment> documentFragmentFromDragData(DragData* dragD
ASSERT(dragData);
chosePlainText = false;
- Document* document = context->ownerDocument();
- ASSERT(document);
- if (document && dragData->containsCompatibleContent()) {
+ Document& document = context->ownerDocument();
+ if (dragData->containsCompatibleContent()) {
if (PassRefPtr<DocumentFragment> fragment = dragData->asFragment(frame, context, allowPlainText, chosePlainText))
return fragment;
@@ -159,7 +158,7 @@ static PassRefPtr<DocumentFragment> documentFragmentFromDragData(DragData* dragD
String title;
String url = dragData->asURL(frame, DragData::DoNotConvertFilenames, &title);
if (!url.isEmpty()) {
- RefPtr<HTMLAnchorElement> anchor = HTMLAnchorElement::create(*document);
+ RefPtr<HTMLAnchorElement> anchor = HTMLAnchorElement::create(document);
anchor->setHref(url);
if (title.isEmpty()) {
// Try the plain text first because the url might be normalized or escaped.
@@ -168,9 +167,9 @@ static PassRefPtr<DocumentFragment> documentFragmentFromDragData(DragData* dragD
if (title.isEmpty())
title = url;
}
- RefPtr<Node> anchorText = document->createTextNode(title);
+ RefPtr<Node> anchorText = document.createTextNode(title);
anchor->appendChild(anchorText);
- RefPtr<DocumentFragment> fragment = document->createDocumentFragment();
+ RefPtr<DocumentFragment> fragment = document.createDocumentFragment();
fragment->appendChild(anchor);
return fragment.release();
}
@@ -485,7 +484,7 @@ bool DragController::concludeEditDrag(DragData* dragData)
// manually controlling drag behaviour
if (!range)
return false;
- ResourceFetcher* fetcher = range->ownerDocument()->fetcher();
+ ResourceFetcher* fetcher = range->ownerDocument().fetcher();
ResourceCacheValidationSuppressor validationSuppressor(fetcher);
if (dragIsMove(innerFrame->selection(), dragData) || dragCaret.isContentRichlyEditable()) {
bool chosePlainText = false;

Powered by Google App Engine
This is Rietveld 408576698