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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutEmbeddedObject.cpp

Issue 2166813005: Remove layoutObject() dependency from HTMLPlugInElement::layoutObjectIsFocusable(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment grammar Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Simon Hausmann <hausmann@kde.org> 3 * (C) 2000 Simon Hausmann <hausmann@kde.org>
4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de) 4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de)
5 * Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
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 24 matching lines...) Expand all
35 #include "core/paint/EmbeddedObjectPainter.h" 35 #include "core/paint/EmbeddedObjectPainter.h"
36 #include "core/plugins/PluginView.h" 36 #include "core/plugins/PluginView.h"
37 #include "platform/text/PlatformLocale.h" 37 #include "platform/text/PlatformLocale.h"
38 38
39 namespace blink { 39 namespace blink {
40 40
41 using namespace HTMLNames; 41 using namespace HTMLNames;
42 42
43 LayoutEmbeddedObject::LayoutEmbeddedObject(Element* element) 43 LayoutEmbeddedObject::LayoutEmbeddedObject(Element* element)
44 : LayoutPart(element) 44 : LayoutPart(element)
45 , m_showsUnavailablePluginIndicator(false)
46 { 45 {
47 view()->frameView()->setIsVisuallyNonEmpty(); 46 view()->frameView()->setIsVisuallyNonEmpty();
48 } 47 }
49 48
50 LayoutEmbeddedObject::~LayoutEmbeddedObject() 49 LayoutEmbeddedObject::~LayoutEmbeddedObject()
51 { 50 {
52 } 51 }
53 52
54 PaintLayerType LayoutEmbeddedObject::layerTypeRequired() const 53 PaintLayerType LayoutEmbeddedObject::layerTypeRequired() const
55 { 54 {
56 // This can't just use LayoutPart::layerTypeRequired, because PaintLayerComp ositor 55 // This can't just use LayoutPart::layerTypeRequired, because PaintLayerComp ositor
57 // doesn't loop through LayoutEmbeddedObjects the way it does frames in orde r 56 // doesn't loop through LayoutEmbeddedObjects the way it does frames in orde r
58 // to update the self painting bit on their Layer. 57 // to update the self painting bit on their Layer.
59 // Also, unlike iframes, embeds don't used the usesCompositing bit on Layout View 58 // Also, unlike iframes, embeds don't used the usesCompositing bit on Layout View
60 // in requiresAcceleratedCompositing. 59 // in requiresAcceleratedCompositing.
61 if (requiresAcceleratedCompositing()) 60 if (requiresAcceleratedCompositing())
62 return NormalPaintLayer; 61 return NormalPaintLayer;
63 return LayoutPart::layerTypeRequired(); 62 return LayoutPart::layerTypeRequired();
64 } 63 }
65 64
66 static String localizedUnavailablePluginReplacementText(Node* node, LayoutEmbedd edObject::PluginUnavailabilityReason pluginUnavailabilityReason) 65 static String localizedUnavailablePluginReplacementText(Node* node, LayoutEmbedd edObject::PluginAvailability availability)
67 { 66 {
68 Locale& locale = node ? toElement(node)->locale() : Locale::defaultLocale(); 67 Locale& locale = node ? toElement(node)->locale() : Locale::defaultLocale();
69 switch (pluginUnavailabilityReason) { 68 switch (availability) {
69 case LayoutEmbeddedObject::PluginAvailable:
70 break;
70 case LayoutEmbeddedObject::PluginMissing: 71 case LayoutEmbeddedObject::PluginMissing:
71 return locale.queryString(WebLocalizedString::MissingPluginText); 72 return locale.queryString(WebLocalizedString::MissingPluginText);
72 case LayoutEmbeddedObject::PluginBlockedByContentSecurityPolicy: 73 case LayoutEmbeddedObject::PluginBlockedByContentSecurityPolicy:
73 return locale.queryString(WebLocalizedString::BlockedPluginText); 74 return locale.queryString(WebLocalizedString::BlockedPluginText);
74 } 75 }
75 76 NOTREACHED();
76 ASSERT_NOT_REACHED();
77 return String(); 77 return String();
78 } 78 }
79 79
80 void LayoutEmbeddedObject::setPluginUnavailabilityReason(PluginUnavailabilityRea son pluginUnavailabilityReason) 80 void LayoutEmbeddedObject::setPluginAvailability(PluginAvailability availability )
81 { 81 {
82 ASSERT(!m_showsUnavailablePluginIndicator); 82 DCHECK_EQ(PluginAvailable, m_pluginAvailability);
83 m_showsUnavailablePluginIndicator = true; 83 m_pluginAvailability = availability;
84 m_pluginUnavailabilityReason = pluginUnavailabilityReason;
85 84
86 m_unavailablePluginReplacementText = localizedUnavailablePluginReplacementTe xt(node(), pluginUnavailabilityReason); 85 m_unavailablePluginReplacementText = localizedUnavailablePluginReplacementTe xt(node(), availability);
87 86
88 // node() is nullptr when LayoutPart is being destroyed. 87 // node() is nullptr when LayoutPart is being destroyed.
89 if (node()) 88 if (node())
90 setShouldDoFullPaintInvalidation(); 89 setShouldDoFullPaintInvalidation();
91 } 90 }
92 91
93 bool LayoutEmbeddedObject::showsUnavailablePluginIndicator() const 92 bool LayoutEmbeddedObject::showsUnavailablePluginIndicator() const
94 { 93 {
95 return m_showsUnavailablePluginIndicator; 94 return m_pluginAvailability != PluginAvailable;
96 } 95 }
97 96
98 void LayoutEmbeddedObject::paintContents(const PaintInfo& paintInfo, const Layou tPoint& paintOffset) const 97 void LayoutEmbeddedObject::paintContents(const PaintInfo& paintInfo, const Layou tPoint& paintOffset) const
99 { 98 {
100 Element* element = toElement(node()); 99 Element* element = toElement(node());
101 if (!isHTMLPlugInElement(element)) 100 if (!isHTMLPlugInElement(element))
102 return; 101 return;
103 102
104 LayoutPart::paintContents(paintInfo, paintOffset); 103 LayoutPart::paintContents(paintInfo, paintOffset);
105 } 104 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 } 162 }
164 163
165 LayoutReplaced* LayoutEmbeddedObject::embeddedReplacedContent() const 164 LayoutReplaced* LayoutEmbeddedObject::embeddedReplacedContent() const
166 { 165 {
167 if (!node() || !widget() || !widget()->isFrameView()) 166 if (!node() || !widget() || !widget()->isFrameView())
168 return nullptr; 167 return nullptr;
169 return toFrameView(widget())->embeddedReplacedContent(); 168 return toFrameView(widget())->embeddedReplacedContent();
170 } 169 }
171 170
172 } // namespace blink 171 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698