OLD | NEW |
---|---|
1 /** | 1 /** |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de) | 4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de) |
5 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. | 5 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 28 matching lines...) Expand all Loading... | |
39 #include "core/html/PluginDocument.h" | 39 #include "core/html/PluginDocument.h" |
40 #include "core/input/EventHandler.h" | 40 #include "core/input/EventHandler.h" |
41 #include "core/inspector/ConsoleMessage.h" | 41 #include "core/inspector/ConsoleMessage.h" |
42 #include "core/layout/LayoutImage.h" | 42 #include "core/layout/LayoutImage.h" |
43 #include "core/layout/LayoutPart.h" | 43 #include "core/layout/LayoutPart.h" |
44 #include "core/layout/api/LayoutEmbeddedItem.h" | 44 #include "core/layout/api/LayoutEmbeddedItem.h" |
45 #include "core/loader/MixedContentChecker.h" | 45 #include "core/loader/MixedContentChecker.h" |
46 #include "core/page/Page.h" | 46 #include "core/page/Page.h" |
47 #include "core/page/scrolling/ScrollingCoordinator.h" | 47 #include "core/page/scrolling/ScrollingCoordinator.h" |
48 #include "core/plugins/PluginView.h" | 48 #include "core/plugins/PluginView.h" |
49 #include "platform/FrameViewBase.h" | |
50 #include "platform/Histogram.h" | 49 #include "platform/Histogram.h" |
51 #include "platform/bindings/V8PerIsolateData.h" | 50 #include "platform/bindings/V8PerIsolateData.h" |
52 #include "platform/loader/fetch/ResourceRequest.h" | 51 #include "platform/loader/fetch/ResourceRequest.h" |
53 #include "platform/network/mime/MIMETypeFromURL.h" | 52 #include "platform/network/mime/MIMETypeFromURL.h" |
54 #include "platform/network/mime/MIMETypeRegistry.h" | 53 #include "platform/network/mime/MIMETypeRegistry.h" |
55 #include "platform/plugins/PluginData.h" | 54 #include "platform/plugins/PluginData.h" |
56 #include "public/platform/WebURLRequest.h" | 55 #include "public/platform/WebURLRequest.h" |
57 | 56 |
58 namespace blink { | 57 namespace blink { |
59 | 58 |
(...skipping 11 matching lines...) Expand all Loading... | |
71 | 70 |
72 } // anonymous namespace | 71 } // anonymous namespace |
73 | 72 |
74 HTMLPlugInElement::HTMLPlugInElement( | 73 HTMLPlugInElement::HTMLPlugInElement( |
75 const QualifiedName& tag_name, | 74 const QualifiedName& tag_name, |
76 Document& doc, | 75 Document& doc, |
77 bool created_by_parser, | 76 bool created_by_parser, |
78 PreferPlugInsForImagesOption prefer_plug_ins_for_images_option) | 77 PreferPlugInsForImagesOption prefer_plug_ins_for_images_option) |
79 : HTMLFrameOwnerElement(tag_name, doc), | 78 : HTMLFrameOwnerElement(tag_name, doc), |
80 is_delaying_load_event_(false), | 79 is_delaying_load_event_(false), |
81 // m_needsPluginUpdate(!createdByParser) allows HTMLObjectElement to delay | 80 // needs_plugin_update(!createdByParser) allows HTMLObjectElement to delay |
dcheng
2017/05/09 08:05:55
Move these comment fixes to a separate CL? In git,
joelhockey
2017/05/10 04:17:13
reverted
| |
82 // FrameViewBase updates until after all children are parsed. For | 81 // FrameOrPlugin updates until after all children are parsed. For |
83 // HTMLEmbedElement this delay is unnecessary, but it is simpler to make | 82 // HTMLEmbedElement this delay is unnecessary, but it is simpler to make |
84 // both classes share the same codepath in this class. | 83 // both classes share the same codepath in this class. |
85 needs_plugin_update_(!created_by_parser), | 84 needs_plugin_update_(!created_by_parser), |
86 should_prefer_plug_ins_for_images_(prefer_plug_ins_for_images_option == | 85 should_prefer_plug_ins_for_images_(prefer_plug_ins_for_images_option == |
87 kShouldPreferPlugInsForImages) {} | 86 kShouldPreferPlugInsForImages) {} |
88 | 87 |
89 HTMLPlugInElement::~HTMLPlugInElement() { | 88 HTMLPlugInElement::~HTMLPlugInElement() { |
90 DCHECK(plugin_wrapper_.IsEmpty()); // cleared in detachLayoutTree() | 89 DCHECK(plugin_wrapper_.IsEmpty()); // cleared in detachLayoutTree() |
91 DCHECK(!is_delaying_load_event_); | 90 DCHECK(!is_delaying_load_event_); |
92 } | 91 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
126 return false; | 125 return false; |
127 | 126 |
128 KURL completed_url = url.IsEmpty() ? KURL() : GetDocument().CompleteURL(url); | 127 KURL completed_url = url.IsEmpty() ? KURL() : GetDocument().CompleteURL(url); |
129 if (!AllowedToLoadObject(completed_url, mime_type)) | 128 if (!AllowedToLoadObject(completed_url, mime_type)) |
130 return false; | 129 return false; |
131 | 130 |
132 bool use_fallback; | 131 bool use_fallback; |
133 if (!ShouldUsePlugin(completed_url, mime_type, HasFallbackContent(), | 132 if (!ShouldUsePlugin(completed_url, mime_type, HasFallbackContent(), |
134 use_fallback)) { | 133 use_fallback)) { |
135 // If the plugin element already contains a subframe, | 134 // If the plugin element already contains a subframe, |
136 // loadOrRedirectSubframe will re-use it. Otherwise, it will create a | 135 // LoadOrRedirectSubframe will re-use it. Otherwise, it will create a |
137 // new frame and set it as the LayoutPart's FrameViewBase, causing what was | 136 // new frame and set it as the LayoutPart's FrameOrPlugin, causing what was |
138 // previously in the FrameViewBase to be torn down. | 137 // previously in the FrameOrPlugin to be torn down. |
139 return LoadOrRedirectSubframe(completed_url, GetNameAttribute(), true); | 138 return LoadOrRedirectSubframe(completed_url, GetNameAttribute(), true); |
140 } | 139 } |
141 | 140 |
142 return LoadPlugin(completed_url, mime_type, param_names, param_values, | 141 return LoadPlugin(completed_url, mime_type, param_names, param_values, |
143 use_fallback, true); | 142 use_fallback, true); |
144 } | 143 } |
145 | 144 |
146 bool HTMLPlugInElement::CanProcessDrag() const { | 145 bool HTMLPlugInElement::CanProcessDrag() const { |
147 return PluginWidget() && PluginWidget()->CanProcessDrag(); | 146 return PluginWidget() && PluginWidget()->CanProcessDrag(); |
148 } | 147 } |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
259 LoadPlugin(url, service_type_, param_names, param_values, use_fallback, | 258 LoadPlugin(url, service_type_, param_names, param_values, use_fallback, |
260 false); | 259 false); |
261 } | 260 } |
262 | 261 |
263 bool HTMLPlugInElement::ShouldAccelerate() const { | 262 bool HTMLPlugInElement::ShouldAccelerate() const { |
264 PluginView* plugin = OwnedPlugin(); | 263 PluginView* plugin = OwnedPlugin(); |
265 return plugin && plugin->PlatformLayer(); | 264 return plugin && plugin->PlatformLayer(); |
266 } | 265 } |
267 | 266 |
268 void HTMLPlugInElement::DetachLayoutTree(const AttachContext& context) { | 267 void HTMLPlugInElement::DetachLayoutTree(const AttachContext& context) { |
269 // Update the FrameViewBase the next time we attach (detaching destroys the | 268 // Update the FrameOrPlugin the next time we attach (detaching destroys the |
270 // plugin). | 269 // plugin). |
271 // FIXME: None of this "needsPluginUpdate" related code looks right. | 270 // FIXME: None of this "NeedsPluginUpdate" related code looks right. |
272 if (GetLayoutObject() && !UseFallbackContent()) | 271 if (GetLayoutObject() && !UseFallbackContent()) |
273 SetNeedsPluginUpdate(true); | 272 SetNeedsPluginUpdate(true); |
274 | 273 |
275 if (is_delaying_load_event_) { | 274 if (is_delaying_load_event_) { |
276 is_delaying_load_event_ = false; | 275 is_delaying_load_event_ = false; |
277 GetDocument().DecrementLoadEventDelayCount(); | 276 GetDocument().DecrementLoadEventDelayCount(); |
278 } | 277 } |
279 | 278 |
280 // Only try to persist a plugin we actually own. | 279 // Only try to persist a plugin we actually own. |
281 PluginView* plugin = OwnedPlugin(); | 280 PluginView* plugin = OwnedPlugin(); |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
665 | 664 |
666 void HTMLPlugInElement::LazyReattachIfNeeded() { | 665 void HTMLPlugInElement::LazyReattachIfNeeded() { |
667 if (!UseFallbackContent() && NeedsPluginUpdate() && GetLayoutObject() && | 666 if (!UseFallbackContent() && NeedsPluginUpdate() && GetLayoutObject() && |
668 !IsImageType()) { | 667 !IsImageType()) { |
669 LazyReattachIfAttached(); | 668 LazyReattachIfAttached(); |
670 SetPersistedPlugin(nullptr); | 669 SetPersistedPlugin(nullptr); |
671 } | 670 } |
672 } | 671 } |
673 | 672 |
674 } // namespace blink | 673 } // namespace blink |
OLD | NEW |