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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutPart.cpp

Issue 2764313002: Move plugins to be stored in HTMLPlugInElement. (Closed)
Patch Set: Created 3 years, 9 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: third_party/WebKit/Source/core/layout/LayoutPart.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutPart.cpp b/third_party/WebKit/Source/core/layout/LayoutPart.cpp
index 9078c43ead331db2c248178d7033e6bdbb811f39..8e8745c8e0f807848d38e254d6bf0143a0a7d8d9 100644
--- a/third_party/WebKit/Source/core/layout/LayoutPart.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutPart.cpp
@@ -28,6 +28,7 @@
#include "core/frame/FrameView.h"
#include "core/frame/LocalFrame.h"
#include "core/html/HTMLFrameElementBase.h"
+#include "core/html/HTMLPlugInElement.h"
#include "core/layout/HitTestResult.h"
#include "core/layout/LayoutAnalyzer.h"
#include "core/layout/LayoutView.h"
@@ -98,6 +99,13 @@ FrameViewBase* LayoutPart::frameViewBase() const {
return nullptr;
}
+PluginView* LayoutPart::plugin() const {
+ // Plugins are stored in their DOM node.
+ return node() && isHTMLPlugInElement(node())
+ ? toHTMLPlugInElement(node())->plugin()
+ : nullptr;
+}
+
PaintLayerType LayoutPart::layerTypeRequired() const {
PaintLayerType type = LayoutReplaced::layerTypeRequired();
if (type != NoPaintLayer)
@@ -110,8 +118,8 @@ bool LayoutPart::requiresAcceleratedCompositing() const {
// a plugin LayoutObject and the plugin has a layer, then we need a layer.
// Second, if this is a LayoutObject with a contentDocument and that document
// needs a layer, then we need a layer.
- if (frameViewBase() && frameViewBase()->isPluginView() &&
- toPluginView(frameViewBase())->platformLayer())
+ PluginView* pluginView = plugin();
+ if (pluginView && pluginView->platformLayer())
return true;
if (!node() || !node()->isFrameOwnerElement())
@@ -247,6 +255,7 @@ void LayoutPart::styleDidChange(StyleDifference diff,
if (frameViewBase && frameViewBase->isFrameView())
toFrameView(frameViewBase)->recalculateCustomScrollbarStyle();
+ // TODO(joelhockey): Does this need separate code for plugins?
haraken 2017/03/22 15:32:33 I guess yes. Can you add CHECK(!(node() && isHTML
joelhockey 2017/03/27 06:42:21 Thanks, that is a helpful approach. It showed tha
if (style()->visibility() != EVisibility::kVisible) {
frameViewBase->hide();
haraken 2017/03/22 15:32:33 One way to handle both the FrameViewBase case and
joelhockey 2017/03/27 06:42:21 This function will be ok to take FrameViewBase as
haraken 2017/03/28 07:39:41 However, you're planning to remove the inheritance
joelhockey 2017/03/28 22:56:23 Yes, I will remove the inheritance from FrameView
haraken 2017/03/29 11:04:46 Sounds like a nice plan.
} else {
@@ -272,7 +281,7 @@ void LayoutPart::paintContents(const PaintInfo& paintInfo,
CursorDirective LayoutPart::getCursor(const LayoutPoint& point,
Cursor& cursor) const {
- if (frameViewBase() && frameViewBase()->isPluginView()) {
+ if (plugin()) {
// A plugin is responsible for setting the cursor when the pointer is over
// it.
return DoNotSetCursor;
@@ -301,6 +310,7 @@ void LayoutPart::updateOnWidgetChange() {
if (!needsLayout())
updateGeometryInternal();
+ // TODO(joelhockey): Does this need special handling for plugin?
dcheng 2017/03/23 07:21:42 I think this also needs to be handled: the main su
joelhockey 2017/03/27 06:42:21 Thanks. I just noticed how the impl forwards the
if (style()->visibility() != EVisibility::kVisible) {
frameViewBase->hide();
} else {
@@ -319,6 +329,7 @@ void LayoutPart::updateGeometry() {
LayoutRect newFrame = replacedContentRect();
DCHECK(newFrame.size() == roundedIntSize(newFrame.size()));
+ // TODO(joelhockey): Does this need special handling for plugin?
bool boundsWillChange =
LayoutSize(frameViewBase->frameRect().size()) != newFrame.size();
@@ -372,6 +383,7 @@ void LayoutPart::updateGeometryInternal() {
// Why is the protector needed?
RefPtr<LayoutPart> protector(this);
+ // TODO(joelhockey): Does this need special handling for plugin?
frameViewBase->setFrameRect(frameRect);
}

Powered by Google App Engine
This is Rietveld 408576698