Make more use of toRenderFoo(RenderObject&) cast helpers.
<https://webkit.org/b/120565>

Reviewed by Darin Adler.

To make amends for putting ugly toRenderFoo(&renderer) casts everywhere,
here's a patch that switches a bunch of code over to using reference-based casts.

I removed pointer-based casts altogether for these renderers:

    - RenderBR
    - RenderCombineText
    - RenderListMarker
    - RenderVideo
    - RenderView


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154937 268f45cc-cd09-0410-ab3c-d52691b4dbfc
EditCommand constructors should take Document&.
<https://webkit.org/b/120566>

Reviewed by Darin Adler.

Let EditCommand's and all subclass constructors take Document& instead of Document*.
EditCommand::document() now returns a Document&.

Added Editor::document() which returns Editor::frame().document() after asserting
that it's non-null, to make passing a Document& from Editor functions easier.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154938 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Refactor URL and image writing so layer-violating parts are in Editor, not Pasteboard (Mac-only at first)
https://bugs.webkit.org/show_bug.cgi?id=120573

Reviewed by Andreas Kling.

* editing/Editor.cpp:
(WebCore::Editor::copy): Use writeImageToPasteboard instead of Pasteboard::writeImage on Mac.
(WebCore::Editor::copyURL): Use writeURLToPasteboard instead of Pasteboard::writeURL on Mac.
(WebCore::innerNonSharedElement): Added. Used in copyImage.
(WebCore::Editor::copyImage): Use innerNonSharedElement instead of innerNonSharedNode.
Use writeImageToPasteboard instead of Pasteboard::writeImage on Mac.

* editing/Editor.h: Add new functions, writeURLToPasteboard and writeImageToPasteboard,
both Mac-only for now.

* editing/mac/EditorMac.mm:
(WebCore::Editor::pasteWithPasteboard): Removed unneeded "m_frame.editor()" round trip that
was left behind in this function.
(WebCore::getImage): Added. Helper used by writeImageToPasteboard.
(WebCore::Editor::writeURLToPasteboard): Added. Sets up PasteboardURL and then calls
Pasteboard::write with it.
(WebCore::Editor::writeImageToPasteboard): Added. Sets up PasteboardImage and then calls
Pasteboard::write with it.
* page/DragController.cpp:
(WebCore::DragController::startDrag): Use Editor::writeURLToPasteboard instead of
Pasteboard::writeURL on Mac.

* platform/Pasteboard.h: Added PasteboardURL and PasteboardImage structures.
Declare write functions for PasteboardWebContent, PasteboardURL, and PasteboardImage.
Guard writeURL and writeImage with !PLATFORM(MAC).

* platform/mac/PasteboardMac.mm:
(WebCore::writeURLForTypes): Changed this to take a PasteboardURL.
(WebCore::Pasteboard::write): Renamed writeURL and writeImage to this. Refactor both
to take PasteboardURL and PasteboardImage arguments.
(WebCore::fileWrapper): Renamed from fileWrapperForImage since the fact that this is
for an image is now clear from its argument, a PasteboardImage.
(WebCore::writeFileWrapperAsRTFDAttachment): Changed this function to use early return.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154939 268f45cc-cd09-0410-ab3c-d52691b4dbfc