Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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::PluginUnavailabilityReason pluginUnavailabilityReason) |
| 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 (pluginUnavailabilityReason) { |
| 69 case LayoutEmbeddedObject::PluginAvailable: | |
| 70 NOTREACHED(); | |
| 71 return String(); | |
| 70 case LayoutEmbeddedObject::PluginMissing: | 72 case LayoutEmbeddedObject::PluginMissing: |
| 71 return locale.queryString(WebLocalizedString::MissingPluginText); | 73 return locale.queryString(WebLocalizedString::MissingPluginText); |
| 72 case LayoutEmbeddedObject::PluginBlockedByContentSecurityPolicy: | 74 case LayoutEmbeddedObject::PluginBlockedByContentSecurityPolicy: |
| 73 return locale.queryString(WebLocalizedString::BlockedPluginText); | 75 return locale.queryString(WebLocalizedString::BlockedPluginText); |
| 74 } | 76 } |
|
kochi
2016/07/21 02:09:56
It seems compilers are complaining that on cases n
tkent
2016/07/21 02:21:07
Try bots are red because of other reasons, I think
kochi
2016/07/21 02:27:21
See this, for this case.
https://build.chromium.or
tkent
2016/07/21 04:08:25
Oh, you're right. Thank you.
| |
| 75 | |
| 76 ASSERT_NOT_REACHED(); | |
| 77 return String(); | |
| 78 } | 77 } |
| 79 | 78 |
| 80 void LayoutEmbeddedObject::setPluginUnavailabilityReason(PluginUnavailabilityRea son pluginUnavailabilityReason) | 79 void LayoutEmbeddedObject::setPluginUnavailabilityReason(PluginUnavailabilityRea son pluginUnavailabilityReason) |
| 81 { | 80 { |
| 82 ASSERT(!m_showsUnavailablePluginIndicator); | 81 DCHECK_EQ(PluginAvailable, m_pluginUnavailabilityReason); |
| 83 m_showsUnavailablePluginIndicator = true; | |
| 84 m_pluginUnavailabilityReason = pluginUnavailabilityReason; | 82 m_pluginUnavailabilityReason = pluginUnavailabilityReason; |
| 85 | 83 |
| 86 m_unavailablePluginReplacementText = localizedUnavailablePluginReplacementTe xt(node(), pluginUnavailabilityReason); | 84 m_unavailablePluginReplacementText = localizedUnavailablePluginReplacementTe xt(node(), pluginUnavailabilityReason); |
| 87 | 85 |
| 88 // node() is nullptr when LayoutPart is being destroyed. | 86 // node() is nullptr when LayoutPart is being destroyed. |
| 89 if (node()) | 87 if (node()) |
| 90 setShouldDoFullPaintInvalidation(); | 88 setShouldDoFullPaintInvalidation(); |
| 91 } | 89 } |
| 92 | 90 |
| 93 bool LayoutEmbeddedObject::showsUnavailablePluginIndicator() const | 91 bool LayoutEmbeddedObject::showsUnavailablePluginIndicator() const |
| 94 { | 92 { |
| 95 return m_showsUnavailablePluginIndicator; | 93 return m_pluginUnavailabilityReason != PluginAvailable; |
| 96 } | 94 } |
| 97 | 95 |
| 98 void LayoutEmbeddedObject::paintContents(const PaintInfo& paintInfo, const Layou tPoint& paintOffset) const | 96 void LayoutEmbeddedObject::paintContents(const PaintInfo& paintInfo, const Layou tPoint& paintOffset) const |
| 99 { | 97 { |
| 100 Element* element = toElement(node()); | 98 Element* element = toElement(node()); |
| 101 if (!isHTMLPlugInElement(element)) | 99 if (!isHTMLPlugInElement(element)) |
| 102 return; | 100 return; |
| 103 | 101 |
| 104 LayoutPart::paintContents(paintInfo, paintOffset); | 102 LayoutPart::paintContents(paintInfo, paintOffset); |
| 105 } | 103 } |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 163 } | 161 } |
| 164 | 162 |
| 165 LayoutReplaced* LayoutEmbeddedObject::embeddedReplacedContent() const | 163 LayoutReplaced* LayoutEmbeddedObject::embeddedReplacedContent() const |
| 166 { | 164 { |
| 167 if (!node() || !widget() || !widget()->isFrameView()) | 165 if (!node() || !widget() || !widget()->isFrameView()) |
| 168 return nullptr; | 166 return nullptr; |
| 169 return toFrameView(widget())->embeddedReplacedContent(); | 167 return toFrameView(widget())->embeddedReplacedContent(); |
| 170 } | 168 } |
| 171 | 169 |
| 172 } // namespace blink | 170 } // namespace blink |
| OLD | NEW |