| Index: third_party/WebKit/Source/core/html/MediaDocument.cpp
|
| diff --git a/third_party/WebKit/Source/core/html/MediaDocument.cpp b/third_party/WebKit/Source/core/html/MediaDocument.cpp
|
| index 525d869dbb2ff380d5110f98d9e9b3d3e17ac593..f9b2501ad198547f85cbe319a5482d8fa245b3bd 100644
|
| --- a/third_party/WebKit/Source/core/html/MediaDocument.cpp
|
| +++ b/third_party/WebKit/Source/core/html/MediaDocument.cpp
|
| @@ -31,7 +31,9 @@
|
| #include "core/dom/RawDataDocumentParser.h"
|
| #include "core/events/KeyboardEvent.h"
|
| #include "core/frame/LocalFrame.h"
|
| +#include "core/html/HTMLAnchorElement.h"
|
| #include "core/html/HTMLBodyElement.h"
|
| +#include "core/html/HTMLDivElement.h"
|
| #include "core/html/HTMLHeadElement.h"
|
| #include "core/html/HTMLHtmlElement.h"
|
| #include "core/html/HTMLMetaElement.h"
|
| @@ -41,6 +43,7 @@
|
| #include "core/loader/FrameLoader.h"
|
| #include "core/loader/FrameLoaderClient.h"
|
| #include "platform/KeyboardCodes.h"
|
| +#include "platform/text/PlatformLocale.h"
|
|
|
| namespace blink {
|
|
|
| @@ -98,8 +101,26 @@ void MediaDocumentParser::createDocumentStructure()
|
| media->appendChild(source.release());
|
|
|
| RefPtrWillBeRawPtr<HTMLBodyElement> body = HTMLBodyElement::create(*document());
|
| - body->appendChild(media.release());
|
|
|
| + RefPtrWillBeRawPtr<HTMLDivElement> div = HTMLDivElement::create(*document());
|
| + if (RuntimeEnabledFeatures::mediaDocumentDownloadButtonEnabled()) {
|
| + // Padding is used to compensate for the height of the download button so that the media element can still be centered.
|
| + RefPtrWillBeRawPtr<HTMLDivElement> padding = HTMLDivElement::create(*document());
|
| + padding->setAttribute(heightAttr, "68px;");
|
| + div->appendChild(padding.release());
|
| + }
|
| +
|
| + div->appendChild(media.release());
|
| +
|
| + if (RuntimeEnabledFeatures::mediaDocumentDownloadButtonEnabled()) {
|
| + RefPtrWillBeRawPtr<HTMLAnchorElement> anchor = HTMLAnchorElement::create(*document());
|
| + anchor->setAttribute(downloadAttr, "");
|
| + anchor->setURL(document()->url());
|
| + anchor->setTextContent(document()->getCachedLocale(document()->contentLanguage()).queryString(WebLocalizedString::DownloadButtonLabel));
|
| + div->appendChild(anchor.release());
|
| + }
|
| +
|
| + body->appendChild(div.release());
|
| rootElement->appendChild(head.release());
|
| rootElement->appendChild(body.release());
|
|
|
|
|