| 1 | /* |
|---|
| 2 | * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
|---|
| 3 | * (C) 2000 Simon Hausmann <hausmann@kde.org> |
|---|
| 4 | * (C) 2000 Stefan Schimanski (1Stein@gmx.de) |
|---|
| 5 | * Copyright (C) 2004, 2005, 2006, 2008, 2009 Apple Inc. All rights reserved. |
|---|
| 6 | * |
|---|
| 7 | * This library is free software; you can redistribute it and/or |
|---|
| 8 | * modify it under the terms of the GNU Library General Public |
|---|
| 9 | * License as published by the Free Software Foundation; either |
|---|
| 10 | * version 2 of the License, or (at your option) any later version. |
|---|
| 11 | * |
|---|
| 12 | * This library is distributed in the hope that it will be useful, |
|---|
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 15 | * Library General Public License for more details. |
|---|
| 16 | * |
|---|
| 17 | * You should have received a copy of the GNU Library General Public License |
|---|
| 18 | * along with this library; see the file COPYING.LIB. If not, write to |
|---|
| 19 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
|---|
| 20 | * Boston, MA 02110-1301, USA. |
|---|
| 21 | * |
|---|
| 22 | */ |
|---|
| 23 | |
|---|
| 24 | #include "config.h" |
|---|
| 25 | #include "RenderPartObject.h" |
|---|
| 26 | |
|---|
| 27 | #include "Frame.h" |
|---|
| 28 | #include "FrameLoaderClient.h" |
|---|
| 29 | #include "HTMLEmbedElement.h" |
|---|
| 30 | #include "HTMLIFrameElement.h" |
|---|
| 31 | #include "HTMLNames.h" |
|---|
| 32 | #include "HTMLObjectElement.h" |
|---|
| 33 | #include "HTMLParamElement.h" |
|---|
| 34 | #include "MIMETypeRegistry.h" |
|---|
| 35 | #include "Page.h" |
|---|
| 36 | #include "RenderView.h" |
|---|
| 37 | #include "RenderWidgetProtector.h" |
|---|
| 38 | #include "Text.h" |
|---|
| 39 | |
|---|
| 40 | #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) |
|---|
| 41 | #include "HTMLVideoElement.h" |
|---|
| 42 | #endif |
|---|
| 43 | |
|---|
| 44 | namespace WebCore { |
|---|
| 45 | |
|---|
| 46 | using namespace HTMLNames; |
|---|
| 47 | |
|---|
| 48 | RenderPartObject::RenderPartObject(Element* element) |
|---|
| 49 | : RenderPart(element) |
|---|
| 50 | { |
|---|
| 51 | } |
|---|
| 52 | |
|---|
| 53 | void RenderPartObject::layout() |
|---|
| 54 | { |
|---|
| 55 | ASSERT(needsLayout()); |
|---|
| 56 | |
|---|
| 57 | calcWidth(); |
|---|
| 58 | calcHeight(); |
|---|
| 59 | |
|---|
| 60 | RenderPart::layout(); |
|---|
| 61 | |
|---|
| 62 | m_overflow.clear(); |
|---|
| 63 | addShadowOverflow(); |
|---|
| 64 | |
|---|
| 65 | setNeedsLayout(false); |
|---|
| 66 | } |
|---|
| 67 | |
|---|
| 68 | void RenderPartObject::viewCleared() |
|---|
| 69 | { |
|---|
| 70 | if (node() && widget() && widget()->isFrameView()) { |
|---|
| 71 | FrameView* view = static_cast<FrameView*>(widget()); |
|---|
| 72 | int marginw = -1; |
|---|
| 73 | int marginh = -1; |
|---|
| 74 | if (node()->hasTagName(iframeTag)) { |
|---|
| 75 | HTMLIFrameElement* frame = static_cast<HTMLIFrameElement*>(node()); |
|---|
| 76 | marginw = frame->getMarginWidth(); |
|---|
| 77 | marginh = frame->getMarginHeight(); |
|---|
| 78 | } |
|---|
| 79 | if (marginw != -1) |
|---|
| 80 | view->setMarginWidth(marginw); |
|---|
| 81 | if (marginh != -1) |
|---|
| 82 | view->setMarginHeight(marginh); |
|---|
| 83 | } |
|---|
| 84 | } |
|---|
| 85 | |
|---|
| 86 | } |
|---|