Commit 49288012 authored by ch.dumez@samsung.com's avatar ch.dumez@samsung.com

Add isHTMLPlugInElement() helpers for consistency with other HTML elements

Add isHTMLPlugInElement() helpers for consistency with other HTML elements.
Those helpers rely on the isPluginElement() virtual function to check if
an Element is an HTMLPlugInElement.

R=tkent, adamk
BUG=346095

Review URL: https://codereview.chromium.org/202153005

git-svn-id: svn://svn.chromium.org/blink/trunk@169589 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent e9572388
......@@ -245,7 +245,6 @@ public:
virtual bool isAttributeNode() const { return false; }
virtual bool isCharacterDataNode() const { return false; }
virtual bool isFrameOwnerElement() const { return false; }
virtual bool isPluginElement() const { return false; }
// StyledElements allow inline style (style="border: 1px"), presentational attributes (ex. color),
// class names (ex. class="foo bar") and other non-basic styling features. They and also control
......
......@@ -79,6 +79,7 @@ public:
TextDirection directionalityIfhasDirAutoAttribute(bool& isAuto) const;
virtual bool isHTMLUnknownElement() const { return false; }
virtual bool isPluginElement() const { return false; }
virtual bool isLabelable() const { return false; }
// http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#interactive-content
......
......@@ -98,7 +98,6 @@ private:
virtual void attach(const AttachContext& = AttachContext()) OVERRIDE FINAL;
virtual void detach(const AttachContext& = AttachContext()) OVERRIDE FINAL;
virtual void finishParsingChildren() OVERRIDE FINAL;
virtual bool isPluginElement() const OVERRIDE FINAL;
// Element functions:
virtual RenderObject* createRenderer(RenderStyle*) OVERRIDE;
......@@ -111,6 +110,7 @@ private:
// HTMLElement function:
virtual bool hasCustomFocusLogic() const OVERRIDE;
virtual bool isPluginElement() const OVERRIDE FINAL;
// Return any existing RenderWidget without triggering relayout, or 0 if it
// doesn't yet exist.
......@@ -138,7 +138,17 @@ private:
DisplayState m_displayState;
};
DEFINE_ELEMENT_TYPE_CASTS(HTMLPlugInElement, isPluginElement());
inline bool isHTMLPlugInElement(const Element& element)
{
return element.isHTMLElement() && toHTMLElement(element).isPluginElement();
}
inline bool isHTMLPlugInElement(const HTMLElement& element)
{
return element.isPluginElement();
}
DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLPlugInElement);
} // namespace WebCore
......
......@@ -38,6 +38,7 @@
#include "core/frame/LocalFrame.h"
#include "core/html/HTMLFormElement.h"
#include "core/html/HTMLHtmlElement.h"
#include "core/html/HTMLPlugInElement.h"
#include "core/html/HTMLScriptElement.h"
#include "core/html/HTMLTemplateElement.h"
#include "core/html/parser/AtomicHTMLToken.h"
......@@ -274,7 +275,7 @@ void HTMLConstructionSite::queueTask(const HTMLConstructionSiteTask& task)
void HTMLConstructionSite::attachLater(ContainerNode* parent, PassRefPtr<Node> prpChild, bool selfClosing)
{
ASSERT(scriptingContentIsAllowed(m_parserContentPolicy) || !prpChild.get()->isElementNode() || !toScriptLoaderIfPossible(toElement(prpChild.get())));
ASSERT(pluginContentIsAllowed(m_parserContentPolicy) || !prpChild->isPluginElement());
ASSERT(pluginContentIsAllowed(m_parserContentPolicy) || !isHTMLPlugInElement(prpChild));
HTMLConstructionSiteTask task(HTMLConstructionSiteTask::Insert);
task.parent = parent;
......
......@@ -554,7 +554,7 @@ bool DragController::canProcessDrag(DragData* dragData)
if (dragData->containsFiles() && asFileInput(result.innerNonSharedNode()))
return true;
if (result.innerNonSharedNode()->isPluginElement()) {
if (isHTMLPlugInElement(*result.innerNonSharedNode())) {
HTMLPlugInElement* plugin = toHTMLPlugInElement(result.innerNonSharedNode());
if (!plugin->canProcessDrag() && !result.innerNonSharedNode()->rendererIsEditable())
return false;
......
......@@ -47,6 +47,7 @@
#include "core/frame/LocalFrame.h"
#include "core/html/HTMLAreaElement.h"
#include "core/html/HTMLImageElement.h"
#include "core/html/HTMLPlugInElement.h"
#include "core/html/HTMLShadowElement.h"
#include "core/page/Chrome.h"
#include "core/page/ChromeClient.h"
......@@ -382,7 +383,7 @@ bool FocusController::advanceFocusInDocumentOrder(FocusType type, bool initialFo
return false;
Element* element = toElement(node);
if (element->isFrameOwnerElement() && (!element->isPluginElement() || !element->isKeyboardFocusable())) {
if (element->isFrameOwnerElement() && (!isHTMLPlugInElement(*element) || !element->isKeyboardFocusable())) {
// We focus frames rather than frame owners.
// FIXME: We should not focus frames that have no scrollbars, as focusing them isn't useful to the user.
HTMLFrameOwnerElement* owner = toHTMLFrameOwnerElement(element);
......
......@@ -28,6 +28,7 @@
#include "HTMLNames.h"
#include "core/frame/LocalFrame.h"
#include "core/html/HTMLIFrameElement.h"
#include "core/html/HTMLPlugInElement.h"
#include "core/page/Page.h"
#include "core/frame/Settings.h"
#include "core/plugins/PluginView.h"
......@@ -109,7 +110,7 @@ bool RenderEmbeddedObject::showsUnavailablePluginIndicator() const
void RenderEmbeddedObject::paintContents(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
Element* element = toElement(node());
if (!element || !element->isPluginElement())
if (!isHTMLPlugInElement(element))
return;
RenderPart::paintContents(paintInfo, paintOffset);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment