145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/*
245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org *           (C) 2000 Simon Hausmann <hausmann@kde.org>
445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org *           (C) 2000 Stefan Schimanski (1Stein@gmx.de)
5a1b5233e6d340f45f4846131fec9d0b92e203ce4hbono@chromium.org * Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010 Apple Inc. All rights reserved.
645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org *
745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * This library is free software; you can redistribute it and/or
845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * modify it under the terms of the GNU Library General Public
945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * License as published by the Free Software Foundation; either
1045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * version 2 of the License, or (at your option) any later version.
1145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org *
1245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * This library is distributed in the hope that it will be useful,
1345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * but WITHOUT ANY WARRANTY; without even the implied warranty of
1445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * Library General Public License for more details.
1645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org *
1745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * You should have received a copy of the GNU Library General Public License
1845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * along with this library; see the file COPYING.LIB.  If not, write to
1945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
2045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * Boston, MA 02110-1301, USA.
2145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org *
2245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */
2345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
2445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#include "config.h"
2545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#include "core/rendering/RenderEmbeddedObject.h"
2645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
2745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#include "core/CSSValueKeywords.h"
2845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#include "core/HTMLNames.h"
2945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#include "core/frame/LocalFrame.h"
3045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#include "core/html/HTMLIFrameElement.h"
3145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#include "core/html/HTMLPlugInElement.h"
3245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#include "core/page/Page.h"
3345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#include "core/frame/Settings.h"
3445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#include "core/plugins/PluginView.h"
3545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#include "core/rendering/PaintInfo.h"
3645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#include "core/rendering/RenderTheme.h"
3745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#include "core/rendering/RenderView.h"
3845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#include "platform/fonts/Font.h"
3945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#include "platform/fonts/FontSelector.h"
4045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#include "platform/graphics/GraphicsContextStateSaver.h"
4145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#include "platform/graphics/Path.h"
4245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#include "platform/text/PlatformLocale.h"
4345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#include "platform/text/TextRun.h"
4445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
4545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgnamespace blink {
4645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
4745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgusing namespace HTMLNames;
4845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
4945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgstatic const float replacementTextRoundedRectHeight = 18;
5045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgstatic const float replacementTextRoundedRectLeftRightTextMargin = 6;
5145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgstatic const float replacementTextRoundedRectOpacity = 0.20f;
5245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgstatic const float replacementTextRoundedRectRadius = 5;
5345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgstatic const float replacementTextTextOpacity = 0.55f;
5445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
5545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgRenderEmbeddedObject::RenderEmbeddedObject(Element* element)
5645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    : RenderPart(element)
5745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    , m_showsUnavailablePluginIndicator(false)
5845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org{
5945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    view()->frameView()->setIsVisuallyNonEmpty();
6045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org}
6145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
6245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgRenderEmbeddedObject::~RenderEmbeddedObject()
6345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org{
6445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org}
6545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
6645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgLayerType RenderEmbeddedObject::layerTypeRequired() const
67a1b5233e6d340f45f4846131fec9d0b92e203ce4hbono@chromium.org{
6845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    // This can't just use RenderPart::layerTypeRequired, because RenderLayerCompositor
6945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    // doesn't loop through RenderEmbeddedObjects the way it does frames in order
7045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    // to update the self painting bit on their RenderLayer.
7145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    // Also, unlike iframes, embeds don't used the usesCompositing bit on RenderView
7245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    // in requiresAcceleratedCompositing.
7345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if (requiresAcceleratedCompositing())
7445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        return NormalLayer;
7545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    return RenderPart::layerTypeRequired();
7645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org}
77a1b5233e6d340f45f4846131fec9d0b92e203ce4hbono@chromium.org
7845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgstatic String unavailablePluginReplacementText(Node* node, RenderEmbeddedObject::PluginUnavailabilityReason pluginUnavailabilityReason)
7945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org{
8045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    Locale& locale = node ? toElement(node)->locale() : Locale::defaultLocale();
8145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    switch (pluginUnavailabilityReason) {
8245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    case RenderEmbeddedObject::PluginMissing:
8345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        return locale.queryString(WebLocalizedString::MissingPluginText);
8445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    case RenderEmbeddedObject::PluginBlockedByContentSecurityPolicy:
8545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        return locale.queryString(WebLocalizedString::BlockedPluginText);
8645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    }
8745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
8845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    ASSERT_NOT_REACHED();
8945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    return String();
9045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org}
9145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
9245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgvoid RenderEmbeddedObject::setPluginUnavailabilityReason(PluginUnavailabilityReason pluginUnavailabilityReason)
9345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org{
9445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    ASSERT(!m_showsUnavailablePluginIndicator);
9545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    m_showsUnavailablePluginIndicator = true;
9645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    m_pluginUnavailabilityReason = pluginUnavailabilityReason;
9745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
9845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    m_unavailablePluginReplacementText = unavailablePluginReplacementText(node(), pluginUnavailabilityReason);
9945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org}
10045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
10145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgbool RenderEmbeddedObject::showsUnavailablePluginIndicator() const
10245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org{
103a1b5233e6d340f45f4846131fec9d0b92e203ce4hbono@chromium.org    return m_showsUnavailablePluginIndicator;
10445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org}
10545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
10645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgvoid RenderEmbeddedObject::paintContents(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
10745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org{
10845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    Element* element = toElement(node());
10945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if (!isHTMLPlugInElement(element))
11045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        return;
111a1b5233e6d340f45f4846131fec9d0b92e203ce4hbono@chromium.org
11245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    RenderPart::paintContents(paintInfo, paintOffset);
11345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org}
11445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
11545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgvoid RenderEmbeddedObject::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
116a1b5233e6d340f45f4846131fec9d0b92e203ce4hbono@chromium.org{
117a1b5233e6d340f45f4846131fec9d0b92e203ce4hbono@chromium.org    if (showsUnavailablePluginIndicator()) {
118a1b5233e6d340f45f4846131fec9d0b92e203ce4hbono@chromium.org        RenderReplaced::paint(paintInfo, paintOffset);
11945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        return;
12045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    }
12145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
12245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    RenderPart::paint(paintInfo, paintOffset);
12345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org}
12445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
12545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgvoid RenderEmbeddedObject::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
12645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org{
12745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if (!showsUnavailablePluginIndicator())
12845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        return;
12945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
13045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if (paintInfo.phase == PaintPhaseSelection)
13145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        return;
13245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
13345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    FloatRect contentRect;
13445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    Path path;
13545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    FloatRect replacementTextRect;
13645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    Font font;
13745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    TextRun run("");
13845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    float textWidth;
13945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if (!getReplacementTextGeometry(paintOffset, contentRect, path, replacementTextRect, font, run, textWidth))
14045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        return;
14145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
14245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    GraphicsContext* context = paintInfo.context;
14345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    GraphicsContextStateSaver stateSaver(*context);
14445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    context->clip(contentRect);
14545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    context->setAlphaAsFloat(replacementTextRoundedRectOpacity);
14645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    context->setFillColor(Color::white);
14745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    context->fillPath(path);
14845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
14945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    const FontMetrics& fontMetrics = font.fontMetrics();
15045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    float labelX = roundf(replacementTextRect.location().x() + (replacementTextRect.size().width() - textWidth) / 2);
15145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    float labelY = roundf(replacementTextRect.location().y() + (replacementTextRect.size().height() - fontMetrics.height()) / 2 + fontMetrics.ascent());
15245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    TextRunPaintInfo runInfo(run);
15345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    runInfo.bounds = replacementTextRect;
15445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    context->setAlphaAsFloat(replacementTextTextOpacity);
15545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    context->setFillColor(Color::black);
15645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    context->drawBidiText(font, runInfo, FloatPoint(labelX, labelY));
15745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org}
15845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
15945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgbool RenderEmbeddedObject::getReplacementTextGeometry(const LayoutPoint& accumulatedOffset, FloatRect& contentRect, Path& path, FloatRect& replacementTextRect, Font& font, TextRun& run, float& textWidth) const
16045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org{
16145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    contentRect = contentBoxRect();
16245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    contentRect.moveBy(roundedIntPoint(accumulatedOffset));
16345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
16445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    FontDescription fontDescription;
16545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    RenderTheme::theme().systemFont(CSSValueWebkitSmallControl, fontDescription);
16645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fontDescription.setWeight(FontWeightBold);
16745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    Settings* settings = document().settings();
16845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    ASSERT(settings);
16945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if (!settings)
17045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        return false;
17145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fontDescription.setComputedSize(fontDescription.specifiedSize());
17245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    font = Font(fontDescription);
17345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    font.update(nullptr);
17445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
17545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    run = TextRun(m_unavailablePluginReplacementText);
17645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    textWidth = font.width(run);
17745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
17845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    replacementTextRect.setSize(FloatSize(textWidth + replacementTextRoundedRectLeftRightTextMargin * 2, replacementTextRoundedRectHeight));
17945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    float x = (contentRect.size().width() / 2 - replacementTextRect.size().width() / 2) + contentRect.location().x();
18045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    float y = (contentRect.size().height() / 2 - replacementTextRect.size().height() / 2) + contentRect.location().y();
18145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    replacementTextRect.setLocation(FloatPoint(x, y));
18245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
18345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    path.addRoundedRect(replacementTextRect, FloatSize(replacementTextRoundedRectRadius, replacementTextRoundedRectRadius));
18445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
18545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    return true;
18645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org}
18745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
18845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgvoid RenderEmbeddedObject::layout()
18945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org{
19045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    ASSERT(needsLayout());
19145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
19245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    updateLogicalWidth();
19345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    updateLogicalHeight();
19445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
195a1b5233e6d340f45f4846131fec9d0b92e203ce4hbono@chromium.org    m_overflow.clear();
19645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    addVisualEffectOverflow();
19745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
19845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    updateLayerTransformAfterLayout();
199a1b5233e6d340f45f4846131fec9d0b92e203ce4hbono@chromium.org
20045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if (!widget() && frameView())
20145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        frameView()->addWidgetToUpdate(*this);
20245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
20345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    clearNeedsLayout();
20445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org}
20545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
20645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgbool RenderEmbeddedObject::scroll(ScrollDirection direction, ScrollGranularity granularity, float)
20745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org{
20845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    return false;
20945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org}
21045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
21145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgCompositingReasons RenderEmbeddedObject::additionalCompositingReasons() const
21245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org{
21345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if (requiresAcceleratedCompositing())
21445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        return CompositingReasonPlugin;
21545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    return CompositingReasonNone;
21645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org}
21745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
21845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgRenderBox* RenderEmbeddedObject::embeddedContentBox() const
21945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org{
22045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if (!node() || !widget() || !widget()->isFrameView())
22145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        return 0;
22245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    return toFrameView(widget())->embeddedContentBox();
22345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org}
22445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
22545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org} // namespace blink
22645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org