2006-05-12  Eric Seidel  <eseidel@apple.com>

        Reviewed by mjs.

        Split render_frames.* render_replaced.* and html_baseimpl.* into separate files (one class per file).
        http://bugzilla.opendarwin.org/show_bug.cgi?id=8878

        * WebCore.xcodeproj/project.pbxproj:
        * bindings/js/kjs_html.cpp:
        (KJS::JSHTMLDocumentProtoFunc::callAsFunction):
        (KJS::JSHTMLDocument::namedItemGetter):
        (KJS::JSHTMLDocument::getValueProperty):
        (KJS::JSHTMLDocument::getOwnPropertySlot):
        (KJS::JSHTMLDocument::putValueProperty):
        (KJS::JSHTMLElement::formIndexGetter):
        (KJS::JSHTMLElement::formNameGetter):
        (KJS::JSHTMLElement::selectIndexGetter):
        (KJS::JSHTMLElement::framesetNameGetter):
        (KJS::JSHTMLElement::runtimeObjectGetter):
        (KJS::JSHTMLElement::runtimeObjectPropertyGetter):
        (KJS::JSHTMLElement::getOwnPropertySlot):
        (KJS::JSHTMLElement::implementsCall):
        (KJS::JSHTMLElement::callAsFunction):
        (KJS::JSHTMLElement::getValueProperty):
        (KJS::JSHTMLElement::toString):
        (KJS::getForm):
        (KJS::JSHTMLElement::pushEventHandlerScope):
        (KJS::HTMLElementFunction::callAsFunction):
        (KJS::JSHTMLElement::put):
        (KJS::JSHTMLElement::selectSetter):
        (KJS::JSHTMLElement::putValueProperty):
        (KJS::toHTMLElement):
        (KJS::toHTMLTableCaptionElement):
        (KJS::toHTMLTableSectionElement):
        (KJS::JSHTMLCollection::lengthGetter):
        (KJS::JSHTMLCollection::indexGetter):
        (KJS::JSHTMLCollection::nameGetter):
        (KJS::JSHTMLCollection::getOwnPropertySlot):
        (KJS::HTMLCollectionProtoFunc::callAsFunction):
        (KJS::JSHTMLSelectCollection::selectedIndexGetter):
        (KJS::JSHTMLSelectCollection::put):
        (KJS::OptionConstructorImp::construct):
        (KJS::getSelectHTMLCollection):
        * bindings/objc/DOMHTML.mm:
        * bridge/mac/FrameMac.mm:
        (WebCore::FrameMac::createFrame):
        * bridge/mac/WebCoreFrameBridge.mm:
        (-[WebCoreFrameBridge copyRenderNode:copier:]):
        * dom/Document.cpp:
        (WebCore::widgetForNode):
        * html/HTMLBodyElement.cpp: Added.
        (WebCore::HTMLBodyElement::HTMLBodyElement):
        (WebCore::HTMLBodyElement::parseMappedAttribute):
        * html/HTMLBodyElement.h: Added.
        * html/HTMLDocument.cpp:
        * html/HTMLElementFactory.cpp:
        * html/HTMLEmbedElement.cpp:
        * html/HTMLFrameElement.cpp: Added.
        (WebCore::HTMLFrameElement::isURLAllowed):
        (WebCore::HTMLFrameElement::parseMappedAttribute):
        (WebCore::HTMLFrameElement::setLocation):
        * html/HTMLFrameElement.h: Added.
        * html/HTMLFrameSetElement.cpp: Added.
        (WebCore::HTMLFrameSetElement::HTMLFrameSetElement):
        (WebCore::HTMLFrameSetElement::parseMappedAttribute):
        (WebCore::HTMLFrameSetElement::attach):
        (WebCore::HTMLFrameSetElement::defaultEventHandler):
        (WebCore::HTMLFrameSetElement::recalcStyle):
        * html/HTMLFrameSetElement.h: Added.
        * html/HTMLHeadElement.cpp: Added.
        (WebCore::HTMLHeadElement::HTMLHeadElement):
        * html/HTMLHeadElement.h: Added.
        * html/HTMLHtmlElement.cpp: Added.
        (WebCore::HTMLHtmlElement::HTMLHtmlElement):
        * html/HTMLHtmlElement.h: Added.
        * html/HTMLIFrameElement.cpp: Added.
        (WebCore::HTMLIFrameElement::HTMLIFrameElement):
        * html/HTMLIFrameElement.h: Added.
        * html/HTMLObjectElement.cpp:
        * html/HTMLParser.cpp:
        * html/html_baseimpl.cpp: Removed.
        * html/html_baseimpl.h: Removed.
        * kwq/WebCoreAXObject.mm:
        * page/Frame.cpp:
        (WebCore::isFrameElement):
        (WebCore::Frame::applyEditingStyleToBodyElement):
        (WebCore::Frame::removeEditingStyleFromBodyElement):
        (WebCore::Frame::applyEditingStyleToElement):
        (WebCore::Frame::removeEditingStyleFromElement):
        (WebCore::Frame::selectionRect):
        (WebCore::Frame::isFrameSet):
        (WebCore::scanForForm):
        (WebCore::Frame::currentForm):
        (WebCore::Frame::nodeInfoAtPoint):
        (WebCore::Frame::adjustPageHeight):
        (WebCore::Frame::frameForWidget):
        (WebCore::Frame::forceLayoutWithPageWidthRange):
        (WebCore::Frame::passWidgetMouseDownEventToWidget):
        * page/FrameView.cpp:
        * rendering/RenderFrame.cpp: Added.
        (WebCore::RenderFrame::viewCleared):
        * rendering/RenderFrame.h: Added.
        * rendering/RenderFrameSet.cpp: Added.
        (WebCore::RenderFrameSet::RenderFrameSet):
        (WebCore::RenderFrameSet::~RenderFrameSet):
        (WebCore::RenderFrameSet::layout):
        (WebCore::RenderFrameSet::positionFrames):
        (WebCore::RenderFrameSet::userResize):
        (WebCore::RenderFrameSet::canResize):
        (WebCore::RenderFrameSet::dump):
        * rendering/RenderFrameSet.h: Added.
        * rendering/RenderImage.h:
        * rendering/RenderPart.cpp: Added.
        (WebCore::RenderPart::RenderPart):
        * rendering/RenderPart.h: Added.
        * rendering/RenderPartObject.cpp: Added.
        (WebCore::isURLAllowed):
        (WebCore::RenderPartObject::updateWidget):
        (WebCore::RenderPartObject::viewCleared):
        * rendering/RenderPartObject.h: Added.
        * rendering/RenderReplaced.cpp: Added.
        (WebCore::RenderReplaced::selectionColor):
        * rendering/RenderReplaced.h: Added.
        * rendering/RenderWidget.cpp: Added.
        (WebCore::RenderWidget::deleteWidget):
        * rendering/RenderWidget.h: Added.
        * rendering/render_form.h:
        * rendering/render_frames.cpp: Removed.
        * rendering/render_frames.h: Removed.
        * rendering/render_replaced.cpp: Removed.
        * rendering/render_replaced.h: Removed.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@14334 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 65900cd..4110623 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,5 +1,137 @@
 2006-05-12  Eric Seidel  <eseidel@apple.com>
 
+        Reviewed by mjs.
+
+        Split render_frames.* render_replaced.* and html_baseimpl.* into separate files (one class per file).
+        http://bugzilla.opendarwin.org/show_bug.cgi?id=8878
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/kjs_html.cpp:
+        (KJS::JSHTMLDocumentProtoFunc::callAsFunction):
+        (KJS::JSHTMLDocument::namedItemGetter):
+        (KJS::JSHTMLDocument::getValueProperty):
+        (KJS::JSHTMLDocument::getOwnPropertySlot):
+        (KJS::JSHTMLDocument::putValueProperty):
+        (KJS::JSHTMLElement::formIndexGetter):
+        (KJS::JSHTMLElement::formNameGetter):
+        (KJS::JSHTMLElement::selectIndexGetter):
+        (KJS::JSHTMLElement::framesetNameGetter):
+        (KJS::JSHTMLElement::runtimeObjectGetter):
+        (KJS::JSHTMLElement::runtimeObjectPropertyGetter):
+        (KJS::JSHTMLElement::getOwnPropertySlot):
+        (KJS::JSHTMLElement::implementsCall):
+        (KJS::JSHTMLElement::callAsFunction):
+        (KJS::JSHTMLElement::getValueProperty):
+        (KJS::JSHTMLElement::toString):
+        (KJS::getForm):
+        (KJS::JSHTMLElement::pushEventHandlerScope):
+        (KJS::HTMLElementFunction::callAsFunction):
+        (KJS::JSHTMLElement::put):
+        (KJS::JSHTMLElement::selectSetter):
+        (KJS::JSHTMLElement::putValueProperty):
+        (KJS::toHTMLElement):
+        (KJS::toHTMLTableCaptionElement):
+        (KJS::toHTMLTableSectionElement):
+        (KJS::JSHTMLCollection::lengthGetter):
+        (KJS::JSHTMLCollection::indexGetter):
+        (KJS::JSHTMLCollection::nameGetter):
+        (KJS::JSHTMLCollection::getOwnPropertySlot):
+        (KJS::HTMLCollectionProtoFunc::callAsFunction):
+        (KJS::JSHTMLSelectCollection::selectedIndexGetter):
+        (KJS::JSHTMLSelectCollection::put):
+        (KJS::OptionConstructorImp::construct):
+        (KJS::getSelectHTMLCollection):
+        * bindings/objc/DOMHTML.mm:
+        * bridge/mac/FrameMac.mm:
+        (WebCore::FrameMac::createFrame):
+        * bridge/mac/WebCoreFrameBridge.mm:
+        (-[WebCoreFrameBridge copyRenderNode:copier:]):
+        * dom/Document.cpp:
+        (WebCore::widgetForNode):
+        * html/HTMLBodyElement.cpp: Added.
+        (WebCore::HTMLBodyElement::HTMLBodyElement):
+        (WebCore::HTMLBodyElement::parseMappedAttribute):
+        * html/HTMLBodyElement.h: Added.
+        * html/HTMLDocument.cpp:
+        * html/HTMLElementFactory.cpp:
+        * html/HTMLEmbedElement.cpp:
+        * html/HTMLFrameElement.cpp: Added.
+        (WebCore::HTMLFrameElement::isURLAllowed):
+        (WebCore::HTMLFrameElement::parseMappedAttribute):
+        (WebCore::HTMLFrameElement::setLocation):
+        * html/HTMLFrameElement.h: Added.
+        * html/HTMLFrameSetElement.cpp: Added.
+        (WebCore::HTMLFrameSetElement::HTMLFrameSetElement):
+        (WebCore::HTMLFrameSetElement::parseMappedAttribute):
+        (WebCore::HTMLFrameSetElement::attach):
+        (WebCore::HTMLFrameSetElement::defaultEventHandler):
+        (WebCore::HTMLFrameSetElement::recalcStyle):
+        * html/HTMLFrameSetElement.h: Added.
+        * html/HTMLHeadElement.cpp: Added.
+        (WebCore::HTMLHeadElement::HTMLHeadElement):
+        * html/HTMLHeadElement.h: Added.
+        * html/HTMLHtmlElement.cpp: Added.
+        (WebCore::HTMLHtmlElement::HTMLHtmlElement):
+        * html/HTMLHtmlElement.h: Added.
+        * html/HTMLIFrameElement.cpp: Added.
+        (WebCore::HTMLIFrameElement::HTMLIFrameElement):
+        * html/HTMLIFrameElement.h: Added.
+        * html/HTMLObjectElement.cpp:
+        * html/HTMLParser.cpp:
+        * html/html_baseimpl.cpp: Removed.
+        * html/html_baseimpl.h: Removed.
+        * kwq/WebCoreAXObject.mm:
+        * page/Frame.cpp:
+        (WebCore::isFrameElement):
+        (WebCore::Frame::applyEditingStyleToBodyElement):
+        (WebCore::Frame::removeEditingStyleFromBodyElement):
+        (WebCore::Frame::applyEditingStyleToElement):
+        (WebCore::Frame::removeEditingStyleFromElement):
+        (WebCore::Frame::selectionRect):
+        (WebCore::Frame::isFrameSet):
+        (WebCore::scanForForm):
+        (WebCore::Frame::currentForm):
+        (WebCore::Frame::nodeInfoAtPoint):
+        (WebCore::Frame::adjustPageHeight):
+        (WebCore::Frame::frameForWidget):
+        (WebCore::Frame::forceLayoutWithPageWidthRange):
+        (WebCore::Frame::passWidgetMouseDownEventToWidget):
+        * page/FrameView.cpp:
+        * rendering/RenderFrame.cpp: Added.
+        (WebCore::RenderFrame::viewCleared):
+        * rendering/RenderFrame.h: Added.
+        * rendering/RenderFrameSet.cpp: Added.
+        (WebCore::RenderFrameSet::RenderFrameSet):
+        (WebCore::RenderFrameSet::~RenderFrameSet):
+        (WebCore::RenderFrameSet::layout):
+        (WebCore::RenderFrameSet::positionFrames):
+        (WebCore::RenderFrameSet::userResize):
+        (WebCore::RenderFrameSet::canResize):
+        (WebCore::RenderFrameSet::dump):
+        * rendering/RenderFrameSet.h: Added.
+        * rendering/RenderImage.h:
+        * rendering/RenderPart.cpp: Added.
+        (WebCore::RenderPart::RenderPart):
+        * rendering/RenderPart.h: Added.
+        * rendering/RenderPartObject.cpp: Added.
+        (WebCore::isURLAllowed):
+        (WebCore::RenderPartObject::updateWidget):
+        (WebCore::RenderPartObject::viewCleared):
+        * rendering/RenderPartObject.h: Added.
+        * rendering/RenderReplaced.cpp: Added.
+        (WebCore::RenderReplaced::selectionColor):
+        * rendering/RenderReplaced.h: Added.
+        * rendering/RenderWidget.cpp: Added.
+        (WebCore::RenderWidget::deleteWidget):
+        * rendering/RenderWidget.h: Added.
+        * rendering/render_form.h:
+        * rendering/render_frames.cpp: Removed.
+        * rendering/render_frames.h: Removed.
+        * rendering/render_replaced.cpp: Removed.
+        * rendering/render_replaced.h: Removed.
+
+2006-05-12  Eric Seidel  <eseidel@apple.com>
+
         Reviewed by beth.
 
         Split html_headimpl.* into separate files (one per class)
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 2207a4b..a59e16c 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -420,7 +420,6 @@
 		93EEC20409C2877700C515D1 /* CanvasPattern.h in Headers */ = {isa = PBXBuildFile; fileRef = 93EEC1F209C2877700C515D1 /* CanvasPattern.h */; };
 		93EEC26F09C3218000C515D1 /* CanvasPattern.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93EEC26E09C3218000C515D1 /* CanvasPattern.cpp */; };
 		93EEC27109C3218800C515D1 /* CanvasStyle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93EEC27009C3218800C515D1 /* CanvasStyle.cpp */; };
-		93F198E308245E59001E9ABC /* html_baseimpl.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D23802DE4396018635CA /* html_baseimpl.h */; };
 		93F198E408245E59001E9ABC /* html_blockimpl.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D23A02DE4396018635CA /* html_blockimpl.h */; };
 		93F198E508245E59001E9ABC /* HTMLDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D23C02DE4396018635CA /* HTMLDocument.h */; };
 		93F198E608245E59001E9ABC /* HTMLElement.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D23F02DE4396018635CA /* HTMLElement.h */; };
@@ -515,7 +514,6 @@
 		93F19A5608245E59001E9ABC /* DeprecatedValueListImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F587853C02DE375901EA4122 /* DeprecatedValueListImpl.cpp */; };
 		93F19A5D08245E59001E9ABC /* WebCoreImageRendererFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = F587854F02DE375901EA4122 /* WebCoreImageRendererFactory.m */; };
 		93F19A5F08245E59001E9ABC /* WebCoreViewFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = F587855502DE375901EA4122 /* WebCoreViewFactory.m */; };
-		93F19A8F08245E59001E9ABC /* html_baseimpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D23702DE4396018635CA /* html_baseimpl.cpp */; };
 		93F19A9008245E59001E9ABC /* html_blockimpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D23902DE4396018635CA /* html_blockimpl.cpp */; };
 		93F19A9108245E59001E9ABC /* HTMLDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D23B02DE4396018635CA /* HTMLDocument.cpp */; };
 		93F19A9208245E59001E9ABC /* HTMLElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D23E02DE4396018635CA /* HTMLElement.cpp */; };
@@ -681,6 +679,30 @@
 		A871DC280A15205700B12A68 /* HTMLTitleElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A871DC1C0A15205700B12A68 /* HTMLTitleElement.h */; };
 		A871DC290A15205700B12A68 /* HTMLTitleElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A871DC1D0A15205700B12A68 /* HTMLTitleElement.cpp */; };
 		A871DC2A0A15205700B12A68 /* HTMLBaseElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A871DC1E0A15205700B12A68 /* HTMLBaseElement.cpp */; };
+		A871DE230A152AC800B12A68 /* HTMLFrameElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A871DE170A152AC800B12A68 /* HTMLFrameElement.cpp */; };
+		A871DE240A152AC800B12A68 /* HTMLIFrameElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A871DE180A152AC800B12A68 /* HTMLIFrameElement.cpp */; };
+		A871DE250A152AC800B12A68 /* HTMLHeadElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A871DE190A152AC800B12A68 /* HTMLHeadElement.cpp */; };
+		A871DE260A152AC800B12A68 /* HTMLHtmlElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A871DE1A0A152AC800B12A68 /* HTMLHtmlElement.cpp */; };
+		A871DE270A152AC800B12A68 /* HTMLHtmlElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A871DE1B0A152AC800B12A68 /* HTMLHtmlElement.h */; };
+		A871DE280A152AC800B12A68 /* HTMLFrameSetElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A871DE1C0A152AC800B12A68 /* HTMLFrameSetElement.h */; };
+		A871DE290A152AC800B12A68 /* HTMLBodyElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A871DE1D0A152AC800B12A68 /* HTMLBodyElement.cpp */; };
+		A871DE2A0A152AC800B12A68 /* HTMLIFrameElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A871DE1E0A152AC800B12A68 /* HTMLIFrameElement.h */; };
+		A871DE2B0A152AC800B12A68 /* HTMLFrameElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A871DE1F0A152AC800B12A68 /* HTMLFrameElement.h */; };
+		A871DE2C0A152AC800B12A68 /* HTMLBodyElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A871DE200A152AC800B12A68 /* HTMLBodyElement.h */; };
+		A871DE2D0A152AC800B12A68 /* HTMLHeadElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A871DE210A152AC800B12A68 /* HTMLHeadElement.h */; };
+		A871DE2E0A152AC800B12A68 /* HTMLFrameSetElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A871DE220A152AC800B12A68 /* HTMLFrameSetElement.cpp */; };
+		A871DED00A1530C700B12A68 /* RenderPart.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A871DEC80A1530C700B12A68 /* RenderPart.cpp */; };
+		A871DED10A1530C700B12A68 /* RenderFrameSet.h in Headers */ = {isa = PBXBuildFile; fileRef = A871DEC90A1530C700B12A68 /* RenderFrameSet.h */; };
+		A871DED20A1530C700B12A68 /* RenderFrameSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A871DECA0A1530C700B12A68 /* RenderFrameSet.cpp */; };
+		A871DED30A1530C700B12A68 /* RenderFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = A871DECB0A1530C700B12A68 /* RenderFrame.h */; };
+		A871DED40A1530C700B12A68 /* RenderFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A871DECC0A1530C700B12A68 /* RenderFrame.cpp */; };
+		A871DED50A1530C700B12A68 /* RenderPartObject.h in Headers */ = {isa = PBXBuildFile; fileRef = A871DECD0A1530C700B12A68 /* RenderPartObject.h */; };
+		A871DED60A1530C700B12A68 /* RenderPartObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A871DECE0A1530C700B12A68 /* RenderPartObject.cpp */; };
+		A871DED70A1530C700B12A68 /* RenderPart.h in Headers */ = {isa = PBXBuildFile; fileRef = A871DECF0A1530C700B12A68 /* RenderPart.h */; };
+		A871DFE20A15376B00B12A68 /* RenderReplaced.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A871DFDE0A15376B00B12A68 /* RenderReplaced.cpp */; };
+		A871DFE30A15376B00B12A68 /* RenderReplaced.h in Headers */ = {isa = PBXBuildFile; fileRef = A871DFDF0A15376B00B12A68 /* RenderReplaced.h */; };
+		A871DFE40A15376B00B12A68 /* RenderWidget.h in Headers */ = {isa = PBXBuildFile; fileRef = A871DFE00A15376B00B12A68 /* RenderWidget.h */; };
+		A871DFE50A15376B00B12A68 /* RenderWidget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A871DFE10A15376B00B12A68 /* RenderWidget.cpp */; };
 		A88AD3860952486D001DD196 /* KRenderingDevice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C0FB54089701F700BA5114 /* KRenderingDevice.cpp */; };
 		A88AD3870952486D001DD196 /* KRenderingDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C0FB55089701F700BA5114 /* KRenderingDevice.h */; };
 		A88AD3880952486D001DD196 /* KRenderingFillPainter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C0FB59089701F700BA5114 /* KRenderingFillPainter.cpp */; };
@@ -1192,8 +1214,6 @@
 		BCEA4870097D93020094C9E4 /* RenderFlow.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA4831097D93020094C9E4 /* RenderFlow.h */; };
 		BCEA4871097D93020094C9E4 /* render_form.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA4832097D93020094C9E4 /* render_form.cpp */; };
 		BCEA4872097D93020094C9E4 /* render_form.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA4833097D93020094C9E4 /* render_form.h */; };
-		BCEA4873097D93020094C9E4 /* render_frames.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA4834097D93020094C9E4 /* render_frames.cpp */; };
-		BCEA4874097D93020094C9E4 /* render_frames.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA4835097D93020094C9E4 /* render_frames.h */; };
 		BCEA4875097D93020094C9E4 /* RenderImage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA4836097D93020094C9E4 /* RenderImage.cpp */; };
 		BCEA4876097D93020094C9E4 /* RenderImage.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA4837097D93020094C9E4 /* RenderImage.h */; };
 		BCEA4877097D93020094C9E4 /* RenderInline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA4838097D93020094C9E4 /* RenderInline.cpp */; };
@@ -1206,8 +1226,6 @@
 		BCEA487E097D93020094C9E4 /* render_list.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA483F097D93020094C9E4 /* render_list.h */; };
 		BCEA487F097D93020094C9E4 /* RenderObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA4840097D93020094C9E4 /* RenderObject.cpp */; };
 		BCEA4880097D93020094C9E4 /* RenderObject.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA4841097D93020094C9E4 /* RenderObject.h */; };
-		BCEA4881097D93020094C9E4 /* render_replaced.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA4842097D93020094C9E4 /* render_replaced.cpp */; };
-		BCEA4882097D93020094C9E4 /* render_replaced.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA4843097D93020094C9E4 /* render_replaced.h */; };
 		BCEA4883097D93020094C9E4 /* render_style.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA4844097D93020094C9E4 /* render_style.cpp */; };
 		BCEA4884097D93020094C9E4 /* render_style.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA4845097D93020094C9E4 /* render_style.h */; };
 		BCEA4887097D93020094C9E4 /* RenderThemeMac.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA4848097D93020094C9E4 /* RenderThemeMac.h */; };
@@ -2047,6 +2065,30 @@
 		A871DC1C0A15205700B12A68 /* HTMLTitleElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLTitleElement.h; sourceTree = "<group>"; };
 		A871DC1D0A15205700B12A68 /* HTMLTitleElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLTitleElement.cpp; sourceTree = "<group>"; };
 		A871DC1E0A15205700B12A68 /* HTMLBaseElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLBaseElement.cpp; sourceTree = "<group>"; };
+		A871DE170A152AC800B12A68 /* HTMLFrameElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLFrameElement.cpp; sourceTree = "<group>"; };
+		A871DE180A152AC800B12A68 /* HTMLIFrameElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLIFrameElement.cpp; sourceTree = "<group>"; };
+		A871DE190A152AC800B12A68 /* HTMLHeadElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLHeadElement.cpp; sourceTree = "<group>"; };
+		A871DE1A0A152AC800B12A68 /* HTMLHtmlElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLHtmlElement.cpp; sourceTree = "<group>"; };
+		A871DE1B0A152AC800B12A68 /* HTMLHtmlElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLHtmlElement.h; sourceTree = "<group>"; };
+		A871DE1C0A152AC800B12A68 /* HTMLFrameSetElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLFrameSetElement.h; sourceTree = "<group>"; };
+		A871DE1D0A152AC800B12A68 /* HTMLBodyElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLBodyElement.cpp; sourceTree = "<group>"; };
+		A871DE1E0A152AC800B12A68 /* HTMLIFrameElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLIFrameElement.h; sourceTree = "<group>"; };
+		A871DE1F0A152AC800B12A68 /* HTMLFrameElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLFrameElement.h; sourceTree = "<group>"; };
+		A871DE200A152AC800B12A68 /* HTMLBodyElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLBodyElement.h; sourceTree = "<group>"; };
+		A871DE210A152AC800B12A68 /* HTMLHeadElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLHeadElement.h; sourceTree = "<group>"; };
+		A871DE220A152AC800B12A68 /* HTMLFrameSetElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLFrameSetElement.cpp; sourceTree = "<group>"; };
+		A871DEC80A1530C700B12A68 /* RenderPart.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RenderPart.cpp; sourceTree = "<group>"; };
+		A871DEC90A1530C700B12A68 /* RenderFrameSet.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RenderFrameSet.h; sourceTree = "<group>"; };
+		A871DECA0A1530C700B12A68 /* RenderFrameSet.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RenderFrameSet.cpp; sourceTree = "<group>"; };
+		A871DECB0A1530C700B12A68 /* RenderFrame.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RenderFrame.h; sourceTree = "<group>"; };
+		A871DECC0A1530C700B12A68 /* RenderFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RenderFrame.cpp; sourceTree = "<group>"; };
+		A871DECD0A1530C700B12A68 /* RenderPartObject.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RenderPartObject.h; sourceTree = "<group>"; };
+		A871DECE0A1530C700B12A68 /* RenderPartObject.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RenderPartObject.cpp; sourceTree = "<group>"; };
+		A871DECF0A1530C700B12A68 /* RenderPart.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RenderPart.h; sourceTree = "<group>"; };
+		A871DFDE0A15376B00B12A68 /* RenderReplaced.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RenderReplaced.cpp; sourceTree = "<group>"; };
+		A871DFDF0A15376B00B12A68 /* RenderReplaced.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RenderReplaced.h; sourceTree = "<group>"; };
+		A871DFE00A15376B00B12A68 /* RenderWidget.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RenderWidget.h; sourceTree = "<group>"; };
+		A871DFE10A15376B00B12A68 /* RenderWidget.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RenderWidget.cpp; sourceTree = "<group>"; };
 		A884283809308C1C00B6D461 /* SVGNamesWrapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGNamesWrapper.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
 		A884283909308C1C00B6D461 /* SVGElementFactoryWrapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGElementFactoryWrapper.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
 		A884283D09308C1C00B6D461 /* DOMList.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = DOMList.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
@@ -2577,8 +2619,6 @@
 		BCEA4831097D93020094C9E4 /* RenderFlow.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RenderFlow.h; sourceTree = "<group>"; };
 		BCEA4832097D93020094C9E4 /* render_form.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = render_form.cpp; sourceTree = "<group>"; };
 		BCEA4833097D93020094C9E4 /* render_form.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = render_form.h; sourceTree = "<group>"; };
-		BCEA4834097D93020094C9E4 /* render_frames.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = render_frames.cpp; sourceTree = "<group>"; };
-		BCEA4835097D93020094C9E4 /* render_frames.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = render_frames.h; sourceTree = "<group>"; };
 		BCEA4836097D93020094C9E4 /* RenderImage.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RenderImage.cpp; sourceTree = "<group>"; };
 		BCEA4837097D93020094C9E4 /* RenderImage.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RenderImage.h; sourceTree = "<group>"; };
 		BCEA4838097D93020094C9E4 /* RenderInline.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RenderInline.cpp; sourceTree = "<group>"; };
@@ -2591,8 +2631,6 @@
 		BCEA483F097D93020094C9E4 /* render_list.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = render_list.h; sourceTree = "<group>"; };
 		BCEA4840097D93020094C9E4 /* RenderObject.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RenderObject.cpp; sourceTree = "<group>"; };
 		BCEA4841097D93020094C9E4 /* RenderObject.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RenderObject.h; sourceTree = "<group>"; };
-		BCEA4842097D93020094C9E4 /* render_replaced.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = render_replaced.cpp; sourceTree = "<group>"; };
-		BCEA4843097D93020094C9E4 /* render_replaced.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = render_replaced.h; sourceTree = "<group>"; };
 		BCEA4844097D93020094C9E4 /* render_style.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = render_style.cpp; sourceTree = "<group>"; };
 		BCEA4845097D93020094C9E4 /* render_style.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = render_style.h; sourceTree = "<group>"; };
 		BCEA4848097D93020094C9E4 /* RenderThemeMac.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RenderThemeMac.h; sourceTree = "<group>"; };
@@ -2640,8 +2678,6 @@
 		E1F0424509839389006694EA /* xmlhttprequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xmlhttprequest.h; sourceTree = "<group>"; };
 		ED048ABB0833F132006E1E67 /* textAreaResizeCorner.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = textAreaResizeCorner.tiff; sourceTree = "<group>"; };
 		ED2BA83B09A24B91006C0AC4 /* DocumentMarker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocumentMarker.h; sourceTree = "<group>"; };
-		F523D23702DE4396018635CA /* html_baseimpl.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = html_baseimpl.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
-		F523D23802DE4396018635CA /* html_baseimpl.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = html_baseimpl.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
 		F523D23902DE4396018635CA /* html_blockimpl.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = html_blockimpl.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
 		F523D23A02DE4396018635CA /* html_blockimpl.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = html_blockimpl.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
 		F523D23B02DE4396018635CA /* HTMLDocument.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLDocument.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
@@ -3269,8 +3305,6 @@
 				93EEC1EF09C2877700C515D1 /* CanvasStyle.h */,
 				A8136D370973A8E700D74463 /* FormDataList.cpp */,
 				A8136D360973A8E700D74463 /* FormDataList.h */,
-				F523D23702DE4396018635CA /* html_baseimpl.cpp */,
-				F523D23802DE4396018635CA /* html_baseimpl.h */,
 				F523D23902DE4396018635CA /* html_blockimpl.cpp */,
 				F523D23A02DE4396018635CA /* html_blockimpl.h */,
 				F523D24402DE4396018635CA /* html_imageimpl.cpp */,
@@ -3285,6 +3319,8 @@
 				A871DC130A15205700B12A68 /* HTMLBaseElement.h */,
 				A8DF3FCB097FA0FB0052981B /* HTMLBaseFontElement.cpp */,
 				A8DF3FCA097FA0FB0052981B /* HTMLBaseFontElement.h */,
+				A871DE1D0A152AC800B12A68 /* HTMLBodyElement.cpp */,
+				A871DE200A152AC800B12A68 /* HTMLBodyElement.h */,
 				A81369B7097374F500D74463 /* HTMLButtonElement.cpp */,
 				A81369B6097374F500D74463 /* HTMLButtonElement.h */,
 				51F6A3D50663BF04004D2919 /* HTMLCanvasElement.cpp */,
@@ -3308,8 +3344,18 @@
 				A8DF3FC6097FA0FB0052981B /* HTMLFormCollection.h */,
 				A81369B5097374F500D74463 /* HTMLFormElement.cpp */,
 				A81369B4097374F500D74463 /* HTMLFormElement.h */,
+				A871DE170A152AC800B12A68 /* HTMLFrameElement.cpp */,
+				A871DE1F0A152AC800B12A68 /* HTMLFrameElement.h */,
+				A871DE220A152AC800B12A68 /* HTMLFrameSetElement.cpp */,
+				A871DE1C0A152AC800B12A68 /* HTMLFrameSetElement.h */,
 				A81369B3097374F500D74463 /* HTMLGenericFormElement.cpp */,
 				A81369B2097374F500D74463 /* HTMLGenericFormElement.h */,
+				A871DE190A152AC800B12A68 /* HTMLHeadElement.cpp */,
+				A871DE210A152AC800B12A68 /* HTMLHeadElement.h */,
+				A871DE1A0A152AC800B12A68 /* HTMLHtmlElement.cpp */,
+				A871DE1B0A152AC800B12A68 /* HTMLHtmlElement.h */,
+				A871DE180A152AC800B12A68 /* HTMLIFrameElement.cpp */,
+				A871DE1E0A152AC800B12A68 /* HTMLIFrameElement.h */,
 				A81369B1097374F500D74463 /* HTMLInputElement.cpp */,
 				A81369B0097374F500D74463 /* HTMLInputElement.h */,
 				A81369AF097374F500D74463 /* HTMLIsIndexElement.cpp */,
@@ -4303,16 +4349,16 @@
 				BCEA4827097D93020094C9E4 /* render_button.h */,
 				BCEA4832097D93020094C9E4 /* render_form.cpp */,
 				BCEA4833097D93020094C9E4 /* render_form.h */,
-				BCEA4834097D93020094C9E4 /* render_frames.cpp */,
-				BCEA4835097D93020094C9E4 /* render_frames.h */,
 				BCEA483C097D93020094C9E4 /* render_line.cpp */,
 				BCEA483D097D93020094C9E4 /* render_line.h */,
 				BCEA483E097D93020094C9E4 /* render_list.cpp */,
 				BCEA483F097D93020094C9E4 /* render_list.h */,
-				BCEA4842097D93020094C9E4 /* render_replaced.cpp */,
-				BCEA4843097D93020094C9E4 /* render_replaced.h */,
 				BCEA4844097D93020094C9E4 /* render_style.cpp */,
 				BCEA4845097D93020094C9E4 /* render_style.h */,
+				A871DFDE0A15376B00B12A68 /* RenderReplaced.cpp */,
+				A871DFDF0A15376B00B12A68 /* RenderReplaced.h */,
+				A871DFE00A15376B00B12A68 /* RenderWidget.h */,
+				A871DFE10A15376B00B12A68 /* RenderWidget.cpp */,
 				BCEA481C097D93020094C9E4 /* RenderApplet.cpp */,
 				BCEA481D097D93020094C9E4 /* RenderApplet.h */,
 				BCEA481E097D93020094C9E4 /* RenderArena.cpp */,
@@ -4333,6 +4379,10 @@
 				BCEA482F097D93020094C9E4 /* RenderFlexibleBox.h */,
 				BCEA4830097D93020094C9E4 /* RenderFlow.cpp */,
 				BCEA4831097D93020094C9E4 /* RenderFlow.h */,
+				A871DECC0A1530C700B12A68 /* RenderFrame.cpp */,
+				A871DECB0A1530C700B12A68 /* RenderFrame.h */,
+				A871DECA0A1530C700B12A68 /* RenderFrameSet.cpp */,
+				A871DEC90A1530C700B12A68 /* RenderFrameSet.h */,
 				BCEA482A097D93020094C9E4 /* RenderHTMLCanvas.cpp */,
 				BCEA482B097D93020094C9E4 /* RenderHTMLCanvas.h */,
 				BCEA4836097D93020094C9E4 /* RenderImage.cpp */,
@@ -4343,6 +4393,10 @@
 				BCEA483B097D93020094C9E4 /* RenderLayer.h */,
 				BCEA4840097D93020094C9E4 /* RenderObject.cpp */,
 				BCEA4841097D93020094C9E4 /* RenderObject.h */,
+				A871DEC80A1530C700B12A68 /* RenderPart.cpp */,
+				A871DECF0A1530C700B12A68 /* RenderPart.h */,
+				A871DECE0A1530C700B12A68 /* RenderPartObject.cpp */,
+				A871DECD0A1530C700B12A68 /* RenderPartObject.h */,
 				A8DF4AE20980C42C0052981B /* RenderTable.cpp */,
 				A8DF4AE10980C42C0052981B /* RenderTable.h */,
 				A8DF4AE00980C42C0052981B /* RenderTableCell.cpp */,
@@ -4530,7 +4584,6 @@
 			isa = PBXHeadersBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				93F198E308245E59001E9ABC /* html_baseimpl.h in Headers */,
 				93F198E408245E59001E9ABC /* html_blockimpl.h in Headers */,
 				93F198E508245E59001E9ABC /* HTMLDocument.h in Headers */,
 				93F198E608245E59001E9ABC /* HTMLElement.h in Headers */,
@@ -4878,14 +4931,12 @@
 				BCEA486E097D93020094C9E4 /* RenderFlexibleBox.h in Headers */,
 				BCEA4870097D93020094C9E4 /* RenderFlow.h in Headers */,
 				BCEA4872097D93020094C9E4 /* render_form.h in Headers */,
-				BCEA4874097D93020094C9E4 /* render_frames.h in Headers */,
 				BCEA4876097D93020094C9E4 /* RenderImage.h in Headers */,
 				BCEA4878097D93020094C9E4 /* RenderInline.h in Headers */,
 				BCEA487A097D93020094C9E4 /* RenderLayer.h in Headers */,
 				BCEA487C097D93020094C9E4 /* render_line.h in Headers */,
 				BCEA487E097D93020094C9E4 /* render_list.h in Headers */,
 				BCEA4880097D93020094C9E4 /* RenderObject.h in Headers */,
-				BCEA4882097D93020094C9E4 /* render_replaced.h in Headers */,
 				BCEA4884097D93020094C9E4 /* render_style.h in Headers */,
 				BCEA4887097D93020094C9E4 /* RenderThemeMac.h in Headers */,
 				BCEA488A097D93020094C9E4 /* RenderTheme.h in Headers */,
@@ -5149,6 +5200,18 @@
 				A871DC240A15205700B12A68 /* HTMLMetaElement.h in Headers */,
 				A871DC250A15205700B12A68 /* HTMLScriptElement.h in Headers */,
 				A871DC280A15205700B12A68 /* HTMLTitleElement.h in Headers */,
+				A871DE270A152AC800B12A68 /* HTMLHtmlElement.h in Headers */,
+				A871DE280A152AC800B12A68 /* HTMLFrameSetElement.h in Headers */,
+				A871DE2A0A152AC800B12A68 /* HTMLIFrameElement.h in Headers */,
+				A871DE2B0A152AC800B12A68 /* HTMLFrameElement.h in Headers */,
+				A871DE2C0A152AC800B12A68 /* HTMLBodyElement.h in Headers */,
+				A871DE2D0A152AC800B12A68 /* HTMLHeadElement.h in Headers */,
+				A871DED10A1530C700B12A68 /* RenderFrameSet.h in Headers */,
+				A871DED30A1530C700B12A68 /* RenderFrame.h in Headers */,
+				A871DED50A1530C700B12A68 /* RenderPartObject.h in Headers */,
+				A871DED70A1530C700B12A68 /* RenderPart.h in Headers */,
+				A871DFE30A15376B00B12A68 /* RenderReplaced.h in Headers */,
+				A871DFE40A15376B00B12A68 /* RenderWidget.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -5359,7 +5422,6 @@
 				93F19A5608245E59001E9ABC /* DeprecatedValueListImpl.cpp in Sources */,
 				93F19A5D08245E59001E9ABC /* WebCoreImageRendererFactory.m in Sources */,
 				93F19A5F08245E59001E9ABC /* WebCoreViewFactory.m in Sources */,
-				93F19A8F08245E59001E9ABC /* html_baseimpl.cpp in Sources */,
 				93F19A9008245E59001E9ABC /* html_blockimpl.cpp in Sources */,
 				93F19A9108245E59001E9ABC /* HTMLDocument.cpp in Sources */,
 				93F19A9208245E59001E9ABC /* HTMLElement.cpp in Sources */,
@@ -5660,14 +5722,12 @@
 				BCEA486D097D93020094C9E4 /* RenderFlexibleBox.cpp in Sources */,
 				BCEA486F097D93020094C9E4 /* RenderFlow.cpp in Sources */,
 				BCEA4871097D93020094C9E4 /* render_form.cpp in Sources */,
-				BCEA4873097D93020094C9E4 /* render_frames.cpp in Sources */,
 				BCEA4875097D93020094C9E4 /* RenderImage.cpp in Sources */,
 				BCEA4877097D93020094C9E4 /* RenderInline.cpp in Sources */,
 				BCEA4879097D93020094C9E4 /* RenderLayer.cpp in Sources */,
 				BCEA487B097D93020094C9E4 /* render_line.cpp in Sources */,
 				BCEA487D097D93020094C9E4 /* render_list.cpp in Sources */,
 				BCEA487F097D93020094C9E4 /* RenderObject.cpp in Sources */,
-				BCEA4881097D93020094C9E4 /* render_replaced.cpp in Sources */,
 				BCEA4883097D93020094C9E4 /* render_style.cpp in Sources */,
 				BCEA4888097D93020094C9E4 /* RenderThemeMac.mm in Sources */,
 				BCEA4889097D93020094C9E4 /* RenderTheme.cpp in Sources */,
@@ -5908,6 +5968,18 @@
 				A871DC270A15205700B12A68 /* HTMLMetaElement.cpp in Sources */,
 				A871DC290A15205700B12A68 /* HTMLTitleElement.cpp in Sources */,
 				A871DC2A0A15205700B12A68 /* HTMLBaseElement.cpp in Sources */,
+				A871DE230A152AC800B12A68 /* HTMLFrameElement.cpp in Sources */,
+				A871DE240A152AC800B12A68 /* HTMLIFrameElement.cpp in Sources */,
+				A871DE250A152AC800B12A68 /* HTMLHeadElement.cpp in Sources */,
+				A871DE260A152AC800B12A68 /* HTMLHtmlElement.cpp in Sources */,
+				A871DE290A152AC800B12A68 /* HTMLBodyElement.cpp in Sources */,
+				A871DE2E0A152AC800B12A68 /* HTMLFrameSetElement.cpp in Sources */,
+				A871DED00A1530C700B12A68 /* RenderPart.cpp in Sources */,
+				A871DED20A1530C700B12A68 /* RenderFrameSet.cpp in Sources */,
+				A871DED40A1530C700B12A68 /* RenderFrame.cpp in Sources */,
+				A871DED60A1530C700B12A68 /* RenderPartObject.cpp in Sources */,
+				A871DFE20A15376B00B12A68 /* RenderReplaced.cpp in Sources */,
+				A871DFE50A15376B00B12A68 /* RenderWidget.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/WebCore/bindings/js/kjs_html.cpp b/WebCore/bindings/js/kjs_html.cpp
index 92367cd0..31717f1 100644
--- a/WebCore/bindings/js/kjs_html.cpp
+++ b/WebCore/bindings/js/kjs_html.cpp
@@ -28,11 +28,16 @@
 #include "HTMLAppletElement.h"
 #include "HTMLBaseElement.h"
 #include "HTMLBaseFontElement.h"
+#include "HTMLBodyElement.h"
 #include "HTMLButtonElement.h"
 #include "HTMLDocument.h"
 #include "HTMLEmbedElement.h"
 #include "HTMLFieldSetElement.h"
 #include "HTMLFormElement.h"
+#include "HTMLFrameSetElement.h"
+#include "HTMLHeadElement.h"
+#include "HTMLHtmlElement.h"
+#include "HTMLIFrameElement.h"
 #include "HTMLIsIndexElement.h"
 #include "HTMLLabelElement.h"
 #include "HTMLLegendElement.h"
@@ -59,7 +64,6 @@
 #include "Text.h"
 #include "css_ruleimpl.h"
 #include "dom2_eventsimpl.h"
-#include "html_baseimpl.h"
 #include "html_blockimpl.h"
 #include "html_imageimpl.h"
 #include "html_inlineimpl.h"
@@ -104,7 +108,7 @@
 {
     if (!thisObj->inherits(&JSHTMLDocument::info))
         return throwError(exec, TypeError);
-    HTMLDocument &doc = *static_cast<HTMLDocument *>(static_cast<JSHTMLDocument *>(thisObj)->impl());
+    HTMLDocument &doc = *static_cast<HTMLDocument*>(static_cast<JSHTMLDocument*>(thisObj)->impl());
     
     switch (id) {
         case JSHTMLDocument::Clear: // even IE doesn't support that one...
@@ -204,8 +208,8 @@
 
 JSValue *JSHTMLDocument::namedItemGetter(ExecState *exec, JSObject *originalObject, const Identifier& propertyName, const PropertySlot& slot)
 {
-  JSHTMLDocument *thisObj = static_cast<JSHTMLDocument *>(slot.slotBase());
-  HTMLDocument &doc = *static_cast<HTMLDocument *>(thisObj->impl());
+  JSHTMLDocument *thisObj = static_cast<JSHTMLDocument*>(slot.slotBase());
+  HTMLDocument &doc = *static_cast<HTMLDocument*>(thisObj->impl());
 
   String name = propertyName;
   RefPtr<WebCore::HTMLCollection> collection = doc.documentNamedItems(name);
@@ -213,7 +217,7 @@
   if (collection->length() == 1) {
     WebCore::Node* node = collection->firstItem();
     Frame *frame;
-    if (node->hasTagName(iframeTag) && (frame = static_cast<WebCore::HTMLIFrameElement *>(node)->contentFrame()))
+    if (node->hasTagName(iframeTag) && (frame = static_cast<WebCore::HTMLIFrameElement*>(node)->contentFrame()))
       return Window::retrieve(frame);
     return toJS(exec, node);
   }
@@ -223,13 +227,13 @@
 
 JSValue *JSHTMLDocument::getValueProperty(ExecState *exec, int token) const
 {
-  HTMLDocument &doc = *static_cast<HTMLDocument *>(impl());
+  HTMLDocument& doc = *static_cast<HTMLDocument*>(impl());
 
-  FrameView *view = doc.view();
-  Frame *frame = doc.frame();
+  FrameView* view = doc.view();
+  Frame* frame = doc.frame();
 
-  HTMLElement *body = doc.body();
-  HTMLBodyElement *bodyElement = (body && body->hasTagName(bodyTag)) ? static_cast<HTMLBodyElement *>(body) : 0;
+  HTMLElement* body = doc.body();
+  HTMLBodyElement* bodyElement = (body && body->hasTagName(bodyTag)) ? static_cast<HTMLBodyElement*>(body) : 0;
     
   switch (token) {
   case Title:
@@ -313,7 +317,7 @@
 
 bool JSHTMLDocument::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)
 {
-  HTMLDocument &doc = *static_cast<HTMLDocument *>(impl());
+  HTMLDocument &doc = *static_cast<HTMLDocument*>(impl());
 
   String name = propertyName;
   if (doc.hasNamedItem(name) || doc.hasDocExtraNamedItem(name)) {
@@ -340,9 +344,9 @@
 void JSHTMLDocument::putValueProperty(ExecState *exec, int token, JSValue *value, int /*attr*/)
 {
   DOMExceptionTranslator exception(exec);
-  HTMLDocument &doc = *static_cast<HTMLDocument *>(impl());
+  HTMLDocument &doc = *static_cast<HTMLDocument*>(impl());
   HTMLElement *body = doc.body();
-  HTMLBodyElement *bodyElement = (body && body->hasTagName(bodyTag)) ? static_cast<HTMLBodyElement *>(body) : 0;
+  HTMLBodyElement *bodyElement = (body && body->hasTagName(bodyTag)) ? static_cast<HTMLBodyElement*>(body) : 0;
 
   switch (token) {
   case Title:
@@ -366,12 +370,12 @@
       // When assigning location, IE and Mozilla both resolve the URL
       // relative to the frame where the JavaScript is executing not
       // the target frame.
-      Frame *activePart = static_cast<ScriptInterpreter *>( exec->dynamicInterpreter() )->frame();
+      Frame *activePart = static_cast<ScriptInterpreter*>( exec->dynamicInterpreter() )->frame();
       if (activePart)
         str = activePart->document()->completeURL(str);
 
       // We want a new history item if this JS was called via a user gesture
-      bool userGesture = static_cast<ScriptInterpreter *>(exec->dynamicInterpreter())->wasRunByUserGesture();
+      bool userGesture = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->wasRunByUserGesture();
       frame->scheduleLocationChange(str, activePart->referrer(), !userGesture);
     }
     break;
@@ -1212,35 +1216,35 @@
 
 JSValue *JSHTMLElement::formIndexGetter(ExecState *exec, JSObject *originalObject, const Identifier& propertyName, const PropertySlot& slot)
 {
-    JSHTMLElement *thisObj = static_cast<JSHTMLElement *>(slot.slotBase());
-    HTMLFormElement *form = static_cast<HTMLFormElement *>(thisObj->impl());
+    JSHTMLElement *thisObj = static_cast<JSHTMLElement*>(slot.slotBase());
+    HTMLFormElement *form = static_cast<HTMLFormElement*>(thisObj->impl());
 
     return toJS(exec, form->elements()->item(slot.index()));
 }
 
 JSValue *JSHTMLElement::formNameGetter(ExecState *exec, JSObject *originalObject, const Identifier& propertyName, const PropertySlot& slot)
 {
-    JSHTMLElement *thisObj = static_cast<JSHTMLElement *>(slot.slotBase());
-    HTMLFormElement *form = static_cast<HTMLFormElement *>(thisObj->impl());
+    JSHTMLElement *thisObj = static_cast<JSHTMLElement*>(slot.slotBase());
+    HTMLFormElement *form = static_cast<HTMLFormElement*>(thisObj->impl());
     
     return JSHTMLCollection(exec, form->elements().get()).getNamedItems(exec, propertyName);
 }
 
 JSValue *JSHTMLElement::selectIndexGetter(ExecState *exec, JSObject *originalObject, const Identifier& propertyName, const PropertySlot& slot)
 {
-    JSHTMLElement *thisObj = static_cast<JSHTMLElement *>(slot.slotBase());
-    HTMLSelectElement *select = static_cast<HTMLSelectElement *>(thisObj->impl());
+    JSHTMLElement *thisObj = static_cast<JSHTMLElement*>(slot.slotBase());
+    HTMLSelectElement *select = static_cast<HTMLSelectElement*>(thisObj->impl());
 
     return toJS(exec, select->options()->item(slot.index()));
 }
 
 JSValue *JSHTMLElement::framesetNameGetter(ExecState *exec, JSObject *originalObject, const Identifier& propertyName, const PropertySlot& slot)
 {
-    JSHTMLElement *thisObj = static_cast<JSHTMLElement *>(slot.slotBase());
-    HTMLElement *element = static_cast<HTMLElement *>(thisObj->impl());
+    JSHTMLElement *thisObj = static_cast<JSHTMLElement*>(slot.slotBase());
+    HTMLElement *element = static_cast<HTMLElement*>(thisObj->impl());
 
     WebCore::Node *frame = element->children()->namedItem(propertyName);
-    if (Document* doc = static_cast<HTMLFrameElement *>(frame)->contentDocument())
+    if (Document* doc = static_cast<HTMLFrameElement*>(frame)->contentDocument())
         if (Window *window = Window::retrieveWindow(doc->frame()))
             return window;
 
@@ -1249,25 +1253,25 @@
 
 JSValue *JSHTMLElement::runtimeObjectGetter(ExecState *exec, JSObject *originalObject, const Identifier& propertyName, const PropertySlot& slot)
 {
-    JSHTMLElement *thisObj = static_cast<JSHTMLElement *>(slot.slotBase());
-    HTMLElement *element = static_cast<HTMLElement *>(thisObj->impl());
+    JSHTMLElement *thisObj = static_cast<JSHTMLElement*>(slot.slotBase());
+    HTMLElement *element = static_cast<HTMLElement*>(thisObj->impl());
 
     return getRuntimeObject(exec, element);
 }
 
 JSValue *JSHTMLElement::runtimeObjectPropertyGetter(ExecState *exec, JSObject *originalObject, const Identifier& propertyName, const PropertySlot& slot)
 {
-    JSHTMLElement *thisObj = static_cast<JSHTMLElement *>(slot.slotBase());
-    HTMLElement *element = static_cast<HTMLElement *>(thisObj->impl());
+    JSHTMLElement *thisObj = static_cast<JSHTMLElement*>(slot.slotBase());
+    HTMLElement *element = static_cast<HTMLElement*>(thisObj->impl());
 
     if (JSValue *runtimeObject = getRuntimeObject(exec, element))
-        return static_cast<JSObject *>(runtimeObject)->get(exec, propertyName);
+        return static_cast<JSObject*>(runtimeObject)->get(exec, propertyName);
     return jsUndefined();
 }
 
 bool JSHTMLElement::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)
 {
-    HTMLElement &element = *static_cast<HTMLElement *>(impl());
+    HTMLElement &element = *static_cast<HTMLElement*>(impl());
 
     // First look at dynamic properties
     if (element.hasLocalName(formTag)) {
@@ -1307,7 +1311,7 @@
         }
         JSValue *runtimeObject = getRuntimeObject(exec,&element);
         if (runtimeObject) {
-            JSObject *imp = static_cast<JSObject *>(runtimeObject);
+            JSObject *imp = static_cast<JSObject*>(runtimeObject);
             if (imp->hasProperty(exec, propertyName)) {
                 slot.setCustom(this, runtimeObjectPropertyGetter);
                 return true;
@@ -1319,7 +1323,7 @@
     const HashEntry* entry = Lookup::findEntry(table, propertyName);
     if (entry) {
         // don't expose selection properties for input types that can't have a selection
-        if (element.hasLocalName(inputTag) && !static_cast<HTMLInputElement *>(impl())->canHaveSelection()) {
+        if (element.hasLocalName(inputTag) && !static_cast<HTMLInputElement*>(impl())->canHaveSelection()) {
             switch (entry->value) {
             case InputSetSelectionRange:
             case InputSelectionStart:
@@ -1347,23 +1351,23 @@
 
 bool JSHTMLElement::implementsCall() const
 {
-    HTMLElement *element = static_cast<HTMLElement *>(impl());
+    HTMLElement *element = static_cast<HTMLElement*>(impl());
     if (element->hasTagName(embedTag) || element->hasTagName(objectTag) || element->hasTagName(appletTag)) {
         Document* doc = element->document();
         KJSProxy *proxy = doc->frame()->jScript();
         ExecState *exec = proxy->interpreter()->globalExec();
         if (JSValue *runtimeObject = getRuntimeObject(exec, element))
-            return static_cast<JSObject *>(runtimeObject)->implementsCall();
+            return static_cast<JSObject*>(runtimeObject)->implementsCall();
     }
     return false;
 }
 
 JSValue *JSHTMLElement::callAsFunction(ExecState *exec, JSObject *thisObj, const List&args)
 {
-    HTMLElement *element = static_cast<HTMLElement *>(impl());
+    HTMLElement *element = static_cast<HTMLElement*>(impl());
     if (element->hasTagName(embedTag) || element->hasTagName(objectTag) || element->hasTagName(appletTag)) {
         if (JSValue *runtimeObject = getRuntimeObject(exec, element))
-            return static_cast<JSObject *>(runtimeObject)->call(exec, thisObj, args);
+            return static_cast<JSObject*>(runtimeObject)->call(exec, thisObj, args);
     }
     return jsUndefined();
 }
@@ -2172,7 +2176,7 @@
 JSValue *JSHTMLElement::getValueProperty(ExecState *exec, int token) const
 {
     // Check our set of generic properties first.
-    HTMLElement &element = *static_cast<HTMLElement *>(impl());
+    HTMLElement &element = *static_cast<HTMLElement*>(impl());
     switch (token) {
         case ElementId:
             // iht.com relies on this value being "" when no id is present. Other browsers do this as well.
@@ -2213,7 +2217,7 @@
 UString JSHTMLElement::toString(ExecState *exec) const
 {
     if (impl()->hasTagName(aTag))
-        return UString(static_cast<const HTMLAnchorElement *>(impl())->href());
+        return UString(static_cast<const HTMLAnchorElement*>(impl())->href());
     else
         return JSElement::toString(exec);
 }
@@ -2221,21 +2225,21 @@
 static HTMLFormElement *getForm(HTMLElement *element)
 {
     if (element->isGenericFormElement())
-        return static_cast<HTMLGenericFormElement *>(element)->form();
+        return static_cast<HTMLGenericFormElement*>(element)->form();
     if (element->hasTagName(labelTag))
-        return static_cast<HTMLLabelElement *>(element)->form();
+        return static_cast<HTMLLabelElement*>(element)->form();
     if (element->hasTagName(objectTag))
-        return static_cast<HTMLObjectElement *>(element)->form();
+        return static_cast<HTMLObjectElement*>(element)->form();
 
     return 0;
 }
 
 void JSHTMLElement::pushEventHandlerScope(ExecState *exec, ScopeChain &scope) const
 {
-  HTMLElement *element = static_cast<HTMLElement *>(impl());
+  HTMLElement *element = static_cast<HTMLElement*>(impl());
 
   // The document is put on first, fall back to searching it only after the element and form.
-  scope.push(static_cast<JSObject *>(toJS(exec, element->ownerDocument())));
+  scope.push(static_cast<JSObject*>(toJS(exec, element->ownerDocument())));
 
   // The form is next, searched before the document, but after the element itself.
   
@@ -2244,18 +2248,18 @@
   // <table> or <tbody>.
   HTMLFormElement *form = getForm(element);
   if (form)
-    scope.push(static_cast<JSObject *>(toJS(exec, form)));
+    scope.push(static_cast<JSObject*>(toJS(exec, form)));
   else {
     WebCore::Node* form = element->parentNode();
     while (form && !form->hasTagName(formTag))
       form = form->parentNode();
     
     if (form)
-      scope.push(static_cast<JSObject *>(toJS(exec, form)));
+      scope.push(static_cast<JSObject*>(toJS(exec, form)));
   }
   
   // The element is on top, searched first.
-  scope.push(static_cast<JSObject *>(toJS(exec, element)));
+  scope.push(static_cast<JSObject*>(toJS(exec, element)));
 }
 
 HTMLElementFunction::HTMLElementFunction(ExecState *exec, int i, int len, const Identifier& name)
@@ -2270,7 +2274,7 @@
     if (!thisObj->inherits(&JSHTMLElement::info))
         return throwError(exec, TypeError);
     DOMExceptionTranslator exception(exec);
-    HTMLElement &element = *static_cast<HTMLElement *>(static_cast<JSHTMLElement *>(thisObj)->impl());
+    HTMLElement &element = *static_cast<HTMLElement*>(static_cast<JSHTMLElement*>(thisObj)->impl());
 
     if (element.hasLocalName(formTag)) {
         HTMLFormElement &form = static_cast<HTMLFormElement &>(element);
@@ -2449,21 +2453,21 @@
 
 void JSHTMLElement::put(ExecState *exec, const Identifier &propertyName, JSValue *value, int attr)
 {
-    HTMLElement &element = *static_cast<HTMLElement *>(impl());
+    HTMLElement &element = *static_cast<HTMLElement*>(impl());
     // First look at dynamic properties
     if (element.hasLocalName(selectTag)) {
         HTMLSelectElement &select = static_cast<HTMLSelectElement &>(element);
         bool ok;
         /*unsigned u =*/ propertyName.toUInt32(&ok);
         if (ok) {
-            JSObject *coll = static_cast<JSObject *>(getSelectHTMLCollection(exec, select.options().get(), &select));
+            JSObject *coll = static_cast<JSObject*>(getSelectHTMLCollection(exec, select.options().get(), &select));
             coll->put(exec,propertyName,value);
             return;
         }
     }
     else if (element.hasLocalName(embedTag) || element.hasLocalName(objectTag) || element.hasLocalName(appletTag)) {
         if (JSValue *runtimeObject = getRuntimeObject(exec, &element)) {
-            JSObject *imp = static_cast<JSObject *>(runtimeObject);
+            JSObject *imp = static_cast<JSObject*>(runtimeObject);
             if (imp->canPut(exec, propertyName))
                 return imp->put(exec, propertyName, value);
         }
@@ -2608,7 +2612,7 @@
         case SelectSelectedIndex:   { select.setSelectedIndex(value->toInt32(exec)); return; }
         case SelectValue:           { select.setValue(str); return; }
         case SelectLength:          { // read-only according to the NS spec, but webpages need it writeable
-                                        JSObject *coll = static_cast<JSObject *>(getSelectHTMLCollection(exec, select.options().get(), &select));
+                                        JSObject *coll = static_cast<JSObject*>(getSelectHTMLCollection(exec, select.options().get(), &select));
                                         coll->put(exec,lengthPropertyName,value);
                                         return;
                                     }
@@ -3161,7 +3165,7 @@
     WebCore::String str = value->toString(exec);
  
     // Check our set of generic properties first.
-    HTMLElement &element = *static_cast<HTMLElement *>(impl());
+    HTMLElement &element = *static_cast<HTMLElement*>(impl());
     switch (token) {
         case ElementId:
             element.setId(str);
@@ -3202,14 +3206,14 @@
 {
     if (!val || !val->isObject(&JSHTMLElement::info))
         return 0;
-    return static_cast<HTMLElement *>(static_cast<JSHTMLElement *>(val)->impl());
+    return static_cast<HTMLElement*>(static_cast<JSHTMLElement*>(val)->impl());
 }
 
 HTMLTableCaptionElement *toHTMLTableCaptionElement(JSValue *val)
 {
     HTMLElement *e = toHTMLElement(val);
     if (e && e->hasTagName(captionTag))
-        return static_cast<HTMLTableCaptionElement *>(e);
+        return static_cast<HTMLTableCaptionElement*>(e);
     return 0;
 }
 
@@ -3217,7 +3221,7 @@
 {
     HTMLElement *e = toHTMLElement(val);
     if (e && (e->hasTagName(theadTag) || e->hasTagName(tbodyTag) || e->hasTagName(tfootTag)))
-        return static_cast<HTMLTableSectionElement *>(e);
+        return static_cast<HTMLTableSectionElement*>(e);
     return 0;
 }
 
@@ -3248,19 +3252,19 @@
 
 JSValue *JSHTMLCollection::lengthGetter(ExecState *exec, JSObject *originalObject, const Identifier& propertyName, const PropertySlot& slot)
 {
-    JSHTMLCollection *thisObj = static_cast<JSHTMLCollection *>(slot.slotBase());
+    JSHTMLCollection *thisObj = static_cast<JSHTMLCollection*>(slot.slotBase());
     return jsNumber(thisObj->m_impl->length());
 }
 
 JSValue *JSHTMLCollection::indexGetter(ExecState *exec, JSObject *originalObject, const Identifier& propertyName, const PropertySlot& slot)
 {
-    JSHTMLCollection *thisObj = static_cast<JSHTMLCollection *>(slot.slotBase());
+    JSHTMLCollection *thisObj = static_cast<JSHTMLCollection*>(slot.slotBase());
     return toJS(exec, thisObj->m_impl->item(slot.index()));
 }
 
 JSValue *JSHTMLCollection::nameGetter(ExecState *exec, JSObject *originalObject, const Identifier& propertyName, const PropertySlot& slot)
 {
-    JSHTMLCollection *thisObj = static_cast<JSHTMLCollection *>(slot.slotBase());
+    JSHTMLCollection *thisObj = static_cast<JSHTMLCollection*>(slot.slotBase());
     return thisObj->getNamedItems(exec, propertyName);
 }
 
@@ -3272,7 +3276,7 @@
   } else {
     // Look in the prototype (for functions) before assuming it's an item's name
     JSValue *proto = prototype();
-    if (proto->isObject() && static_cast<JSObject *>(proto)->hasProperty(exec, propertyName))
+    if (proto->isObject() && static_cast<JSObject*>(proto)->hasProperty(exec, propertyName))
       return false;
 
     // name or index ?
@@ -3348,7 +3352,7 @@
 {
   if (!thisObj->inherits(&JSHTMLCollection::info))
     return throwError(exec, TypeError);
-  HTMLCollection &coll = *static_cast<JSHTMLCollection *>(thisObj)->impl();
+  HTMLCollection &coll = *static_cast<JSHTMLCollection*>(thisObj)->impl();
 
   switch (id) {
   case JSHTMLCollection::Item:
@@ -3356,7 +3360,7 @@
   case JSHTMLCollection::Tags:
     return toJS(exec, coll.base()->getElementsByTagName(args[0]->toString(exec)).get());
   case JSHTMLCollection::NamedItem:
-    return static_cast<JSHTMLCollection *>(thisObj)->getNamedItems(exec, Identifier(args[0]->toString(exec)));
+    return static_cast<JSHTMLCollection*>(thisObj)->getNamedItems(exec, Identifier(args[0]->toString(exec)));
   default:
     return jsUndefined();
   }
@@ -3371,7 +3375,7 @@
 
 JSValue *JSHTMLSelectCollection::selectedIndexGetter(ExecState *exec, JSObject *originalObject, const Identifier& propertyName, const PropertySlot& slot)
 {
-    JSHTMLSelectCollection *thisObj = static_cast<JSHTMLSelectCollection *>(slot.slotBase());
+    JSHTMLSelectCollection *thisObj = static_cast<JSHTMLSelectCollection*>(slot.slotBase());
     return jsNumber(thisObj->m_element->selectedIndex());
 }
 
@@ -3412,7 +3416,7 @@
         RefPtr<Element> option = m_element->ownerDocument()->createElement("option", exception);
         if (exception)
           break;         
-        m_element->add(static_cast<HTMLElement *>(option.get()), 0, exception);
+        m_element->add(static_cast<HTMLElement*>(option.get()), 0, exception);
         if (exception)
           break;
       } while (++diff);
@@ -3450,18 +3454,18 @@
       RefPtr<Element> dummyOption = m_element->ownerDocument()->createElement("option", exception);
       if (!dummyOption)
         break;      
-      m_element->add(static_cast<HTMLElement *>(dummyOption.get()), 0, exception);
+      m_element->add(static_cast<HTMLElement*>(dummyOption.get()), 0, exception);
       if (exception) 
           break;
     }
     // replace an existing entry ?
   } else if (diff < 0) {
-    before = static_cast<HTMLElement *>(m_element->options()->item(u+1));
+    before = static_cast<HTMLElement*>(m_element->options()->item(u+1));
     m_element->remove(u);
   }
   // finally add the new element
   if (exception == 0)
-    m_element->add(static_cast<HTMLOptionElement *>(option), before, exception);
+    m_element->add(static_cast<HTMLOptionElement*>(option), before, exception);
 
   setDOMException(exec, exception);
 }
@@ -3485,7 +3489,7 @@
   RefPtr<Element> el(m_doc->createElement("option", exception));
   HTMLOptionElement *opt = 0;
   if (el) {
-    opt = static_cast<HTMLOptionElement *>(el.get());
+    opt = static_cast<HTMLOptionElement*>(el.get());
     int sz = args.size();
     RefPtr<Text> t = m_doc->createTextNode("");
     opt->appendChild(t, exception);
@@ -3500,7 +3504,7 @@
   }
 
   setDOMException(exec, exception);
-  return static_cast<JSObject *>(toJS(exec,opt));
+  return static_cast<JSObject*>(toJS(exec,opt));
 }
 
 ////////////////////// Image Object ////////////////////////
@@ -3557,7 +3561,7 @@
   DOMObject *ret;
   if (!c)
     return jsNull();
-  ScriptInterpreter* interp = static_cast<ScriptInterpreter *>(exec->dynamicInterpreter());
+  ScriptInterpreter* interp = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter());
   if ((ret = interp->getDOMObject(c)))
     return ret;
   else {
diff --git a/WebCore/bindings/objc/DOMHTML.mm b/WebCore/bindings/objc/DOMHTML.mm
index daf422a..87a8ce9 100644
--- a/WebCore/bindings/objc/DOMHTML.mm
+++ b/WebCore/bindings/objc/DOMHTML.mm
@@ -34,12 +34,17 @@
 #import "HTMLAppletElement.h"
 #import "HTMLBaseElement.h"
 #import "HTMLBaseFontElement.h"
+#import "HTMLBodyElement.h"
 #import "HTMLButtonElement.h"
 #import "HTMLDocument.h"
 #import "HTMLEmbedElement.h"
 #import "HTMLFieldSetElement.h"
 #import "HTMLFormCollection.h"
 #import "HTMLFormElement.h"
+#import "HTMLFrameSetElement.h"
+#import "HTMLHeadElement.h"
+#import "HTMLHtmlElement.h"
+#import "HTMLIFrameElement.h"
 #import "HTMLIsIndexElement.h"
 #import "HTMLLabelElement.h"
 #import "HTMLLegendElement.h"
@@ -62,7 +67,6 @@
 #import "HTMLTextAreaElement.h"
 #import "HTMLTitleElement.h"
 #import "NameNodeList.h"
-#import "html_baseimpl.h"
 #import "html_blockimpl.h"
 #import "html_imageimpl.h"
 #import "html_listimpl.h"
@@ -3964,7 +3968,7 @@
 
 // These #imports and "usings" are used only by viewForElement and should be deleted 
 // when that function goes away.
-#import "render_replaced.h"
+#import "RenderWidget.h"
 using WebCore::RenderObject;
 using WebCore::RenderWidget;
 
diff --git a/WebCore/bridge/mac/FrameMac.mm b/WebCore/bridge/mac/FrameMac.mm
index 07479ec..5381784 100644
--- a/WebCore/bridge/mac/FrameMac.mm
+++ b/WebCore/bridge/mac/FrameMac.mm
@@ -41,6 +41,7 @@
 #import "GraphicsContext.h"
 #import "HTMLDocument.h"
 #import "HTMLFormElement.h"
+#import "HTMLFrameElement.h"
 #import "HTMLGenericFormElement.h"
 #import "HTMLNames.h"
 #import "HTMLTableCellElement.h"
@@ -55,6 +56,7 @@
 #import "RegularExpression.h"
 #import "RenderCanvas.h"
 #import "RenderImage.h"
+#import "RenderPart.h"
 #import "RenderTableCell.h"
 #import "RenderTheme.h"
 #import "TextIterator.h"
@@ -64,13 +66,13 @@
 #import "WebDashboardRegion.h"
 #import "csshelper.h"
 #import "kjs_window.h"
-#import "render_frames.h"
 #import "render_list.h"
 #import "visible_units.h"
 #import <JavaScriptCore/NP_jsobject.h>
 #import <JavaScriptCore/WebScriptObjectPrivate.h>
 #import <JavaScriptCore/npruntime_impl.h>
 
+
 #undef _KWQ_TIMING
 
 @interface NSObject (WebPlugIn)
@@ -583,7 +585,7 @@
     int marginWidth = -1;
     int marginHeight = -1;
     if (renderer->element()->hasTagName(frameTag) || renderer->element()->hasTagName(iframeTag)) {
-        HTMLFrameElement *o = static_cast<HTMLFrameElement*>(renderer->element());
+        HTMLFrameElement* o = static_cast<HTMLFrameElement*>(renderer->element());
         allowsScrolling = o->scrollingMode() != ScrollBarAlwaysOff;
         marginWidth = o->getMarginWidth();
         marginHeight = o->getMarginHeight();
diff --git a/WebCore/bridge/mac/WebCoreFrameBridge.mm b/WebCore/bridge/mac/WebCoreFrameBridge.mm
index 927a21b..769458e 100644
--- a/WebCore/bridge/mac/WebCoreFrameBridge.mm
+++ b/WebCore/bridge/mac/WebCoreFrameBridge.mm
@@ -63,9 +63,10 @@
 #import "ModifySelectionListLevelCommand.h"
 #import "MoveSelectionCommand.h"
 #import "RenderCanvas.h"
-#import "render_frames.h"
 #import "RenderImage.h"
+#import "RenderPart.h"
 #import "ReplaceSelectionCommand.h"
+#import "RenderWidget.h"
 #import "TypingCommand.h"
 #import "TextIterator.h"
 #import "visible_units.h"
@@ -916,8 +917,8 @@
           
     NSString *name = [[NSString alloc] initWithUTF8String:node->renderName()];
     
-    RenderWidget *renderWidget = node->isWidget() ? static_cast<RenderWidget *>(node) : 0;
-    Widget *widget = renderWidget ? renderWidget->widget() : 0;
+    RenderWidget* renderWidget = node->isWidget() ? static_cast<RenderWidget*>(node) : 0;
+    Widget* widget = renderWidget ? renderWidget->widget() : 0;
     NSView *view = widget ? widget->getView() : nil;
     
     int nx, ny;
diff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp
index 16be901..e1d6d12 100644
--- a/WebCore/dom/Document.cpp
+++ b/WebCore/dom/Document.cpp
@@ -39,6 +39,7 @@
 #include "ExceptionCode.h"
 #include "Frame.h"
 #include "FrameTree.h"
+#include "HTMLBodyElement.h"
 #include "HTMLDocument.h"
 #include "HTMLElementFactory.h"
 #include "HTMLInputElement.h"
@@ -54,6 +55,7 @@
 #include "RegularExpression.h"
 #include "RenderArena.h"
 #include "RenderCanvas.h"
+#include "RenderWidget.h"
 #include "SegmentedString.h"
 #include "SelectionController.h"
 #include "StringHash.h"
@@ -67,7 +69,6 @@
 #include "html_imageimpl.h"
 #include "kjs_binding.h"
 #include "kjs_proxy.h"
-#include "render_frames.h"
 #include "xml_tokenizer.h"
 #include "xmlhttprequest.h"
 #include "XPathEvaluator.h"
@@ -1996,7 +1997,7 @@
     RenderObject *renderer = focusNode->renderer();
     if (!renderer || !renderer->isWidget())
         return 0;
-    return static_cast<RenderWidget *>(renderer)->widget();
+    return static_cast<RenderWidget*>(renderer)->widget();
 }
 
 bool Document::setFocusNode(PassRefPtr<Node> newFocusNode)
diff --git a/WebCore/html/HTMLBodyElement.cpp b/WebCore/html/HTMLBodyElement.cpp
new file mode 100644
index 0000000..32c3c51
--- /dev/null
+++ b/WebCore/html/HTMLBodyElement.cpp
@@ -0,0 +1,231 @@
+/**
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ *           (C) 1999 Antti Koivisto (koivisto@kde.org)
+ *           (C) 2000 Simon Hausmann (hausmann@kde.org)
+ *           (C) 2001 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#include "config.h"
+#include "HTMLBodyElement.h"
+
+#include "css_stylesheetimpl.h"
+#include "CSSPropertyNames.h"
+#include "CSSStyleSelector.h"
+#include "CSSValueKeywords.h"
+#include "Document.h"
+#include "EventNames.h"
+#include "FrameView.h"
+#include "HTMLNames.h"
+#include "csshelper.h"
+
+namespace WebCore {
+
+using namespace EventNames;
+using namespace HTMLNames;
+
+HTMLBodyElement::HTMLBodyElement(Document* doc)
+    : HTMLElement(bodyTag, doc)
+{
+}
+
+HTMLBodyElement::~HTMLBodyElement()
+{
+    if (m_linkDecl) {
+        m_linkDecl->setNode(0);
+        m_linkDecl->setParent(0);
+    }
+}
+
+void HTMLBodyElement::createLinkDecl()
+{
+    m_linkDecl = new CSSMutableStyleDeclaration;
+    m_linkDecl->setParent(document()->elementSheet());
+    m_linkDecl->setNode(this);
+    m_linkDecl->setStrictParsing(!document()->inCompatMode());
+}
+
+bool HTMLBodyElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const
+{
+    if (attrName == backgroundAttr) {
+        result = (MappedAttributeEntry)(eLastEntry + document()->docID());
+        return false;
+    } 
+    
+    if (attrName == bgcolorAttr ||
+        attrName == textAttr ||
+        attrName == marginwidthAttr ||
+        attrName == leftmarginAttr ||
+        attrName == marginheightAttr ||
+        attrName == topmarginAttr ||
+        attrName == bgpropertiesAttr) {
+        result = eUniversal;
+        return false;
+    }
+
+    return HTMLElement::mapToEntry(attrName, result);
+}
+
+void HTMLBodyElement::parseMappedAttribute(MappedAttribute *attr)
+{
+    if (attr->name() == backgroundAttr) {
+        String url = WebCore::parseURL(attr->value());
+        if (!url.isEmpty())
+            addCSSImageProperty(attr, CSS_PROP_BACKGROUND_IMAGE, document()->completeURL(url));
+    } else if (attr->name() == marginwidthAttr || attr->name() == leftmarginAttr) {
+        addCSSLength(attr, CSS_PROP_MARGIN_RIGHT, attr->value());
+        addCSSLength(attr, CSS_PROP_MARGIN_LEFT, attr->value());
+    } else if (attr->name() == marginheightAttr || attr->name() == topmarginAttr) {
+        addCSSLength(attr, CSS_PROP_MARGIN_BOTTOM, attr->value());
+        addCSSLength(attr, CSS_PROP_MARGIN_TOP, attr->value());
+    } else if (attr->name() == bgcolorAttr) {
+        addCSSColor(attr, CSS_PROP_BACKGROUND_COLOR, attr->value());
+    } else if (attr->name() == textAttr) {
+        addCSSColor(attr, CSS_PROP_COLOR, attr->value());
+    } else if (attr->name() == bgpropertiesAttr) {
+        if (equalIgnoringCase(attr->value(), "fixed"))
+            addCSSProperty(attr, CSS_PROP_BACKGROUND_ATTACHMENT, CSS_VAL_FIXED);
+    } else if (attr->name() == vlinkAttr ||
+               attr->name() == alinkAttr ||
+               attr->name() == linkAttr) {
+        if (attr->isNull()) {
+            if (attr->name() == linkAttr)
+                document()->resetLinkColor();
+            else if (attr->name() == vlinkAttr)
+                document()->resetVisitedLinkColor();
+            else
+                document()->resetActiveLinkColor();
+        } else {
+            if (!m_linkDecl)
+                createLinkDecl();
+            m_linkDecl->setProperty(CSS_PROP_COLOR, attr->value(), false, false);
+            RefPtr<CSSValue> val = m_linkDecl->getPropertyCSSValue(CSS_PROP_COLOR);
+            if (val && val->isPrimitiveValue()) {
+                Color col = document()->styleSelector()->getColorFromPrimitiveValue(static_cast<CSSPrimitiveValue*>(val.get()));
+                if (attr->name() == linkAttr)
+                    document()->setLinkColor(col);
+                else if (attr->name() == vlinkAttr)
+                    document()->setVisitedLinkColor(col);
+                else
+                    document()->setActiveLinkColor(col);
+            }
+        }
+        
+        if (attached())
+            document()->recalcStyle(Force);
+    } else if (attr->name() == onloadAttr) {
+        document()->setHTMLWindowEventListener(loadEvent, attr);
+    } else if (attr->name() == onbeforeunloadAttr) {
+        document()->setHTMLWindowEventListener(beforeunloadEvent, attr);
+    } else if (attr->name() == onunloadAttr) {
+        document()->setHTMLWindowEventListener(unloadEvent, attr);
+    } else if (attr->name() == onblurAttr) {
+        document()->setHTMLWindowEventListener(blurEvent, attr);
+    } else if (attr->name() == onfocusAttr) {
+        document()->setHTMLWindowEventListener(focusEvent, attr);
+    } else if (attr->name() == onresizeAttr) {
+        document()->setHTMLWindowEventListener(resizeEvent, attr);
+    } else if (attr->name() == onscrollAttr) {
+        document()->setHTMLWindowEventListener(scrollEvent, attr);
+    } else
+        HTMLElement::parseMappedAttribute(attr);
+}
+
+void HTMLBodyElement::insertedIntoDocument()
+{
+    HTMLElement::insertedIntoDocument();
+
+    // FIXME: perhaps this code should be in attach() instead of here
+
+    FrameView *w = document()->view();
+    if (w && w->marginWidth() != -1)
+        setAttribute(marginwidthAttr, String::number(w->marginWidth()));
+    if (w && w->marginHeight() != -1)
+        setAttribute(marginheightAttr, String::number(w->marginHeight()));
+
+    if (w)
+        w->scheduleRelayout();
+}
+
+bool HTMLBodyElement::isURLAttribute(Attribute *attr) const
+{
+    return attr->name() == backgroundAttr;
+}
+
+String HTMLBodyElement::aLink() const
+{
+    return getAttribute(alinkAttr);
+}
+
+void HTMLBodyElement::setALink(const String &value)
+{
+    setAttribute(alinkAttr, value);
+}
+
+String HTMLBodyElement::background() const
+{
+    return getAttribute(backgroundAttr);
+}
+
+void HTMLBodyElement::setBackground(const String &value)
+{
+    setAttribute(backgroundAttr, value);
+}
+
+String HTMLBodyElement::bgColor() const
+{
+    return getAttribute(bgcolorAttr);
+}
+
+void HTMLBodyElement::setBgColor(const String &value)
+{
+    setAttribute(bgcolorAttr, value);
+}
+
+String HTMLBodyElement::link() const
+{
+    return getAttribute(linkAttr);
+}
+
+void HTMLBodyElement::setLink(const String &value)
+{
+    setAttribute(linkAttr, value);
+}
+
+String HTMLBodyElement::text() const
+{
+    return getAttribute(textAttr);
+}
+
+void HTMLBodyElement::setText(const String &value)
+{
+    setAttribute(textAttr, value);
+}
+
+String HTMLBodyElement::vLink() const
+{
+    return getAttribute(vlinkAttr);
+}
+
+void HTMLBodyElement::setVLink(const String &value)
+{
+    setAttribute(vlinkAttr, value);
+}
+
+}
diff --git a/WebCore/html/HTMLBodyElement.h b/WebCore/html/HTMLBodyElement.h
new file mode 100644
index 0000000..2c9ede7
--- /dev/null
+++ b/WebCore/html/HTMLBodyElement.h
@@ -0,0 +1,70 @@
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ *           (C) 1999 Antti Koivisto (koivisto@kde.org)
+ *           (C) 2000 Simon Hausmann <hausmann@kde.org>
+ * Copyright (C) 2004, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef HTMLBodyElement_H
+#define HTMLBodyElement_H
+
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class HTMLBodyElement : public HTMLElement
+{
+public:
+    HTMLBodyElement(Document*);
+    ~HTMLBodyElement();
+
+    virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+    virtual int tagPriority() const { return 10; }
+    
+    virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
+    virtual void parseMappedAttribute(MappedAttribute*);
+
+    virtual void insertedIntoDocument();
+
+    void createLinkDecl();
+    
+    virtual bool isURLAttribute(Attribute*) const;
+
+    String aLink() const;
+    void setALink(const String&);
+    String background() const;
+    void setBackground(const String&);
+    String bgColor() const;
+    void setBgColor(const String&);
+    String link() const;
+    void setLink(const String&);
+    String text() const;
+    void setText(const String&);
+    String vLink() const;
+    void setVLink(const String&);
+
+protected:
+    RefPtr<CSSMutableStyleDeclaration> m_linkDecl;
+};
+
+} //namespace
+
+#endif
diff --git a/WebCore/html/HTMLDocument.cpp b/WebCore/html/HTMLDocument.cpp
index 9d76017..babbe35 100644
--- a/WebCore/html/HTMLDocument.cpp
+++ b/WebCore/html/HTMLDocument.cpp
@@ -61,7 +61,6 @@
 #include "Frame.h"
 #include "cssstyleselector.h"
 #include "CSSPropertyNames.h"
-#include "html_baseimpl.h"
 #include "html_imageimpl.h"
 #include "HTMLTokenizer.h"
 #include "HTMLElementFactory.h"
diff --git a/WebCore/html/HTMLElementFactory.cpp b/WebCore/html/HTMLElementFactory.cpp
index 9274fac..04ade81 100644
--- a/WebCore/html/HTMLElementFactory.cpp
+++ b/WebCore/html/HTMLElementFactory.cpp
@@ -26,12 +26,17 @@
 #include "HTMLAppletElement.h"
 #include "HTMLBaseFontElement.h"
 #include "HTMLBaseElement.h"
+#include "HTMLBodyElement.h"
 #include "HTMLButtonElement.h"
 #include "HTMLCanvasElement.h"
 #include "HTMLDocument.h"
 #include "HTMLEmbedElement.h"
+#include "HTMLFrameSetElement.h"
 #include "HTMLFieldSetElement.h"
 #include "HTMLFormElement.h"
+#include "HTMLHeadElement.h"
+#include "HTMLHtmlElement.h"
+#include "HTMLIFrameElement.h"
 #include "HTMLIsIndexElement.h"
 #include "HTMLLabelElement.h"
 #include "HTMLLegendElement.h"
@@ -52,7 +57,6 @@
 #include "HTMLTableRowElement.h"
 #include "HTMLTableSectionElement.h"
 #include "HTMLTitleElement.h"
-#include "html_baseimpl.h"
 #include "html_blockimpl.h"
 #include "html_listimpl.h"
 
diff --git a/WebCore/html/HTMLEmbedElement.cpp b/WebCore/html/HTMLEmbedElement.cpp
index 4a7a45c..3ec5fdc 100644
--- a/WebCore/html/HTMLEmbedElement.cpp
+++ b/WebCore/html/HTMLEmbedElement.cpp
@@ -29,8 +29,7 @@
 #include "HTMLDocument.h"
 #include "HTMLNames.h"
 #include "csshelper.h"
-#include "render_frames.h"
-#include "render_replaced.h"
+#include "RenderPartObject.h"
 
 namespace WebCore {
 
diff --git a/WebCore/html/HTMLFrameElement.cpp b/WebCore/html/HTMLFrameElement.cpp
new file mode 100644
index 0000000..5cc2894
--- /dev/null
+++ b/WebCore/html/HTMLFrameElement.cpp
@@ -0,0 +1,407 @@
+/**
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ *           (C) 1999 Antti Koivisto (koivisto@kde.org)
+ *           (C) 2000 Simon Hausmann (hausmann@kde.org)
+ *           (C) 2001 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#include "config.h"
+#include "HTMLFrameElement.h"
+
+#include "csshelper.h"
+#include "Document.h"
+#include "EventNames.h"
+#include "Frame.h"
+#include "FrameTree.h"
+#include "FrameView.h"
+#include "HTMLNames.h"
+#include "HTMLFrameSetElement.h"
+#include "Page.h"
+#include "RenderFrame.h"
+
+namespace WebCore {
+
+using namespace EventNames;
+using namespace HTMLNames;
+
+HTMLFrameElement::HTMLFrameElement(Document *doc)
+    : HTMLElement(frameTag, doc)
+{
+    init();
+}
+
+HTMLFrameElement::HTMLFrameElement(const QualifiedName& tagName, Document *doc)
+    : HTMLElement(tagName, doc)
+{
+    init();
+}
+
+void HTMLFrameElement::init()
+{
+    m_frameBorder = true;
+    m_frameBorderSet = false;
+    m_marginWidth = -1;
+    m_marginHeight = -1;
+    m_scrolling = ScrollBarAuto;
+    m_noResize = false;
+}
+
+HTMLFrameElement::~HTMLFrameElement()
+{
+}
+
+bool HTMLFrameElement::isURLAllowed(const AtomicString &URLString) const
+{
+    if (URLString.isEmpty())
+        return true;
+    
+    FrameView* w = document()->view();
+    if (!w)
+        return false;
+
+    KURL newURL(document()->completeURL(URLString.deprecatedString()));
+    newURL.setRef(DeprecatedString::null);
+
+    // Don't allow more than 1000 total frames in a set. This seems
+    // like a reasonable upper bound, and otherwise mutually recursive
+    // frameset pages can quickly bring the program to its knees with
+    // exponential growth in the number of frames.
+
+    // FIXME: This limit could be higher, but WebKit has some
+    // algorithms that happen while loading which appear to be N^2 or
+    // worse in the number of frames
+    if (w->frame()->page()->frameCount() >= 200)
+        return false;
+
+    // We allow one level of self-reference because some sites depend on that.
+    // But we don't allow more than one.
+    bool foundSelfReference = false;
+    for (Frame *frame = w->frame(); frame; frame = frame->tree()->parent()) {
+        KURL frameURL = frame->url();
+        frameURL.setRef(DeprecatedString::null);
+        if (frameURL == newURL) {
+            if (foundSelfReference)
+                return false;
+            foundSelfReference = true;
+        }
+    }
+    
+    return true;
+}
+
+void HTMLFrameElement::openURL()
+{
+    FrameView *w = document()->view();
+    if (!w)
+        return;
+    
+    AtomicString relativeURL = m_URL;
+    if (relativeURL.isEmpty())
+        relativeURL = "about:blank";
+
+    // Load the frame contents.
+    Frame* parentFrame = w->frame();
+    if (Frame* childFrame = parentFrame->tree()->child(m_name))
+        childFrame->openURL(document()->completeURL(relativeURL.deprecatedString()));
+    else
+        parentFrame->requestFrame(static_cast<RenderFrame *>(renderer()), relativeURL, m_name);
+}
+
+void HTMLFrameElement::parseMappedAttribute(MappedAttribute *attr)
+{
+    if (attr->name() == srcAttr)
+        setLocation(WebCore::parseURL(attr->value()));
+    else if (attr->name() == idAttr) {
+        // Important to call through to base for the id attribute so the hasID bit gets set.
+        HTMLElement::parseMappedAttribute(attr);
+        m_name = attr->value();
+    } else if (attr->name() == nameAttr) {
+        m_name = attr->value();
+        // FIXME: If we are already attached, this doesn't actually change the frame's name.
+        // FIXME: If we are already attached, this doesn't check for frame name
+        // conflicts and generate a unique frame name.
+    } else if (attr->name() == frameborderAttr) {
+        m_frameBorder = attr->value().toInt();
+        m_frameBorderSet = !attr->isNull();
+        // FIXME: If we are already attached, this has no effect.
+    } else if (attr->name() == marginwidthAttr) {
+        m_marginWidth = attr->value().toInt();
+        // FIXME: If we are already attached, this has no effect.
+    } else if (attr->name() == marginheightAttr) {
+        m_marginHeight = attr->value().toInt();
+        // FIXME: If we are already attached, this has no effect.
+    } else if (attr->name() == noresizeAttr) {
+        m_noResize = true;
+        // FIXME: If we are already attached, this has no effect.
+    } else if (attr->name() == scrollingAttr) {
+        // Auto and yes both simply mean "allow scrolling." No means "don't allow scrolling."
+        if (equalIgnoringCase(attr->value(), "auto") || equalIgnoringCase(attr->value(), "yes"))
+            m_scrolling = ScrollBarAuto;
+        else if (equalIgnoringCase(attr->value(), "no"))
+            m_scrolling = ScrollBarAlwaysOff;
+        // FIXME: If we are already attached, this has no effect.
+    } else if (attr->name() == onloadAttr) {
+        setHTMLEventListener(loadEvent, attr);
+    } else if (attr->name() == onbeforeunloadAttr) {
+        // FIXME: should <frame> elements have beforeunload handlers?
+        setHTMLEventListener(beforeunloadEvent, attr);
+    } else if (attr->name() == onunloadAttr) {
+        setHTMLEventListener(unloadEvent, attr);
+    } else
+        HTMLElement::parseMappedAttribute(attr);
+}
+
+bool HTMLFrameElement::rendererIsNeeded(RenderStyle *style)
+{
+    // Ignore display: none.
+    return isURLAllowed(m_URL);
+}
+
+RenderObject *HTMLFrameElement::createRenderer(RenderArena *arena, RenderStyle *style)
+{
+    return new (arena) RenderFrame(this);
+}
+
+void HTMLFrameElement::attach()
+{
+    m_name = getAttribute(nameAttr);
+    if (m_name.isNull())
+        m_name = getAttribute(idAttr);
+
+    // inherit default settings from parent frameset
+    for (Node *node = parentNode(); node; node = node->parentNode())
+        if (node->hasTagName(framesetTag)) {
+            HTMLFrameSetElement* frameset = static_cast<HTMLFrameSetElement*>(node);
+            if (!m_frameBorderSet)
+                m_frameBorder = frameset->frameBorder();
+            if (!m_noResize)
+                m_noResize = frameset->noResize();
+            break;
+        }
+
+    HTMLElement::attach();
+
+    if (!renderer())
+        return;
+
+    Frame* frame = document()->frame();
+
+    if (!frame)
+        return;
+
+    frame->page()->incrementFrameCount();
+    
+    AtomicString relativeURL = m_URL;
+    if (relativeURL.isEmpty())
+        relativeURL = "about:blank";
+
+    m_name = frame->tree()->uniqueChildName(m_name);
+
+    // load the frame contents
+    frame->requestFrame(static_cast<RenderFrame*>(renderer()), relativeURL, m_name);
+}
+
+void HTMLFrameElement::close()
+{
+    Frame* frame = document()->frame();
+    if (renderer() && frame) {
+        frame->page()->decrementFrameCount();
+        if (Frame* childFrame = frame->tree()->child(m_name))
+            childFrame->frameDetached();
+    }
+}
+
+void HTMLFrameElement::willRemove()
+{
+    // close the frame and dissociate the renderer, but leave the
+    // node attached so that frame does not get re-attached before
+    // actually leaving the document.  see <rdar://problem/4132581>
+    close();
+    if (renderer()) {
+        renderer()->destroy();
+        setRenderer(0);
+    }
+    
+    HTMLElement::willRemove();
+}
+
+void HTMLFrameElement::detach()
+{
+    close();
+    HTMLElement::detach();
+}
+
+void HTMLFrameElement::setLocation(const String& str)
+{
+    m_URL = AtomicString(str);
+
+    if (!attached()) {
+        return;
+    }
+    
+    // Handle the common case where we decided not to make a frame the first time.
+    // Detach and the let attach() decide again whether to make the frame for this URL.
+    if (!renderer()) {
+        detach();
+        attach();
+        return;
+    }
+    
+    if (!isURLAllowed(m_URL))
+        return;
+
+    openURL();
+}
+
+bool HTMLFrameElement::isFocusable() const
+{
+    return renderer();
+}
+
+void HTMLFrameElement::setFocus(bool received)
+{
+    HTMLElement::setFocus(received);
+    WebCore::RenderFrame *renderFrame = static_cast<WebCore::RenderFrame *>(renderer());
+    if (!renderFrame || !renderFrame->widget())
+        return;
+    if (received)
+        renderFrame->widget()->setFocus();
+    else
+        renderFrame->widget()->clearFocus();
+}
+
+Frame* HTMLFrameElement::contentFrame() const
+{
+    // Start with the part that contains this element, our ownerDocument.
+    Frame* parentFrame = document()->frame();
+    if (!parentFrame)
+        return 0;
+
+    // Find the part for the subframe that this element represents.
+    return parentFrame->tree()->child(m_name);
+}
+
+Document* HTMLFrameElement::contentDocument() const
+{
+    Frame* frame = contentFrame();
+    if (!frame)
+        return 0;
+    return frame->document();
+}
+
+bool HTMLFrameElement::isURLAttribute(Attribute *attr) const
+{
+    return attr->name() == srcAttr;
+}
+
+String HTMLFrameElement::frameBorder() const
+{
+    return getAttribute(frameborderAttr);
+}
+
+void HTMLFrameElement::setFrameBorder(const String &value)
+{
+    setAttribute(frameborderAttr, value);
+}
+
+String HTMLFrameElement::longDesc() const
+{
+    return getAttribute(longdescAttr);
+}
+
+void HTMLFrameElement::setLongDesc(const String &value)
+{
+    setAttribute(longdescAttr, value);
+}
+
+String HTMLFrameElement::marginHeight() const
+{
+    return getAttribute(marginheightAttr);
+}
+
+void HTMLFrameElement::setMarginHeight(const String &value)
+{
+    setAttribute(marginheightAttr, value);
+}
+
+String HTMLFrameElement::marginWidth() const
+{
+    return getAttribute(marginwidthAttr);
+}
+
+void HTMLFrameElement::setMarginWidth(const String &value)
+{
+    setAttribute(marginwidthAttr, value);
+}
+
+String HTMLFrameElement::name() const
+{
+    return getAttribute(nameAttr);
+}
+
+void HTMLFrameElement::setName(const String &value)
+{
+    setAttribute(nameAttr, value);
+}
+
+void HTMLFrameElement::setNoResize(bool noResize)
+{
+    setAttribute(noresizeAttr, noResize ? "" : 0);
+}
+
+String HTMLFrameElement::scrolling() const
+{
+    return getAttribute(scrollingAttr);
+}
+
+void HTMLFrameElement::setScrolling(const String &value)
+{
+    setAttribute(scrollingAttr, value);
+}
+
+String HTMLFrameElement::src() const
+{
+    return getAttribute(srcAttr);
+}
+
+void HTMLFrameElement::setSrc(const String &value)
+{
+    setAttribute(srcAttr, value);
+}
+
+int HTMLFrameElement::frameWidth() const
+{
+    if (!renderer())
+        return 0;
+    
+    document()->updateLayoutIgnorePendingStylesheets();
+    return renderer()->width();
+}
+
+int HTMLFrameElement::frameHeight() const
+{
+    if (!renderer())
+        return 0;
+    
+    document()->updateLayoutIgnorePendingStylesheets();
+    return renderer()->height();
+}
+
+}
diff --git a/WebCore/html/HTMLFrameElement.h b/WebCore/html/HTMLFrameElement.h
new file mode 100644
index 0000000..143e71a
--- /dev/null
+++ b/WebCore/html/HTMLFrameElement.h
@@ -0,0 +1,119 @@
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ *           (C) 1999 Antti Koivisto (koivisto@kde.org)
+ *           (C) 2000 Simon Hausmann <hausmann@kde.org>
+ * Copyright (C) 2004, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef HTMLFrameElement_H
+#define HTMLFrameElement_H
+
+#include "HTMLElement.h"
+#include "ScrollBarMode.h"
+
+namespace WebCore {
+
+class Frame;
+
+class HTMLFrameElement : public HTMLElement
+{
+    friend class RenderFrame;
+    friend class RenderPartObject;
+
+public:
+    HTMLFrameElement(Document*);
+    HTMLFrameElement(const QualifiedName&, Document*);
+    ~HTMLFrameElement();
+
+    void init();
+
+    virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
+    virtual int tagPriority() const { return 0; }
+  
+    virtual void parseMappedAttribute(MappedAttribute*);
+    virtual void attach();
+    void close();
+    virtual void willRemove();
+    virtual void detach();
+    virtual bool rendererIsNeeded(RenderStyle*);
+    virtual RenderObject *createRenderer(RenderArena*, RenderStyle*);
+
+    bool noResize() { return m_noResize; }
+
+    void setLocation(const String&);
+
+    virtual bool isFocusable() const;
+    virtual void setFocus(bool);
+
+    Frame* contentFrame() const;
+    Document* contentDocument() const;
+    
+    virtual bool isURLAttribute(Attribute*) const;
+
+    ScrollBarMode scrollingMode() const { return m_scrolling; }
+    int getMarginWidth() const { return m_marginWidth; }
+    int getMarginHeight() const { return m_marginHeight; }
+
+    String frameBorder() const;
+    void setFrameBorder(const String&);
+
+    String longDesc() const;
+    void setLongDesc(const String&);
+
+    String marginHeight() const;
+    void setMarginHeight(const String&);
+
+    String marginWidth() const;
+    void setMarginWidth(const String&);
+
+    String name() const;
+    void setName(const String&);
+
+    void setNoResize(bool);
+
+    String scrolling() const;
+    void setScrolling(const String&);
+
+    virtual String src() const;
+    void setSrc(const String&);
+
+    int frameWidth() const;
+    int frameHeight() const;
+
+protected:
+    bool isURLAllowed(const AtomicString&) const;
+    virtual void openURL();
+
+    AtomicString m_URL;
+    AtomicString m_name;
+
+    int m_marginWidth;
+    int m_marginHeight;
+    ScrollBarMode m_scrolling;
+
+    bool m_frameBorder : 1;
+    bool m_frameBorderSet : 1;
+    bool m_noResize : 1;
+};
+
+} //namespace
+
+#endif
diff --git a/WebCore/html/HTMLFrameSetElement.cpp b/WebCore/html/HTMLFrameSetElement.cpp
new file mode 100644
index 0000000..66d533e
--- /dev/null
+++ b/WebCore/html/HTMLFrameSetElement.cpp
@@ -0,0 +1,172 @@
+/**
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ *           (C) 1999 Antti Koivisto (koivisto@kde.org)
+ *           (C) 2000 Simon Hausmann (hausmann@kde.org)
+ *           (C) 2001 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#include "config.h"
+#include "HTMLFrameSetElement.h"
+
+#include "Document.h"
+#include "EventNames.h"
+#include "HTMLNames.h"
+#include "Length.h"
+#include "dom2_eventsimpl.h"
+#include "RenderFrameSet.h"
+
+namespace WebCore {
+
+using namespace EventNames;
+using namespace HTMLNames;
+
+HTMLFrameSetElement::HTMLFrameSetElement(Document *doc)
+    : HTMLElement(framesetTag, doc)
+    , m_rows(0)
+    , m_cols(0)
+    , m_totalRows(1)
+    , m_totalCols(1)
+    , m_border(4)
+    , frameborder(true)
+    , frameBorderSet(false)
+    , noresize(false)
+{
+}
+
+HTMLFrameSetElement::~HTMLFrameSetElement()
+{
+    if (m_rows)
+        delete [] m_rows;
+    if (m_cols)
+        delete [] m_cols;
+}
+
+bool HTMLFrameSetElement::checkDTD(const Node* newChild)
+{
+    // FIXME: Old code had adjacent double returns and seemed to want to do something with NOFRAMES (but didn't).
+    // What is the correct behavior?
+    return newChild->hasTagName(framesetTag) || newChild->hasTagName(frameTag);
+}
+
+void HTMLFrameSetElement::parseMappedAttribute(MappedAttribute *attr)
+{
+    if (attr->name() == rowsAttr) {
+        if (!attr->isNull()) {
+            if (m_rows) delete [] m_rows;
+            m_rows = attr->value().toLengthArray(m_totalRows);
+            setChanged();
+        }
+    } else if (attr->name() == colsAttr) {
+        if (!attr->isNull()) {
+            delete [] m_cols;
+            m_cols = attr->value().toLengthArray(m_totalCols);
+            setChanged();
+        }
+    } else if (attr->name() == frameborderAttr) {
+        // false or "no" or "0"..
+        if (attr->value().toInt() == 0) {
+            frameborder = false;
+            m_border = 0;
+        }
+        frameBorderSet = true;
+    } else if (attr->name() == noresizeAttr) {
+        noresize = true;
+    } else if (attr->name() == borderAttr) {
+        m_border = attr->value().toInt();
+        if(!m_border)
+            frameborder = false;
+    } else if (attr->name() == onloadAttr) {
+        document()->setHTMLWindowEventListener(loadEvent, attr);
+    } else if (attr->name() == onbeforeunloadAttr) {
+        document()->setHTMLWindowEventListener(beforeunloadEvent, attr);
+    } else if (attr->name() == onunloadAttr) {
+        document()->setHTMLWindowEventListener(unloadEvent, attr);
+    } else
+        HTMLElement::parseMappedAttribute(attr);
+}
+
+bool HTMLFrameSetElement::rendererIsNeeded(RenderStyle *style)
+{
+    // Ignore display: none but do pay attention if a stylesheet has caused us to delay our loading.
+    return style->isStyleAvailable();
+}
+
+RenderObject *HTMLFrameSetElement::createRenderer(RenderArena *arena, RenderStyle *style)
+{
+    return new (arena) RenderFrameSet(this);
+}
+
+void HTMLFrameSetElement::attach()
+{
+    // inherit default settings from parent frameset
+    HTMLElement* node = static_cast<HTMLElement*>(parentNode());
+    while (node) {
+        if (node->hasTagName(framesetTag)) {
+            HTMLFrameSetElement* frameset = static_cast<HTMLFrameSetElement*>(node);
+            if(!frameBorderSet)  frameborder = frameset->frameBorder();
+            if(!noresize)  noresize = frameset->noResize();
+            break;
+        }
+        node = static_cast<HTMLElement*>(node->parentNode());
+    }
+
+    HTMLElement::attach();
+}
+
+void HTMLFrameSetElement::defaultEventHandler(Event* evt)
+{
+    if (evt->isMouseEvent() && !noresize && renderer()) {
+        static_cast<WebCore::RenderFrameSet*>(renderer())->userResize(static_cast<MouseEvent*>(evt));
+        evt->setDefaultHandled();
+    }
+
+    HTMLElement::defaultEventHandler(evt);
+}
+
+void HTMLFrameSetElement::recalcStyle(StyleChange ch)
+{
+    if (changed() && renderer()) {
+        renderer()->setNeedsLayout(true);
+        setChanged(false);
+    }
+    HTMLElement::recalcStyle(ch);
+}
+
+String HTMLFrameSetElement::cols() const
+{
+    return getAttribute(colsAttr);
+}
+
+void HTMLFrameSetElement::setCols(const String &value)
+{
+    setAttribute(colsAttr, value);
+}
+
+String HTMLFrameSetElement::rows() const
+{
+    return getAttribute(rowsAttr);
+}
+
+void HTMLFrameSetElement::setRows(const String &value)
+{
+    setAttribute(rowsAttr, value);
+}
+
+}
diff --git a/WebCore/html/HTMLFrameSetElement.h b/WebCore/html/HTMLFrameSetElement.h
new file mode 100644
index 0000000..e77e702
--- /dev/null
+++ b/WebCore/html/HTMLFrameSetElement.h
@@ -0,0 +1,81 @@
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ *           (C) 1999 Antti Koivisto (koivisto@kde.org)
+ *           (C) 2000 Simon Hausmann <hausmann@kde.org>
+ * Copyright (C) 2004, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef HTMLFrameSetElement_H
+#define HTMLFrameSetElement_H
+
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class HTMLFrameSetElement : public HTMLElement
+{
+    friend class RenderFrameSet;
+public:
+    HTMLFrameSetElement(Document*);
+    ~HTMLFrameSetElement();
+
+    virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+    virtual int tagPriority() const { return 10; }
+    virtual bool checkDTD(const Node* newChild);
+
+    virtual void parseMappedAttribute(MappedAttribute*);
+    virtual void attach();
+    virtual bool rendererIsNeeded(RenderStyle*);
+    virtual RenderObject *createRenderer(RenderArena*, RenderStyle*);
+
+    virtual void defaultEventHandler(Event*);
+
+    bool frameBorder() { return frameborder; }
+    bool noResize() { return noresize; }
+
+    int totalRows() const { return m_totalRows; }
+    int totalCols() const { return m_totalCols; }
+    int border() const { return m_border; }
+
+    virtual void recalcStyle( StyleChange ch );
+    
+    String cols() const;
+    void setCols(const String&);
+
+    String rows() const;
+    void setRows(const String&);
+
+protected:
+    Length* m_rows;
+    Length* m_cols;
+
+    int m_totalRows;
+    int m_totalCols;
+    int m_border;
+
+    bool frameborder : 1;
+    bool frameBorderSet : 1;
+    bool noresize : 1;
+};
+
+} //namespace
+
+#endif
diff --git a/WebCore/html/HTMLHeadElement.cpp b/WebCore/html/HTMLHeadElement.cpp
new file mode 100644
index 0000000..0602495
--- /dev/null
+++ b/WebCore/html/HTMLHeadElement.cpp
@@ -0,0 +1,61 @@
+/**
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ *           (C) 1999 Antti Koivisto (koivisto@kde.org)
+ *           (C) 2000 Simon Hausmann (hausmann@kde.org)
+ *           (C) 2001 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#include "config.h"
+#include "HTMLHeadElement.h"
+
+#include "HTMLNames.h"
+
+namespace WebCore {
+
+using namespace HTMLNames;
+
+HTMLHeadElement::HTMLHeadElement(Document* doc)
+    : HTMLElement(headTag, doc)
+{
+}
+
+HTMLHeadElement::~HTMLHeadElement()
+{
+}
+
+String HTMLHeadElement::profile() const
+{
+    return getAttribute(profileAttr);
+}
+
+void HTMLHeadElement::setProfile(const String &value)
+{
+    setAttribute(profileAttr, value);
+}
+
+bool HTMLHeadElement::checkDTD(const Node* newChild)
+{
+    return newChild->hasTagName(titleTag) || newChild->hasTagName(isindexTag) ||
+           newChild->hasTagName(baseTag) || newChild->hasTagName(scriptTag) ||
+           newChild->hasTagName(styleTag) || newChild->hasTagName(metaTag) ||
+           newChild->hasTagName(linkTag) || newChild->isTextNode();
+}
+
+}
diff --git a/WebCore/html/HTMLHeadElement.h b/WebCore/html/HTMLHeadElement.h
new file mode 100644
index 0000000..7931a31
--- /dev/null
+++ b/WebCore/html/HTMLHeadElement.h
@@ -0,0 +1,49 @@
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ *           (C) 1999 Antti Koivisto (koivisto@kde.org)
+ *           (C) 2000 Simon Hausmann <hausmann@kde.org>
+ * Copyright (C) 2004, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef HTMLHeadElement_H
+#define HTMLHeadElement_H
+
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class HTMLHeadElement : public HTMLElement
+{
+public:
+    HTMLHeadElement(Document*);
+    ~HTMLHeadElement();
+
+    virtual HTMLTagStatus endTagRequirement() const { return TagStatusOptional; }
+    virtual int tagPriority() const { return 10; }
+    virtual bool checkDTD(const Node* newChild);
+
+    String profile() const;
+    void setProfile(const String&);
+};
+
+} //namespace
+
+#endif
diff --git a/WebCore/html/HTMLHtmlElement.cpp b/WebCore/html/HTMLHtmlElement.cpp
new file mode 100644
index 0000000..e4d3b36
--- /dev/null
+++ b/WebCore/html/HTMLHtmlElement.cpp
@@ -0,0 +1,61 @@
+/**
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ *           (C) 1999 Antti Koivisto (koivisto@kde.org)
+ *           (C) 2000 Simon Hausmann (hausmann@kde.org)
+ *           (C) 2001 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#include "config.h"
+#include "HTMLHtmlElement.h"
+
+#include "HTMLNames.h"
+
+namespace WebCore {
+
+using namespace HTMLNames;
+
+HTMLHtmlElement::HTMLHtmlElement(Document* doc)
+    : HTMLElement(htmlTag, doc)
+{
+}
+
+HTMLHtmlElement::~HTMLHtmlElement()
+{
+}
+
+String HTMLHtmlElement::version() const
+{
+    return getAttribute(versionAttr);
+}
+
+void HTMLHtmlElement::setVersion(const String &value)
+{
+    setAttribute(versionAttr, value);
+}
+
+bool HTMLHtmlElement::checkDTD(const Node* newChild)
+{
+    // FIXME: Why is <script> allowed here?
+    return newChild->hasTagName(headTag) || newChild->hasTagName(bodyTag) ||
+           newChild->hasTagName(framesetTag) || newChild->hasTagName(noframesTag) ||
+           newChild->hasTagName(scriptTag);
+}
+
+}
diff --git a/WebCore/html/HTMLHtmlElement.h b/WebCore/html/HTMLHtmlElement.h
new file mode 100644
index 0000000..20bca02
--- /dev/null
+++ b/WebCore/html/HTMLHtmlElement.h
@@ -0,0 +1,49 @@
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ *           (C) 1999 Antti Koivisto (koivisto@kde.org)
+ *           (C) 2000 Simon Hausmann <hausmann@kde.org>
+ * Copyright (C) 2004, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef HTMLHtmlElement_H
+#define HTMLHtmlElement_H
+
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class HTMLHtmlElement : public HTMLElement
+{
+public:
+    HTMLHtmlElement(Document*);
+    ~HTMLHtmlElement();
+
+    virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+    virtual int tagPriority() const { return 11; }
+    virtual bool checkDTD(const Node* newChild);
+
+    String version() const;
+    void setVersion(const String&);
+};
+
+} //namespace
+
+#endif
diff --git a/WebCore/html/HTMLIFrameElement.cpp b/WebCore/html/HTMLIFrameElement.cpp
new file mode 100644
index 0000000..6e9a835
--- /dev/null
+++ b/WebCore/html/HTMLIFrameElement.cpp
@@ -0,0 +1,192 @@
+/**
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ *           (C) 1999 Antti Koivisto (koivisto@kde.org)
+ *           (C) 2000 Simon Hausmann (hausmann@kde.org)
+ *           (C) 2001 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#include "config.h"
+#include "HTMLIFrameElement.h"
+
+#include "CSSPropertyNames.h"
+#include "Frame.h"
+#include "FrameTree.h"
+#include "HTMLDocument.h"
+#include "HTMLNames.h"
+#include "Page.h"
+#include "RenderPartObject.h"
+
+namespace WebCore {
+
+using namespace HTMLNames;
+
+HTMLIFrameElement::HTMLIFrameElement(Document* doc)
+    : HTMLFrameElement(iframeTag, doc)
+    , needWidgetUpdate(false)
+{
+    m_frameBorder = false;
+    m_marginWidth = -1;
+    m_marginHeight = -1;
+}
+
+HTMLIFrameElement::~HTMLIFrameElement()
+{
+}
+
+bool HTMLIFrameElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const
+{
+    if (attrName == widthAttr || attrName == heightAttr) {
+        result = eUniversal;
+        return false;
+    }
+    
+    if (attrName == alignAttr) {
+        result = eReplaced; // Share with <img> since the alignment behavior is the same.
+        return false;
+    }
+    
+    return HTMLElement::mapToEntry(attrName, result);
+}
+
+void HTMLIFrameElement::parseMappedAttribute(MappedAttribute *attr)
+{
+    if (attr->name() == widthAttr)
+        addCSSLength(attr, CSS_PROP_WIDTH, attr->value());
+    else if (attr->name() == heightAttr)
+        addCSSLength(attr, CSS_PROP_HEIGHT, attr->value());
+    else if (attr->name() == alignAttr)
+        addHTMLAlignment(attr);
+    else if (attr->name() == nameAttr) {
+        String newNameAttr = attr->value();
+        if (inDocument() && document()->isHTMLDocument()) {
+            HTMLDocument *doc = static_cast<HTMLDocument *>(document());
+            doc->removeDocExtraNamedItem(oldNameAttr);
+            doc->addDocExtraNamedItem(newNameAttr);
+        }
+        oldNameAttr = newNameAttr;
+    } else
+        HTMLFrameElement::parseMappedAttribute(attr);
+}
+
+void HTMLIFrameElement::insertedIntoDocument()
+{
+    if (document()->isHTMLDocument()) {
+        HTMLDocument *doc = static_cast<HTMLDocument *>(document());
+        doc->addDocExtraNamedItem(oldNameAttr);
+    }
+
+    HTMLElement::insertedIntoDocument();
+}
+
+void HTMLIFrameElement::removedFromDocument()
+{
+    if (document()->isHTMLDocument()) {
+        HTMLDocument *doc = static_cast<HTMLDocument *>(document());
+        doc->removeDocExtraNamedItem(oldNameAttr);
+    }
+
+    HTMLElement::removedFromDocument();
+}
+
+bool HTMLIFrameElement::rendererIsNeeded(RenderStyle *style)
+{
+    // Don't ignore display: none the way frame does.
+    return isURLAllowed(m_URL) && style->display() != NONE;
+}
+
+RenderObject *HTMLIFrameElement::createRenderer(RenderArena *arena, RenderStyle *style)
+{
+    return new (arena) RenderPartObject(this);
+}
+
+void HTMLIFrameElement::attach()
+{
+    m_name = getAttribute(nameAttr);
+    if (m_name.isNull())
+        m_name = getAttribute(idAttr);
+
+    HTMLElement::attach();
+
+    Frame* parentFrame = document()->frame();
+    if (renderer() && parentFrame) {
+        parentFrame->page()->incrementFrameCount();
+        m_name = parentFrame->tree()->uniqueChildName(m_name);
+        static_cast<RenderPartObject*>(renderer())->updateWidget();
+        needWidgetUpdate = false;
+    }
+}
+
+void HTMLIFrameElement::recalcStyle( StyleChange ch )
+{
+    if (needWidgetUpdate) {
+        if (renderer())
+            static_cast<RenderPartObject*>(renderer())->updateWidget();
+        needWidgetUpdate = false;
+    }
+    HTMLElement::recalcStyle( ch );
+}
+
+void HTMLIFrameElement::openURL()
+{
+    needWidgetUpdate = true;
+    setChanged();
+}
+
+bool HTMLIFrameElement::isURLAttribute(Attribute *attr) const
+{
+    return attr->name() == srcAttr;
+}
+
+String HTMLIFrameElement::align() const
+{
+    return getAttribute(alignAttr);
+}
+
+void HTMLIFrameElement::setAlign(const String &value)
+{
+    setAttribute(alignAttr, value);
+}
+
+String HTMLIFrameElement::height() const
+{
+    return getAttribute(heightAttr);
+}
+
+void HTMLIFrameElement::setHeight(const String &value)
+{
+    setAttribute(heightAttr, value);
+}
+
+String HTMLIFrameElement::src() const
+{
+    return document()->completeURL(getAttribute(srcAttr));
+}
+
+String HTMLIFrameElement::width() const
+{
+    return getAttribute(widthAttr);
+}
+
+void HTMLIFrameElement::setWidth(const String &value)
+{
+    setAttribute(widthAttr, value);
+}
+
+}
diff --git a/WebCore/html/HTMLIFrameElement.h b/WebCore/html/HTMLIFrameElement.h
new file mode 100644
index 0000000..176bad6
--- /dev/null
+++ b/WebCore/html/HTMLIFrameElement.h
@@ -0,0 +1,77 @@
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ *           (C) 1999 Antti Koivisto (koivisto@kde.org)
+ *           (C) 2000 Simon Hausmann <hausmann@kde.org>
+ * Copyright (C) 2004, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef HTMLIFrameElement_H
+#define HTMLIFrameElement_H
+
+#include "HTMLFrameElement.h"
+
+namespace WebCore {
+
+class HTMLIFrameElement : public HTMLFrameElement
+{
+public:
+    HTMLIFrameElement(Document *doc);
+    ~HTMLIFrameElement();
+
+    virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+    virtual int tagPriority() const { return 1; }
+
+    virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
+    virtual void parseMappedAttribute(MappedAttribute*);
+
+    virtual void insertedIntoDocument();
+    virtual void removedFromDocument();
+
+    virtual void attach();
+    virtual bool rendererIsNeeded(RenderStyle*);
+    virtual RenderObject *createRenderer(RenderArena*, RenderStyle*);
+    virtual void recalcStyle(StyleChange);
+    
+    virtual bool isURLAttribute(Attribute*) const;
+
+    String align() const;
+    void setAlign(const String&);
+
+    String height() const;
+    void setHeight(const String&);
+
+    String width() const;
+    void setWidth(const String&);
+
+    virtual String src() const;
+
+protected:
+    virtual void openURL();
+
+    bool needWidgetUpdate;
+
+ private:
+    String oldNameAttr;
+};
+
+} //namespace
+
+#endif
diff --git a/WebCore/html/HTMLObjectElement.cpp b/WebCore/html/HTMLObjectElement.cpp
index 04e7639..ceb0e30 100644
--- a/WebCore/html/HTMLObjectElement.cpp
+++ b/WebCore/html/HTMLObjectElement.cpp
@@ -30,11 +30,11 @@
 #include "HTMLDocument.h"
 #include "HTMLNames.h"
 #include "RenderImage.h"
+#include "RenderPartObject.h"
+#include "RenderWidget.h"
 #include "Text.h"
 #include "csshelper.h"
 #include "html_imageimpl.h"
-#include "render_frames.h"
-#include "render_replaced.h"
 
 namespace WebCore {
 
diff --git a/WebCore/html/HTMLParser.cpp b/WebCore/html/HTMLParser.cpp
index 7b2448d..448197f 100644
--- a/WebCore/html/HTMLParser.cpp
+++ b/WebCore/html/HTMLParser.cpp
@@ -31,9 +31,12 @@
 #include "Comment.h"
 #include "DocumentFragment.h"
 #include "Frame.h"
+#include "HTMLBodyElement.h"
 #include "HTMLCanvasElement.h"
 #include "HTMLElementFactory.h"
 #include "HTMLFormElement.h"
+#include "HTMLHeadElement.h"
+#include "HTMLHtmlElement.h"
 #include "HTMLIsIndexElement.h"
 #include "HTMLTableCellElement.h"
 #include "HTMLTableRowElement.h"
@@ -41,7 +44,6 @@
 #include "HTMLTokenizer.h"
 #include "LocalizedStrings.h"
 #include "Text.h"
-#include "html_baseimpl.h"
 #include "html_blockimpl.h"
 #include "html_listimpl.h"
 
diff --git a/WebCore/html/html_baseimpl.cpp b/WebCore/html/html_baseimpl.cpp
deleted file mode 100644
index 3201234..0000000
--- a/WebCore/html/html_baseimpl.cpp
+++ /dev/null
@@ -1,955 +0,0 @@
-/**
- * This file is part of the DOM implementation for KDE.
- *
- * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
- *           (C) 1999 Antti Koivisto (koivisto@kde.org)
- *           (C) 2000 Simon Hausmann (hausmann@kde.org)
- *           (C) 2001 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2004, 2006 Apple Computer, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-// -------------------------------------------------------------------------
-
-#include "config.h"
-#include "html_baseimpl.h"
-
-#include "CSSPropertyNames.h"
-#include "CSSValueKeywords.h"
-#include "EventNames.h"
-#include "Frame.h"
-#include "FrameTree.h"
-#include "HTMLDocument.h"
-#include "HTMLNames.h"
-#include "Page.h"
-#include "css_stylesheetimpl.h"
-#include "csshelper.h"
-#include "cssstyleselector.h"
-#include "dom2_eventsimpl.h"
-#include "render_frames.h"
-
-namespace WebCore {
-
-using namespace EventNames;
-using namespace HTMLNames;
-
-HTMLBodyElement::HTMLBodyElement(Document *doc)
-    : HTMLElement(bodyTag, doc)
-{
-}
-
-HTMLBodyElement::~HTMLBodyElement()
-{
-    if (m_linkDecl) {
-        m_linkDecl->setNode(0);
-        m_linkDecl->setParent(0);
-    }
-}
-
-void HTMLBodyElement::createLinkDecl()
-{
-    m_linkDecl = new CSSMutableStyleDeclaration;
-    m_linkDecl->setParent(document()->elementSheet());
-    m_linkDecl->setNode(this);
-    m_linkDecl->setStrictParsing(!document()->inCompatMode());
-}
-
-bool HTMLBodyElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const
-{
-    if (attrName == backgroundAttr) {
-        result = (MappedAttributeEntry)(eLastEntry + document()->docID());
-        return false;
-    } 
-    
-    if (attrName == bgcolorAttr ||
-        attrName == textAttr ||
-        attrName == marginwidthAttr ||
-        attrName == leftmarginAttr ||
-        attrName == marginheightAttr ||
-        attrName == topmarginAttr ||
-        attrName == bgpropertiesAttr) {
-        result = eUniversal;
-        return false;
-    }
-
-    return HTMLElement::mapToEntry(attrName, result);
-}
-
-void HTMLBodyElement::parseMappedAttribute(MappedAttribute *attr)
-{
-    if (attr->name() == backgroundAttr) {
-        String url = WebCore::parseURL(attr->value());
-        if (!url.isEmpty())
-            addCSSImageProperty(attr, CSS_PROP_BACKGROUND_IMAGE, document()->completeURL(url));
-    } else if (attr->name() == marginwidthAttr || attr->name() == leftmarginAttr) {
-        addCSSLength(attr, CSS_PROP_MARGIN_RIGHT, attr->value());
-        addCSSLength(attr, CSS_PROP_MARGIN_LEFT, attr->value());
-    } else if (attr->name() == marginheightAttr || attr->name() == topmarginAttr) {
-        addCSSLength(attr, CSS_PROP_MARGIN_BOTTOM, attr->value());
-        addCSSLength(attr, CSS_PROP_MARGIN_TOP, attr->value());
-    } else if (attr->name() == bgcolorAttr) {
-        addCSSColor(attr, CSS_PROP_BACKGROUND_COLOR, attr->value());
-    } else if (attr->name() == textAttr) {
-        addCSSColor(attr, CSS_PROP_COLOR, attr->value());
-    } else if (attr->name() == bgpropertiesAttr) {
-        if (equalIgnoringCase(attr->value(), "fixed"))
-            addCSSProperty(attr, CSS_PROP_BACKGROUND_ATTACHMENT, CSS_VAL_FIXED);
-    } else if (attr->name() == vlinkAttr ||
-               attr->name() == alinkAttr ||
-               attr->name() == linkAttr) {
-        if (attr->isNull()) {
-            if (attr->name() == linkAttr)
-                document()->resetLinkColor();
-            else if (attr->name() == vlinkAttr)
-                document()->resetVisitedLinkColor();
-            else
-                document()->resetActiveLinkColor();
-        }
-        else {
-            if (!m_linkDecl)
-                createLinkDecl();
-            m_linkDecl->setProperty(CSS_PROP_COLOR, attr->value(), false, false);
-            RefPtr<CSSValue> val = m_linkDecl->getPropertyCSSValue(CSS_PROP_COLOR);
-            if (val && val->isPrimitiveValue()) {
-                Color col = document()->styleSelector()->getColorFromPrimitiveValue(static_cast<CSSPrimitiveValue*>(val.get()));
-                if (attr->name() == linkAttr)
-                    document()->setLinkColor(col);
-                else if (attr->name() == vlinkAttr)
-                    document()->setVisitedLinkColor(col);
-                else
-                    document()->setActiveLinkColor(col);
-            }
-        }
-        
-        if (attached())
-            document()->recalcStyle(Force);
-    } else if (attr->name() == onloadAttr) {
-        document()->setHTMLWindowEventListener(loadEvent, attr);
-    } else if (attr->name() == onbeforeunloadAttr) {
-        document()->setHTMLWindowEventListener(beforeunloadEvent, attr);
-    } else if (attr->name() == onunloadAttr) {
-        document()->setHTMLWindowEventListener(unloadEvent, attr);
-    } else if (attr->name() == onblurAttr) {
-        document()->setHTMLWindowEventListener(blurEvent, attr);
-    } else if (attr->name() == onfocusAttr) {
-        document()->setHTMLWindowEventListener(focusEvent, attr);
-    } else if (attr->name() == onresizeAttr) {
-        document()->setHTMLWindowEventListener(resizeEvent, attr);
-    } else if (attr->name() == onscrollAttr) {
-        document()->setHTMLWindowEventListener(scrollEvent, attr);
-    } else
-        HTMLElement::parseMappedAttribute(attr);
-}
-
-void HTMLBodyElement::insertedIntoDocument()
-{
-    HTMLElement::insertedIntoDocument();
-
-    // FIXME: perhaps this code should be in attach() instead of here
-
-    FrameView *w = document()->view();
-    if (w && w->marginWidth() != -1)
-        setAttribute(marginwidthAttr, String::number(w->marginWidth()));
-    if (w && w->marginHeight() != -1)
-        setAttribute(marginheightAttr, String::number(w->marginHeight()));
-
-    if (w)
-        w->scheduleRelayout();
-}
-
-bool HTMLBodyElement::isURLAttribute(Attribute *attr) const
-{
-    return attr->name() == backgroundAttr;
-}
-
-String HTMLBodyElement::aLink() const
-{
-    return getAttribute(alinkAttr);
-}
-
-void HTMLBodyElement::setALink(const String &value)
-{
-    setAttribute(alinkAttr, value);
-}
-
-String HTMLBodyElement::background() const
-{
-    return getAttribute(backgroundAttr);
-}
-
-void HTMLBodyElement::setBackground(const String &value)
-{
-    setAttribute(backgroundAttr, value);
-}
-
-String HTMLBodyElement::bgColor() const
-{
-    return getAttribute(bgcolorAttr);
-}
-
-void HTMLBodyElement::setBgColor(const String &value)
-{
-    setAttribute(bgcolorAttr, value);
-}
-
-String HTMLBodyElement::link() const
-{
-    return getAttribute(linkAttr);
-}
-
-void HTMLBodyElement::setLink(const String &value)
-{
-    setAttribute(linkAttr, value);
-}
-
-String HTMLBodyElement::text() const
-{
-    return getAttribute(textAttr);
-}
-
-void HTMLBodyElement::setText(const String &value)
-{
-    setAttribute(textAttr, value);
-}
-
-String HTMLBodyElement::vLink() const
-{
-    return getAttribute(vlinkAttr);
-}
-
-void HTMLBodyElement::setVLink(const String &value)
-{
-    setAttribute(vlinkAttr, value);
-}
-
-// -------------------------------------------------------------------------
-
-HTMLFrameElement::HTMLFrameElement(Document *doc)
-    : HTMLElement(frameTag, doc)
-{
-    init();
-}
-
-HTMLFrameElement::HTMLFrameElement(const QualifiedName& tagName, Document *doc)
-    : HTMLElement(tagName, doc)
-{
-    init();
-}
-
-void HTMLFrameElement::init()
-{
-    m_frameBorder = true;
-    m_frameBorderSet = false;
-    m_marginWidth = -1;
-    m_marginHeight = -1;
-    m_scrolling = ScrollBarAuto;
-    m_noResize = false;
-}
-
-HTMLFrameElement::~HTMLFrameElement()
-{
-}
-
-bool HTMLFrameElement::isURLAllowed(const AtomicString &URLString) const
-{
-    if (URLString.isEmpty())
-        return true;
-    
-    FrameView *w = document()->view();
-    if (!w)
-        return false;
-
-    KURL newURL(document()->completeURL(URLString.deprecatedString()));
-    newURL.setRef(DeprecatedString::null);
-
-    // Don't allow more than 1000 total frames in a set. This seems
-    // like a reasonable upper bound, and otherwise mutually recursive
-    // frameset pages can quickly bring the program to its knees with
-    // exponential growth in the number of frames.
-
-    // FIXME: This limit could be higher, but WebKit has some
-    // algorithms that happen while loading which appear to be N^2 or
-    // worse in the number of frames
-    if (w->frame()->page()->frameCount() >= 200) {
-        return false;
-    }
-
-    // We allow one level of self-reference because some sites depend on that.
-    // But we don't allow more than one.
-    bool foundSelfReference = false;
-    for (Frame *frame = w->frame(); frame; frame = frame->tree()->parent()) {
-        KURL frameURL = frame->url();
-        frameURL.setRef(DeprecatedString::null);
-        if (frameURL == newURL) {
-            if (foundSelfReference) {
-                return false;
-            }
-            foundSelfReference = true;
-        }
-    }
-    
-    return true;
-}
-
-void HTMLFrameElement::openURL()
-{
-    FrameView *w = document()->view();
-    if (!w)
-        return;
-    
-    AtomicString relativeURL = m_URL;
-    if (relativeURL.isEmpty())
-        relativeURL = "about:blank";
-
-    // Load the frame contents.
-    Frame* parentFrame = w->frame();
-    if (Frame* childFrame = parentFrame->tree()->child(m_name))
-        childFrame->openURL(document()->completeURL(relativeURL.deprecatedString()));
-    else
-        parentFrame->requestFrame(static_cast<RenderFrame *>(renderer()), relativeURL, m_name);
-}
-
-
-void HTMLFrameElement::parseMappedAttribute(MappedAttribute *attr)
-{
-    if (attr->name() == srcAttr) {
-        setLocation(WebCore::parseURL(attr->value()));
-    } else if (attr->name() == idAttr) {
-        // Important to call through to base for the id attribute so the hasID bit gets set.
-        HTMLElement::parseMappedAttribute(attr);
-        m_name = attr->value();
-    } else if (attr->name() == nameAttr) {
-        m_name = attr->value();
-        // FIXME: If we are already attached, this doesn't actually change the frame's name.
-        // FIXME: If we are already attached, this doesn't check for frame name
-        // conflicts and generate a unique frame name.
-    } else if (attr->name() == frameborderAttr) {
-        m_frameBorder = attr->value().toInt();
-        m_frameBorderSet = !attr->isNull();
-        // FIXME: If we are already attached, this has no effect.
-    } else if (attr->name() == marginwidthAttr) {
-        m_marginWidth = attr->value().toInt();
-        // FIXME: If we are already attached, this has no effect.
-    } else if (attr->name() == marginheightAttr) {
-        m_marginHeight = attr->value().toInt();
-        // FIXME: If we are already attached, this has no effect.
-    } else if (attr->name() == noresizeAttr) {
-        m_noResize = true;
-        // FIXME: If we are already attached, this has no effect.
-    } else if (attr->name() == scrollingAttr) {
-        // Auto and yes both simply mean "allow scrolling." No means "don't allow scrolling."
-        if (equalIgnoringCase(attr->value(), "auto") || equalIgnoringCase(attr->value(), "yes"))
-            m_scrolling = ScrollBarAuto;
-        else if (equalIgnoringCase(attr->value(), "no"))
-            m_scrolling = ScrollBarAlwaysOff;
-        // FIXME: If we are already attached, this has no effect.
-    } else if (attr->name() == onloadAttr) {
-        setHTMLEventListener(loadEvent, attr);
-    } else if (attr->name() == onbeforeunloadAttr) {
-        // FIXME: should <frame> elements have beforeunload handlers?
-        setHTMLEventListener(beforeunloadEvent, attr);
-    } else if (attr->name() == onunloadAttr) {
-        setHTMLEventListener(unloadEvent, attr);
-    } else
-        HTMLElement::parseMappedAttribute(attr);
-}
-
-bool HTMLFrameElement::rendererIsNeeded(RenderStyle *style)
-{
-    // Ignore display: none.
-    return isURLAllowed(m_URL);
-}
-
-RenderObject *HTMLFrameElement::createRenderer(RenderArena *arena, RenderStyle *style)
-{
-    return new (arena) RenderFrame(this);
-}
-
-void HTMLFrameElement::attach()
-{
-    m_name = getAttribute(nameAttr);
-    if (m_name.isNull())
-        m_name = getAttribute(idAttr);
-
-    // inherit default settings from parent frameset
-    for (Node *node = parentNode(); node; node = node->parentNode())
-        if (node->hasTagName(framesetTag)) {
-            HTMLFrameSetElement* frameset = static_cast<HTMLFrameSetElement*>(node);
-            if (!m_frameBorderSet)
-                m_frameBorder = frameset->frameBorder();
-            if (!m_noResize)
-                m_noResize = frameset->noResize();
-            break;
-        }
-
-    HTMLElement::attach();
-
-    if (!renderer())
-        return;
-
-    Frame* frame = document()->frame();
-
-    if (!frame)
-        return;
-
-    frame->page()->incrementFrameCount();
-    
-    AtomicString relativeURL = m_URL;
-    if (relativeURL.isEmpty())
-        relativeURL = "about:blank";
-
-    m_name = frame->tree()->uniqueChildName(m_name);
-
-    // load the frame contents
-    frame->requestFrame(static_cast<RenderFrame*>(renderer()), relativeURL, m_name);
-}
-
-void HTMLFrameElement::close()
-{
-    Frame* frame = document()->frame();
-    if (renderer() && frame) {
-        frame->page()->decrementFrameCount();
-        if (Frame* childFrame = frame->tree()->child(m_name))
-            childFrame->frameDetached();
-    }
-}
-
-void HTMLFrameElement::willRemove()
-{
-    // close the frame and dissociate the renderer, but leave the
-    // node attached so that frame does not get re-attached before
-    // actually leaving the document.  see <rdar://problem/4132581>
-    close();
-    if (renderer()) {
-        renderer()->destroy();
-        setRenderer(0);
-    }
-    
-    HTMLElement::willRemove();
-}
-
-void HTMLFrameElement::detach()
-{
-    close();
-    HTMLElement::detach();
-}
-
-void HTMLFrameElement::setLocation(const String& str)
-{
-    m_URL = AtomicString(str);
-
-    if (!attached()) {
-        return;
-    }
-    
-    // Handle the common case where we decided not to make a frame the first time.
-    // Detach and the let attach() decide again whether to make the frame for this URL.
-    if (!renderer()) {
-        detach();
-        attach();
-        return;
-    }
-    
-    if (!isURLAllowed(m_URL)) {
-        return;
-    }
-
-    openURL();
-}
-
-bool HTMLFrameElement::isFocusable() const
-{
-    return renderer();
-}
-
-void HTMLFrameElement::setFocus(bool received)
-{
-    HTMLElement::setFocus(received);
-    WebCore::RenderFrame *renderFrame = static_cast<WebCore::RenderFrame *>(renderer());
-    if (!renderFrame || !renderFrame->widget())
-        return;
-    if (received)
-        renderFrame->widget()->setFocus();
-    else
-        renderFrame->widget()->clearFocus();
-}
-
-Frame* HTMLFrameElement::contentFrame() const
-{
-    // Start with the part that contains this element, our ownerDocument.
-    Frame* parentFrame = document()->frame();
-    if (!parentFrame)
-        return 0;
-
-    // Find the part for the subframe that this element represents.
-    return parentFrame->tree()->child(m_name);
-}
-
-Document* HTMLFrameElement::contentDocument() const
-{
-    Frame* frame = contentFrame();
-    if (!frame)
-        return 0;
-    return frame->document();
-}
-
-bool HTMLFrameElement::isURLAttribute(Attribute *attr) const
-{
-    return attr->name() == srcAttr;
-}
-
-String HTMLFrameElement::frameBorder() const
-{
-    return getAttribute(frameborderAttr);
-}
-
-void HTMLFrameElement::setFrameBorder(const String &value)
-{
-    setAttribute(frameborderAttr, value);
-}
-
-String HTMLFrameElement::longDesc() const
-{
-    return getAttribute(longdescAttr);
-}
-
-void HTMLFrameElement::setLongDesc(const String &value)
-{
-    setAttribute(longdescAttr, value);
-}
-
-String HTMLFrameElement::marginHeight() const
-{
-    return getAttribute(marginheightAttr);
-}
-
-void HTMLFrameElement::setMarginHeight(const String &value)
-{
-    setAttribute(marginheightAttr, value);
-}
-
-String HTMLFrameElement::marginWidth() const
-{
-    return getAttribute(marginwidthAttr);
-}
-
-void HTMLFrameElement::setMarginWidth(const String &value)
-{
-    setAttribute(marginwidthAttr, value);
-}
-
-String HTMLFrameElement::name() const
-{
-    return getAttribute(nameAttr);
-}
-
-void HTMLFrameElement::setName(const String &value)
-{
-    setAttribute(nameAttr, value);
-}
-
-void HTMLFrameElement::setNoResize(bool noResize)
-{
-    setAttribute(noresizeAttr, noResize ? "" : 0);
-}
-
-String HTMLFrameElement::scrolling() const
-{
-    return getAttribute(scrollingAttr);
-}
-
-void HTMLFrameElement::setScrolling(const String &value)
-{
-    setAttribute(scrollingAttr, value);
-}
-
-String HTMLFrameElement::src() const
-{
-    return getAttribute(srcAttr);
-}
-
-void HTMLFrameElement::setSrc(const String &value)
-{
-    setAttribute(srcAttr, value);
-}
-
-int HTMLFrameElement::frameWidth() const
-{
-    if (!renderer())
-        return 0;
-    
-    document()->updateLayoutIgnorePendingStylesheets();
-    return renderer()->width();
-}
-
-int HTMLFrameElement::frameHeight() const
-{
-    if (!renderer())
-        return 0;
-    
-    document()->updateLayoutIgnorePendingStylesheets();
-    return renderer()->height();
-}
-
-// -------------------------------------------------------------------------
-
-HTMLFrameSetElement::HTMLFrameSetElement(Document *doc)
-    : HTMLElement(framesetTag, doc)
-{
-    // default value for rows and cols...
-    m_totalRows = 1;
-    m_totalCols = 1;
-
-    m_rows = m_cols = 0;
-
-    frameborder = true;
-    frameBorderSet = false;
-    m_border = 4;
-    noresize = false;
-}
-
-HTMLFrameSetElement::~HTMLFrameSetElement()
-{
-    if (m_rows)
-        delete [] m_rows;
-    if (m_cols)
-        delete [] m_cols;
-}
-
-bool HTMLFrameSetElement::checkDTD(const Node* newChild)
-{
-    // FIXME: Old code had adjacent double returns and seemed to want to do something with NOFRAMES (but didn't).
-    // What is the correct behavior?
-    return newChild->hasTagName(framesetTag) || newChild->hasTagName(frameTag);
-}
-
-void HTMLFrameSetElement::parseMappedAttribute(MappedAttribute *attr)
-{
-    if (attr->name() == rowsAttr) {
-        if (!attr->isNull()) {
-            if (m_rows) delete [] m_rows;
-            m_rows = attr->value().toLengthArray(m_totalRows);
-            setChanged();
-        }
-    } else if (attr->name() == colsAttr) {
-        if (!attr->isNull()) {
-            delete [] m_cols;
-            m_cols = attr->value().toLengthArray(m_totalCols);
-            setChanged();
-        }
-    } else if (attr->name() == frameborderAttr) {
-        // false or "no" or "0"..
-        if ( attr->value().toInt() == 0 ) {
-            frameborder = false;
-            m_border = 0;
-        }
-        frameBorderSet = true;
-    } else if (attr->name() == noresizeAttr) {
-        noresize = true;
-    } else if (attr->name() == borderAttr) {
-        m_border = attr->value().toInt();
-        if(!m_border)
-            frameborder = false;
-    } else if (attr->name() == onloadAttr) {
-        document()->setHTMLWindowEventListener(loadEvent, attr);
-    } else if (attr->name() == onbeforeunloadAttr) {
-        document()->setHTMLWindowEventListener(beforeunloadEvent, attr);
-    } else if (attr->name() == onunloadAttr) {
-        document()->setHTMLWindowEventListener(unloadEvent, attr);
-    } else
-        HTMLElement::parseMappedAttribute(attr);
-}
-
-bool HTMLFrameSetElement::rendererIsNeeded(RenderStyle *style)
-{
-    // Ignore display: none but do pay attention if a stylesheet has caused us to delay our loading.
-    return style->isStyleAvailable();
-}
-
-RenderObject *HTMLFrameSetElement::createRenderer(RenderArena *arena, RenderStyle *style)
-{
-    return new (arena) RenderFrameSet(this);
-}
-
-void HTMLFrameSetElement::attach()
-{
-    // inherit default settings from parent frameset
-    HTMLElement* node = static_cast<HTMLElement*>(parentNode());
-    while(node)
-    {
-        if (node->hasTagName(framesetTag)) {
-            HTMLFrameSetElement* frameset = static_cast<HTMLFrameSetElement*>(node);
-            if(!frameBorderSet)  frameborder = frameset->frameBorder();
-            if(!noresize)  noresize = frameset->noResize();
-            break;
-        }
-        node = static_cast<HTMLElement*>(node->parentNode());
-    }
-
-    HTMLElement::attach();
-}
-
-void HTMLFrameSetElement::defaultEventHandler(Event *evt)
-{
-    if (evt->isMouseEvent() && !noresize && renderer()) {
-        static_cast<WebCore::RenderFrameSet *>(renderer())->userResize(static_cast<MouseEvent*>(evt));
-        evt->setDefaultHandled();
-    }
-
-    HTMLElement::defaultEventHandler(evt);
-}
-
-void HTMLFrameSetElement::recalcStyle( StyleChange ch )
-{
-    if (changed() && renderer()) {
-        renderer()->setNeedsLayout(true);
-        setChanged(false);
-    }
-    HTMLElement::recalcStyle( ch );
-}
-
-String HTMLFrameSetElement::cols() const
-{
-    return getAttribute(colsAttr);
-}
-
-void HTMLFrameSetElement::setCols(const String &value)
-{
-    setAttribute(colsAttr, value);
-}
-
-String HTMLFrameSetElement::rows() const
-{
-    return getAttribute(rowsAttr);
-}
-
-void HTMLFrameSetElement::setRows(const String &value)
-{
-    setAttribute(rowsAttr, value);
-}
-
-// -------------------------------------------------------------------------
-
-HTMLHeadElement::HTMLHeadElement(Document *doc)
-    : HTMLElement(headTag, doc)
-{
-}
-
-HTMLHeadElement::~HTMLHeadElement()
-{
-}
-
-String HTMLHeadElement::profile() const
-{
-    return getAttribute(profileAttr);
-}
-
-void HTMLHeadElement::setProfile(const String &value)
-{
-    setAttribute(profileAttr, value);
-}
-
-bool HTMLHeadElement::checkDTD(const Node* newChild)
-{
-    return newChild->hasTagName(titleTag) || newChild->hasTagName(isindexTag) ||
-           newChild->hasTagName(baseTag) || newChild->hasTagName(scriptTag) ||
-           newChild->hasTagName(styleTag) || newChild->hasTagName(metaTag) ||
-           newChild->hasTagName(linkTag) || newChild->isTextNode();
-}
-
-// -------------------------------------------------------------------------
-
-HTMLHtmlElement::HTMLHtmlElement(Document *doc)
-    : HTMLElement(htmlTag, doc)
-{
-}
-
-HTMLHtmlElement::~HTMLHtmlElement()
-{
-}
-
-String HTMLHtmlElement::version() const
-{
-    return getAttribute(versionAttr);
-}
-
-void HTMLHtmlElement::setVersion(const String &value)
-{
-    setAttribute(versionAttr, value);
-}
-
-bool HTMLHtmlElement::checkDTD(const Node* newChild)
-{
-    // FIXME: Why is <script> allowed here?
-    return newChild->hasTagName(headTag) || newChild->hasTagName(bodyTag) ||
-           newChild->hasTagName(framesetTag) || newChild->hasTagName(noframesTag) ||
-           newChild->hasTagName(scriptTag);
-}
-
-// -------------------------------------------------------------------------
-
-HTMLIFrameElement::HTMLIFrameElement(Document *doc) : HTMLFrameElement(iframeTag, doc)
-{
-    m_frameBorder = false;
-    m_marginWidth = -1;
-    m_marginHeight = -1;
-    needWidgetUpdate = false;
-}
-
-HTMLIFrameElement::~HTMLIFrameElement()
-{
-}
-
-bool HTMLIFrameElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const
-{
-    if (attrName == widthAttr || attrName == heightAttr) {
-        result = eUniversal;
-        return false;
-    }
-    
-    if (attrName == alignAttr) {
-        result = eReplaced; // Share with <img> since the alignment behavior is the same.
-        return false;
-    }
-    
-    return HTMLElement::mapToEntry(attrName, result);
-}
-
-void HTMLIFrameElement::parseMappedAttribute(MappedAttribute *attr)
-{
-    if (attr->name() == widthAttr)
-        addCSSLength(attr, CSS_PROP_WIDTH, attr->value());
-    else if (attr->name() == heightAttr)
-        addCSSLength(attr, CSS_PROP_HEIGHT, attr->value());
-    else if (attr->name() == alignAttr)
-        addHTMLAlignment(attr);
-    else if (attr->name() == nameAttr) {
-        String newNameAttr = attr->value();
-        if (inDocument() && document()->isHTMLDocument()) {
-            HTMLDocument *doc = static_cast<HTMLDocument *>(document());
-            doc->removeDocExtraNamedItem(oldNameAttr);
-            doc->addDocExtraNamedItem(newNameAttr);
-        }
-        oldNameAttr = newNameAttr;
-    } else
-        HTMLFrameElement::parseMappedAttribute(attr);
-}
-
-void HTMLIFrameElement::insertedIntoDocument()
-{
-    if (document()->isHTMLDocument()) {
-        HTMLDocument *doc = static_cast<HTMLDocument *>(document());
-        doc->addDocExtraNamedItem(oldNameAttr);
-    }
-
-    HTMLElement::insertedIntoDocument();
-}
-
-void HTMLIFrameElement::removedFromDocument()
-{
-    if (document()->isHTMLDocument()) {
-        HTMLDocument *doc = static_cast<HTMLDocument *>(document());
-        doc->removeDocExtraNamedItem(oldNameAttr);
-    }
-
-    HTMLElement::removedFromDocument();
-}
-
-bool HTMLIFrameElement::rendererIsNeeded(RenderStyle *style)
-{
-    // Don't ignore display: none the way frame does.
-    return isURLAllowed(m_URL) && style->display() != NONE;
-}
-
-RenderObject *HTMLIFrameElement::createRenderer(RenderArena *arena, RenderStyle *style)
-{
-    return new (arena) RenderPartObject(this);
-}
-
-void HTMLIFrameElement::attach()
-{
-    m_name = getAttribute(nameAttr);
-    if (m_name.isNull())
-        m_name = getAttribute(idAttr);
-
-    HTMLElement::attach();
-
-    Frame* parentFrame = document()->frame();
-    if (renderer() && parentFrame) {
-        parentFrame->page()->incrementFrameCount();
-        m_name = parentFrame->tree()->uniqueChildName(m_name);
-        static_cast<RenderPartObject*>(renderer())->updateWidget();
-        needWidgetUpdate = false;
-    }
-}
-
-void HTMLIFrameElement::recalcStyle( StyleChange ch )
-{
-    if (needWidgetUpdate) {
-        if (renderer())
-            static_cast<RenderPartObject*>(renderer())->updateWidget();
-        needWidgetUpdate = false;
-    }
-    HTMLElement::recalcStyle( ch );
-}
-
-void HTMLIFrameElement::openURL()
-{
-    needWidgetUpdate = true;
-    setChanged();
-}
-
-bool HTMLIFrameElement::isURLAttribute(Attribute *attr) const
-{
-    return attr->name() == srcAttr;
-}
-
-String HTMLIFrameElement::align() const
-{
-    return getAttribute(alignAttr);
-}
-
-void HTMLIFrameElement::setAlign(const String &value)
-{
-    setAttribute(alignAttr, value);
-}
-
-String HTMLIFrameElement::height() const
-{
-    return getAttribute(heightAttr);
-}
-
-void HTMLIFrameElement::setHeight(const String &value)
-{
-    setAttribute(heightAttr, value);
-}
-
-String HTMLIFrameElement::src() const
-{
-    return document()->completeURL(getAttribute(srcAttr));
-}
-
-String HTMLIFrameElement::width() const
-{
-    return getAttribute(widthAttr);
-}
-
-void HTMLIFrameElement::setWidth(const String &value)
-{
-    setAttribute(widthAttr, value);
-}
-
-}
diff --git a/WebCore/html/html_baseimpl.h b/WebCore/html/html_baseimpl.h
deleted file mode 100644
index 0f20bee..0000000
--- a/WebCore/html/html_baseimpl.h
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- * This file is part of the DOM implementation for KDE.
- *
- * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
- *           (C) 1999 Antti Koivisto (koivisto@kde.org)
- *           (C) 2000 Simon Hausmann <hausmann@kde.org>
- * Copyright (C) 2004, 2006 Apple Computer, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- */
-
-#ifndef HTML_BASEIMPL_H
-#define HTML_BASEIMPL_H
-
-#include "HTMLElement.h"
-#include "ScrollBarMode.h"
-
-namespace WebCore {
-
-class CSSStyleSheet;
-class String;
-class Frame;
-class HTMLFrameElement;
-class RenderFrameSet;
-class RenderFrame;
-class RenderPartObject;
-
-struct Length;
-
-// -------------------------------------------------------------------------
-
-class HTMLBodyElement : public HTMLElement
-{
-public:
-    HTMLBodyElement(Document *doc);
-    ~HTMLBodyElement();
-
-    virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
-    virtual int tagPriority() const { return 10; }
-    
-    virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;
-    virtual void parseMappedAttribute(MappedAttribute *);
-
-    virtual void insertedIntoDocument();
-
-    void createLinkDecl();
-    
-    virtual bool isURLAttribute(Attribute *attr) const;
-
-    String aLink() const;
-    void setALink(const String &);
-    String background() const;
-    void setBackground(const String &);
-    String bgColor() const;
-    void setBgColor(const String &);
-    String link() const;
-    void setLink(const String &);
-    String text() const;
-    void setText(const String &);
-    String vLink() const;
-    void setVLink(const String &);
-
-protected:
-    RefPtr<CSSMutableStyleDeclaration> m_linkDecl;
-};
-
-// -------------------------------------------------------------------------
-
-class HTMLFrameElement : public HTMLElement
-{
-    friend class RenderFrame;
-    friend class RenderPartObject;
-
-public:
-    HTMLFrameElement(Document *doc);
-    HTMLFrameElement(const QualifiedName& tagName, Document* doc);
-    ~HTMLFrameElement();
-
-    void init();
-
-    virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
-    virtual int tagPriority() const { return 0; }
-  
-    virtual void parseMappedAttribute(MappedAttribute *);
-    virtual void attach();
-    void close();
-    virtual void willRemove();
-    virtual void detach();
-    virtual bool rendererIsNeeded(RenderStyle *);
-    virtual RenderObject *createRenderer(RenderArena *, RenderStyle *);
-
-    bool noResize() { return m_noResize; }
-
-    void setLocation(const String&);
-
-    virtual bool isFocusable() const;
-    virtual void setFocus(bool);
-
-    Frame* contentFrame() const;
-    Document* contentDocument() const;
-    
-    virtual bool isURLAttribute(Attribute *attr) const;
-
-    ScrollBarMode scrollingMode() const { return m_scrolling; }
-    int getMarginWidth() const { return m_marginWidth; }
-    int getMarginHeight() const { return m_marginHeight; }
-
-    String frameBorder() const;
-    void setFrameBorder(const String &);
-
-    String longDesc() const;
-    void setLongDesc(const String &);
-
-    String marginHeight() const;
-    void setMarginHeight(const String &);
-
-    String marginWidth() const;
-    void setMarginWidth(const String &);
-
-    String name() const;
-    void setName(const String &);
-
-    void setNoResize(bool);
-
-    String scrolling() const;
-    void setScrolling(const String &);
-
-    virtual String src() const;
-    void setSrc(const String &);
-
-    int frameWidth() const;
-    int frameHeight() const;
-
-protected:
-    bool isURLAllowed(const AtomicString &) const;
-    virtual void openURL();
-
-    AtomicString m_URL;
-    AtomicString m_name;
-
-    int m_marginWidth;
-    int m_marginHeight;
-    ScrollBarMode m_scrolling;
-
-    bool m_frameBorder : 1;
-    bool m_frameBorderSet : 1;
-    bool m_noResize : 1;
-};
-
-// -------------------------------------------------------------------------
-
-class HTMLFrameSetElement : public HTMLElement
-{
-    friend class RenderFrameSet;
-public:
-    HTMLFrameSetElement(Document *doc);
-    ~HTMLFrameSetElement();
-
-    virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
-    virtual int tagPriority() const { return 10; }
-    virtual bool checkDTD(const Node* newChild);
-
-    virtual void parseMappedAttribute(MappedAttribute *);
-    virtual void attach();
-    virtual bool rendererIsNeeded(RenderStyle *);
-    virtual RenderObject *createRenderer(RenderArena *, RenderStyle *);
-
-    virtual void defaultEventHandler(Event *evt);
-
-    bool frameBorder() { return frameborder; }
-    bool noResize() { return noresize; }
-
-    int totalRows() const { return m_totalRows; }
-    int totalCols() const { return m_totalCols; }
-    int border() const { return m_border; }
-
-    virtual void recalcStyle( StyleChange ch );
-    
-    String cols() const;
-    void setCols(const String &);
-
-    String rows() const;
-    void setRows(const String &);
-
-protected:
-    Length* m_rows;
-    Length* m_cols;
-
-    int m_totalRows;
-    int m_totalCols;
-    int m_border;
-
-    bool frameborder : 1;
-    bool frameBorderSet : 1;
-    bool noresize : 1;
-};
-
-// -------------------------------------------------------------------------
-
-class HTMLHeadElement : public HTMLElement
-{
-public:
-    HTMLHeadElement(Document *doc);
-    ~HTMLHeadElement();
-
-    virtual HTMLTagStatus endTagRequirement() const { return TagStatusOptional; }
-    virtual int tagPriority() const { return 10; }
-    virtual bool checkDTD(const Node* newChild);
-
-    String profile() const;
-    void setProfile(const String &);
-};
-
-// -------------------------------------------------------------------------
-
-class HTMLHtmlElement : public HTMLElement
-{
-public:
-    HTMLHtmlElement(Document *doc);
-    ~HTMLHtmlElement();
-
-    virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
-    virtual int tagPriority() const { return 11; }
-    virtual bool checkDTD(const Node* newChild);
-
-    String version() const;
-    void setVersion(const String &);
-};
-
-
-// -------------------------------------------------------------------------
-
-class HTMLIFrameElement : public HTMLFrameElement
-{
-public:
-    HTMLIFrameElement(Document *doc);
-    ~HTMLIFrameElement();
-
-    virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
-    virtual int tagPriority() const { return 1; }
-
-    virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;
-    virtual void parseMappedAttribute(MappedAttribute *attr);
-
-    virtual void insertedIntoDocument();
-    virtual void removedFromDocument();
-
-    virtual void attach();
-    virtual bool rendererIsNeeded(RenderStyle *);
-    virtual RenderObject *createRenderer(RenderArena *, RenderStyle *);
-    virtual void recalcStyle( StyleChange ch );
-    
-    virtual bool isURLAttribute(Attribute *attr) const;
-
-    String align() const;
-    void setAlign(const String &);
-
-    String height() const;
-    void setHeight(const String &);
-
-    String width() const;
-    void setWidth(const String &);
-
-    virtual String src() const;
-
-protected:
-    virtual void openURL();
-
-    bool needWidgetUpdate;
-
- private:
-    String oldNameAttr;
-};
-
-} //namespace
-
-#endif
diff --git a/WebCore/kwq/WebCoreAXObject.mm b/WebCore/kwq/WebCoreAXObject.mm
index b05728a..8ec249b 100644
--- a/WebCore/kwq/WebCoreAXObject.mm
+++ b/WebCore/kwq/WebCoreAXObject.mm
@@ -42,6 +42,7 @@
 #import "RenderCanvas.h"
 #import "RenderImage.h"
 #import "RenderTheme.h"
+#import "RenderWidget.h"
 #import "SelectionController.h"
 #import "TextIterator.h"
 #import "WebCoreFrameBridge.h"
diff --git a/WebCore/page/Frame.cpp b/WebCore/page/Frame.cpp
index a952cce..b55bef1 100644
--- a/WebCore/page/Frame.cpp
+++ b/WebCore/page/Frame.cpp
@@ -45,6 +45,7 @@
 #include "GraphicsContext.h"
 #include "HTMLDocument.h"
 #include "HTMLFormElement.h"
+#include "HTMLFrameElement.h"
 #include "HTMLGenericFormElement.h"
 #include "HTMLNames.h"
 #include "HTMLObjectElement.h"
@@ -52,6 +53,7 @@
 #include "NodeList.h"
 #include "Plugin.h"
 #include "RenderCanvas.h"
+#include "RenderPart.h"
 #include "RenderTheme.h"
 #include "SegmentedString.h"
 #include "TextDocument.h"
@@ -64,7 +66,6 @@
 #include "htmlediting.h"
 #include "kjs_window.h"
 #include "markup.h"
-#include "render_frames.h"
 #include "visible_units.h"
 #include "xml_tokenizer.h"
 #include "xmlhttprequest.h"
@@ -1199,7 +1200,7 @@
     RenderObject *renderer = n->renderer();
     if (!renderer || !renderer->isWidget())
         return false;
-    Widget *widget = static_cast<RenderWidget *>(renderer)->widget();
+    Widget* widget = static_cast<RenderWidget*>(renderer)->widget();
     return widget && widget->isFrameView();
 }
 
@@ -2342,7 +2343,7 @@
     RefPtr<NodeList> list = d->m_doc->getElementsByTagName("body");
     unsigned len = list->length();
     for (unsigned i = 0; i < len; i++) {
-        applyEditingStyleToElement(static_cast<Element *>(list->item(i)));    
+        applyEditingStyleToElement(static_cast<Element*>(list->item(i)));    
     }
 }
 
@@ -2354,7 +2355,7 @@
     RefPtr<NodeList> list = d->m_doc->getElementsByTagName("body");
     unsigned len = list->length();
     for (unsigned i = 0; i < len; i++) {
-        removeEditingStyleFromElement(static_cast<Element *>(list->item(i)));    
+        removeEditingStyleFromElement(static_cast<Element*>(list->item(i)));    
     }
 }
 
@@ -2363,7 +2364,7 @@
     if (!element || !element->isHTMLElement())
         return;
     
-    static_cast<HTMLElement *>(element)->setContentEditable("true");
+    static_cast<HTMLElement*>(element)->setContentEditable("true");
 }
 
 void Frame::removeEditingStyleFromElement(Element *element) const
@@ -2371,7 +2372,7 @@
     if (!element || !element->isHTMLElement())
         return;
         
-    static_cast<HTMLElement *>(element)->setContentEditable("false");        
+    static_cast<HTMLElement*>(element)->setContentEditable("false");        
 }
 
 
@@ -2529,7 +2530,7 @@
 
 IntRect Frame::selectionRect() const
 {
-    RenderCanvas *root = static_cast<RenderCanvas *>(renderer());
+    RenderCanvas *root = static_cast<RenderCanvas*>(renderer());
     if (!root)
         return IntRect();
 
@@ -2550,7 +2551,7 @@
     Document* document = d->m_doc.get();
     if (!document || !document->isHTMLDocument())
         return false;
-    Node *body = static_cast<HTMLDocument *>(document)->body();
+    Node *body = static_cast<HTMLDocument*>(document)->body();
     return body && body->renderer() && body->hasTagName(framesetTag);
 }
 
@@ -2572,11 +2573,11 @@
     Node *n;
     for (n = start; n; n = n->traverseNextNode()) {
         if (n->hasTagName(formTag))
-            return static_cast<HTMLFormElement *>(n);
+            return static_cast<HTMLFormElement*>(n);
         else if (n->isHTMLElement() && static_cast<HTMLElement*>(n)->isGenericFormElement())
             return static_cast<HTMLGenericFormElement*>(n)->form();
         else if (n->hasTagName(frameTag) || n->hasTagName(iframeTag)) {
-            Node *childDoc = static_cast<HTMLFrameElement *>(n)->contentDocument();
+            Node *childDoc = static_cast<HTMLFrameElement*>(n)->contentDocument();
             if (HTMLFormElement *frameResult = scanForForm(childDoc))
                 return frameResult;
         }
@@ -2596,10 +2597,10 @@
     Node *n;
     for (n = start; n; n = n->parentNode()) {
         if (n->hasTagName(formTag))
-            return static_cast<HTMLFormElement *>(n);
+            return static_cast<HTMLFormElement*>(n);
         else if (n->isHTMLElement()
-                   && static_cast<HTMLElement *>(n)->isGenericFormElement())
-            return static_cast<HTMLGenericFormElement *>(n)->form();
+                   && static_cast<HTMLElement*>(n)->isGenericFormElement())
+            return static_cast<HTMLGenericFormElement*>(n)->form();
     }
     
     // try walking forward in the node tree to find a form element
@@ -2708,15 +2709,15 @@
         n = nodeInfo.innerNode();
         if (!n || !n->renderer() || !n->renderer()->isWidget())
             break;
-        widget = static_cast<RenderWidget *>(n->renderer())->widget();
+        widget = static_cast<RenderWidget*>(n->renderer())->widget();
         if (!widget || !widget->isFrameView())
             break;
-        Frame* frame = static_cast<HTMLFrameElement *>(n)->contentFrame();
+        Frame* frame = static_cast<HTMLFrameElement*>(n)->contentFrame();
         if (!frame || !frame->renderer())
             break;
         int absX, absY;
         n->renderer()->absolutePosition(absX, absY, true);
-        FrameView *view = static_cast<FrameView *>(widget);
+        FrameView *view = static_cast<FrameView*>(widget);
         widgetPoint.setX(widgetPoint.x() - absX + view->contentsX());
         widgetPoint.setY(widgetPoint.y() - absY + view->contentsY());
 
@@ -2800,7 +2801,7 @@
 
 void Frame::adjustPageHeight(float *newBottom, float oldTop, float oldBottom, float bottomLimit)
 {
-    RenderCanvas *root = static_cast<RenderCanvas *>(document()->renderer());
+    RenderCanvas *root = static_cast<RenderCanvas*>(document()->renderer());
     if (root) {
         // Use a context with painting disabled.
         GraphicsContext context(0);
@@ -2918,7 +2919,7 @@
     
     // Assume all widgets are either form controls, or FrameViews.
     ASSERT(widget->isFrameView());
-    return static_cast<const FrameView *>(widget)->frame();
+    return static_cast<const FrameView*>(widget)->frame();
 }
 
 Frame *Frame::frameForNode(Node *node)
@@ -2977,7 +2978,7 @@
 {
     // Dumping externalRepresentation(m_frame->renderer()).ascii() is a good trick to see
     // the state of things before and after the layout
-    RenderCanvas *root = static_cast<RenderCanvas *>(document()->renderer());
+    RenderCanvas *root = static_cast<RenderCanvas*>(document()->renderer());
     if (root) {
         // This magic is basically copied from khtmlview::print
         int pageW = (int)ceilf(minPageWidth);
@@ -3089,7 +3090,7 @@
     if (!widget) {
         if (!target->isWidget())
             return false;
-        widget = static_cast<RenderWidget *>(target)->widget();
+        widget = static_cast<RenderWidget*>(target)->widget();
     }
     
     // Doubleclick events don't exist in Cocoa.  Since passWidgetMouseDownEventToWidget will
diff --git a/WebCore/page/FrameView.cpp b/WebCore/page/FrameView.cpp
index 3a2d01b..604d7c0 100644
--- a/WebCore/page/FrameView.cpp
+++ b/WebCore/page/FrameView.cpp
@@ -29,11 +29,13 @@
 #include "Cursor.h"
 #include "EventNames.h"
 #include "Frame.h"
+#include "HTMLFrameSetElement.h"
 #include "HTMLInputElement.h"
 #include "Image.h"
 #include "AccessibilityObjectCache.h"
 #include "PlatformKeyboardEvent.h"
 #include "MouseEventWithHitTestResults.h"
+#include "RenderPart.h"
 #include "RenderText.h"
 #include "SelectionController.h"
 #include "PlatformWheelEvent.h"
@@ -44,7 +46,6 @@
 #include "HTMLNames.h"
 #include "RenderArena.h"
 #include "RenderCanvas.h"
-#include "render_frames.h"
 
 namespace WebCore {
 
diff --git a/WebCore/rendering/RenderFrame.cpp b/WebCore/rendering/RenderFrame.cpp
new file mode 100644
index 0000000..885ed51
--- /dev/null
+++ b/WebCore/rendering/RenderFrame.cpp
@@ -0,0 +1,59 @@
+/**
+ * This file is part of the KDE project.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ *           (C) 2000 Simon Hausmann <hausmann@kde.org>
+ *           (C) 2000 Stefan Schimanski (1Stein@gmx.de)
+ * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+#include "config.h"
+#include "RenderFrame.h"
+
+#include "FrameView.h"
+#include "HTMLFrameSetElement.h"
+#include "HTMLNames.h"
+
+namespace WebCore {
+
+using namespace HTMLNames;
+
+RenderFrame::RenderFrame(HTMLFrameElement* frame)
+    : RenderPart(frame)
+{
+    setInline(false);
+}
+
+void RenderFrame::viewCleared()
+{
+    if (element() && m_widget && m_widget->isFrameView()) {
+        FrameView* view = static_cast<FrameView*>(m_widget);
+        HTMLFrameSetElement* frameSet = static_cast<HTMLFrameSetElement*>(element()->parentNode());
+        bool hasBorder = element()->m_frameBorder && frameSet->frameBorder();
+        int marginw = element()->m_marginWidth;
+        int marginh = element()->m_marginHeight;
+
+        view->setHasBorder(hasBorder);
+        if (marginw != -1)
+            view->setMarginWidth(marginw);
+        if (marginh != -1)
+            view->setMarginHeight(marginh);
+    }
+}
+
+}
\ No newline at end of file
diff --git a/WebCore/rendering/RenderFrame.h b/WebCore/rendering/RenderFrame.h
new file mode 100644
index 0000000..34af2b9
--- /dev/null
+++ b/WebCore/rendering/RenderFrame.h
@@ -0,0 +1,48 @@
+/*
+ * This file is part of the KDE project.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ *           (C) 2000 Simon Hausmann <hausmann@kde.org>
+ * Copyright (C) 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef RenderFrame_H
+#define RenderFrame_H
+
+#include "RenderPart.h"
+#include "HTMLFrameElement.h"
+
+namespace WebCore {
+
+class RenderFrame : public RenderPart
+{
+public:
+    RenderFrame(HTMLFrameElement*);
+
+    virtual const char* renderName() const { return "RenderFrame"; }
+
+    HTMLFrameElement* element() const
+        { return static_cast<HTMLFrameElement*>(RenderPart::element()); }
+
+    virtual void viewCleared();
+};
+
+}
+
+#endif
diff --git a/WebCore/rendering/RenderFrameSet.cpp b/WebCore/rendering/RenderFrameSet.cpp
new file mode 100644
index 0000000..925e2ce
--- /dev/null
+++ b/WebCore/rendering/RenderFrameSet.cpp
@@ -0,0 +1,559 @@
+/**
+ * This file is part of the KDE project.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ *           (C) 2000 Simon Hausmann <hausmann@kde.org>
+ *           (C) 2000 Stefan Schimanski (1Stein@gmx.de)
+ * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+#include "config.h"
+#include "RenderFrameSet.h"
+
+#include "Cursor.h"
+#include "EventNames.h"
+#include "FrameView.h"
+#include "GraphicsContext.h"
+#include "HTMLNames.h"
+#include "HTMLFrameSetElement.h"
+#include "dom2_eventsimpl.h"
+#include "RenderCanvas.h"
+#include "RenderFrame.h"
+#include "KWQTextStream.h"
+
+namespace WebCore {
+
+using namespace EventNames;
+using namespace HTMLNames;
+
+RenderFrameSet::RenderFrameSet(HTMLFrameSetElement* frameSet)
+    : RenderContainer(frameSet)
+    , m_hSplitVar(0)
+    , m_vSplitVar(0)
+    , m_hSplit(-1)
+    , m_vSplit(-1)
+    , m_resizing(false)
+    , m_clientResizing(false)
+{
+  // init RenderObject attributes
+    setInline(false);
+
+  for (int k = 0; k < 2; ++k) {
+      m_gridLen[k] = -1;
+      m_gridDelta[k] = 0;
+      m_gridLayout[k] = 0;
+  }
+}
+
+RenderFrameSet::~RenderFrameSet()
+{
+    for (int k = 0; k < 2; ++k) {
+        if (m_gridLayout[k])
+            delete [] m_gridLayout[k];
+        if (m_gridDelta[k])
+            delete [] m_gridDelta[k];
+    }
+  if (m_hSplitVar)
+      delete [] m_hSplitVar;
+  if (m_vSplitVar)
+      delete [] m_vSplitVar;
+}
+
+bool RenderFrameSet::nodeAtPoint(NodeInfo& info, int _x, int _y, int _tx, int _ty,
+                                 HitTestAction hitTestAction)
+{
+    if (hitTestAction != HitTestForeground)
+        return false;
+
+    bool inside = RenderContainer::nodeAtPoint(info, _x, _y, _tx, _ty, hitTestAction) || 
+                  m_resizing || canResize(_x, _y);
+    if (inside && element() && !element()->noResize() && !info.readonly() && !info.innerNode()) {
+        info.setInnerNode(element());
+        info.setInnerNonSharedNode(element());
+    }
+
+    return inside || m_clientResizing;
+}
+
+void RenderFrameSet::layout()
+{
+    KHTMLAssert(needsLayout());
+    KHTMLAssert(minMaxKnown());
+
+    if (!parent()->isFrameSet()) {
+        FrameView* view = canvas()->view();
+        m_width = view->visibleWidth();
+        m_height = view->visibleHeight();
+    }
+
+    int remainingLen[2];
+    remainingLen[1] = m_width - (element()->totalCols()-1)*element()->border();
+    if (remainingLen[1] < 0)
+        remainingLen[1] = 0;
+    remainingLen[0] = m_height - (element()->totalRows()-1)*element()->border();
+    if (remainingLen[0] < 0)
+        remainingLen[0] = 0;
+
+    int availableLen[2];
+    availableLen[0] = remainingLen[0];
+    availableLen[1] = remainingLen[1];
+
+    if (m_gridLen[0] != element()->totalRows() || m_gridLen[1] != element()->totalCols()) {
+        // number of rows or cols changed
+        // need to zero out the deltas
+        m_gridLen[0] = element()->totalRows();
+        m_gridLen[1] = element()->totalCols();
+        for (int k = 0; k < 2; ++k) {
+            if (m_gridDelta[k]) delete [] m_gridDelta[k];
+            m_gridDelta[k] = new int[m_gridLen[k]];
+            if (m_gridLayout[k]) delete [] m_gridLayout[k];
+            m_gridLayout[k] = new int[m_gridLen[k]];
+            for (int i = 0; i < m_gridLen[k]; ++i)
+                m_gridDelta[k][i] = 0;
+        }
+    }
+
+    for (int k = 0; k < 2; ++k) {
+        int totalRelative = 0;
+        int totalFixed = 0;
+        int totalPercent = 0;
+        int countRelative = 0;
+        int countFixed = 0;
+        int countPercent = 0;
+        int gridLen = m_gridLen[k];
+        int* gridDelta = m_gridDelta[k];
+        Length* grid =  k ? element()->m_cols : element()->m_rows;
+        int* gridLayout = m_gridLayout[k];
+
+        if (grid) {
+            assert(gridLen);
+            // First we need to investigate how many columns of each type we have and
+            // how much space these columns are going to require.
+            for (int i = 0; i < gridLen; ++i) {
+                // Count the total length of all of the fixed columns/rows -> totalFixed
+                // Count the number of columns/rows which are fixed -> countFixed
+                if (grid[i].isFixed()) {
+                    gridLayout[i] = max(grid[i].value(), 0);
+                    totalFixed += gridLayout[i];
+                    countFixed++;
+                }
+                
+                // Count the total percentage of all of the percentage columns/rows -> totalPercent
+                // Count the number of columns/rows which are percentages -> countPercent
+                if (grid[i].isPercent()) {
+                    gridLayout[i] = max(grid[i].calcValue(availableLen[k]), 0);
+                    totalPercent += gridLayout[i];
+                    countPercent++;
+                }
+
+                // Count the total relative of all the relative columns/rows -> totalRelative
+                // Count the number of columns/rows which are relative -> countRelative
+                if (grid[i].isRelative()) {
+                    totalRelative += max(grid[i].value(), 1);
+                    countRelative++;
+                }            
+            }
+
+            // Fixed columns/rows are our first priority. If there is not enough space to fit all fixed
+            // columns/rows we need to proportionally adjust their size. 
+            if (totalFixed > remainingLen[k]) {
+                int remainingFixed = remainingLen[k];
+
+                for (int i = 0; i < gridLen; ++i) {
+                    if (grid[i].isFixed()) {
+                        gridLayout[i] = (gridLayout[i] * remainingFixed) / totalFixed;
+                        remainingLen[k] -= gridLayout[i];
+                    }
+                }
+            } else
+                remainingLen[k] -= totalFixed;
+
+            // Percentage columns/rows are our second priority. Divide the remaining space proportionally 
+            // over all percentage columns/rows. IMPORTANT: the size of each column/row is not relative 
+            // to 100%, but to the total percentage. For example, if there are three columns, each of 75%,
+            // and the available space is 300px, each column will become 100px in width.
+            if (totalPercent > remainingLen[k]) {
+                int remainingPercent = remainingLen[k];
+
+                for (int i = 0; i < gridLen; ++i) {
+                    if (grid[i].isPercent()) {
+                        gridLayout[i] = (gridLayout[i] * remainingPercent) / totalPercent;
+                        remainingLen[k] -= gridLayout[i];
+                    }
+                }
+            } else
+                remainingLen[k] -= totalPercent;
+
+            // Relative columns/rows are our last priority. Divide the remaining space proportionally
+            // over all relative columns/rows. IMPORTANT: the relative value of 0* is treated as 1*.
+            if (countRelative) {
+                int lastRelative = 0;
+                int remainingRelative = remainingLen[k];
+
+                for (int i = 0; i < gridLen; ++i) {
+                    if (grid[i].isRelative()) {
+                        gridLayout[i] = (max(grid[i].value(), 1) * remainingRelative) / totalRelative;
+                        remainingLen[k] -= gridLayout[i];
+                        lastRelative = i;
+                    }
+                }
+                
+                // If we could not evently distribute the available space of all of the relative  
+                // columns/rows, the remainder will be added to the last column/row.
+                // For example: if we have a space of 100px and three columns (*,*,*), the remainder will
+                // be 1px and will be added to the last column: 33px, 33px, 34px.
+                if (remainingLen[k]) {
+                    gridLayout[lastRelative] += remainingLen[k];
+                    remainingLen[k] = 0;
+                }
+            }
+
+            // If we still have some left over space we need to divide it over the already existing
+            // columns/rows
+            if (remainingLen[k]) {
+                // Our first priority is to spread if over the percentage columns. The remaining
+                // space is spread evenly, for example: if we have a space of 100px, the columns 
+                // definition of 25%,25% used to result in two columns of 25px. After this the 
+                // columns will each be 50px in width. 
+                if (countPercent && totalPercent) {
+                    int remainingPercent = remainingLen[k];
+                    int changePercent = 0;
+
+                    for (int i = 0; i < gridLen; ++i) {
+                        if (grid[i].isPercent()) {
+                            changePercent = (remainingPercent * gridLayout[i]) / totalPercent;
+                            gridLayout[i] += changePercent;
+                            remainingLen[k] -= changePercent;
+                        }
+                    }
+                } else if (totalFixed) {
+                    // Our last priority is to spread the remaining space over the fixed columns.
+                    // For example if we have 100px of space and two column of each 40px, both
+                    // columns will become exactly 50px.
+                    int remainingFixed = remainingLen[k];
+                    int changeFixed = 0;
+
+                    for (int i = 0; i < gridLen; ++i) {
+                        if (grid[i].isFixed()) {
+                            changeFixed = (remainingFixed * gridLayout[i]) / totalFixed;
+                            gridLayout[i] += changeFixed;
+                            remainingLen[k] -= changeFixed;
+                        } 
+                    }
+                }
+            }
+            
+            // If we still have some left over space we probably ended up with a remainder of
+            // a division. We can not spread it evenly anymore. If we have any percentage 
+            // columns/rows simply spread the remainder equally over all available percentage columns, 
+            // regardless of their size.
+            if (remainingLen[k] && countPercent) {
+                int remainingPercent = remainingLen[k];
+                int changePercent = 0;
+
+                for (int i = 0; i < gridLen; ++i) {
+                    if (grid[i].isPercent()) {
+                        changePercent = remainingPercent / countPercent;
+                        gridLayout[i] += changePercent;
+                        remainingLen[k] -= changePercent;
+                    }
+                }
+            } 
+            
+            // If we don't have any percentage columns/rows we only have fixed columns. Spread
+            // the remainder equally over all fixed columns/rows.
+            else if (remainingLen[k] && countFixed) {
+                int remainingFixed = remainingLen[k];
+                int changeFixed = 0;
+                
+                for (int i = 0; i < gridLen; ++i) {
+                    if (grid[i].isFixed()) {
+                        changeFixed = remainingFixed / countFixed;
+                        gridLayout[i] += changeFixed;
+                        remainingLen[k] -= changeFixed;
+                    }
+                }
+            }
+
+            // Still some left over... simply add it to the last column, because it is impossible
+            // spread it evenly or equally.
+            if (remainingLen[k])
+                gridLayout[gridLen - 1] += remainingLen[k];
+
+            // now we have the final layout, distribute the delta over it
+            bool worked = true;
+            for (int i = 0; i < gridLen; ++i) {
+                if (gridLayout[i] && gridLayout[i] + gridDelta[i] <= 0)
+                    worked = false;
+                gridLayout[i] += gridDelta[i];
+            }
+            // now the delta's broke something, undo it and reset deltas
+            if (!worked) {
+                for (int i = 0; i < gridLen; ++i) {
+                    gridLayout[i] -= gridDelta[i];
+                    gridDelta[i] = 0;
+                }
+            }
+        }
+        else
+            gridLayout[0] = remainingLen[k];
+    }
+
+    positionFrames();
+
+    RenderObject *child = firstChild();
+    if (!child)
+        goto end2;
+
+    if (!m_hSplitVar && !m_vSplitVar) {
+        if (!m_vSplitVar && element()->totalCols() > 1) {
+            m_vSplitVar = new bool[element()->totalCols()];
+            for (int i = 0; i < element()->totalCols(); i++) m_vSplitVar[i] = true;
+        }
+        if (!m_hSplitVar && element()->totalRows() > 1) {
+            m_hSplitVar = new bool[element()->totalRows()];
+            for (int i = 0; i < element()->totalRows(); i++) m_hSplitVar[i] = true;
+        }
+
+        for (int r = 0; r < element()->totalRows(); r++) {
+            for (int c = 0; c < element()->totalCols(); c++) {
+                bool fixed = false;
+
+                if (child->isFrameSet())
+                  fixed = static_cast<RenderFrameSet*>(child)->element()->noResize();
+                else
+                  fixed = static_cast<RenderFrame*>(child)->element()->noResize();
+
+                if (fixed) {
+                    if (element()->totalCols() > 1) {
+                        if (c>0) m_vSplitVar[c-1] = false;
+                        m_vSplitVar[c] = false;
+                    }
+                    if (element()->totalRows() > 1) {
+                        if (r>0) m_hSplitVar[r-1] = false;
+                        m_hSplitVar[r] = false;
+                    }
+                    child = child->nextSibling();
+                    if (!child)
+                        goto end1;
+                }
+            }
+        }
+
+    }
+ end1:
+    RenderContainer::layout();
+ end2:
+    setNeedsLayout(false);
+}
+
+void RenderFrameSet::positionFrames()
+{
+  int r;
+  int c;
+
+  RenderObject *child = firstChild();
+  if (!child)
+    return;
+
+  //  Node *child = _first;
+  //  if (!child) return;
+
+  int yPos = 0;
+
+  for (r = 0; r < element()->totalRows(); r++) {
+    int xPos = 0;
+    for (c = 0; c < element()->totalCols(); c++) {
+      child->setPos(xPos, yPos);
+      // has to be resized and itself resize its contents
+      if ((m_gridLayout[1][c] != child->width()) || (m_gridLayout[0][r] != child->height())) {
+          child->setWidth(m_gridLayout[1][c]);
+          child->setHeight(m_gridLayout[0][r]);
+          child->setNeedsLayout(true);
+          child->layout();
+      }
+
+      xPos += m_gridLayout[1][c] + element()->border();
+      child = child->nextSibling();
+
+      if (!child)
+        return;
+
+    }
+
+    yPos += m_gridLayout[0][r] + element()->border();
+  }
+
+  // all the remaining frames are hidden to avoid ugly
+  // spurious unflowed frames
+  while (child) {
+      child->setWidth(0);
+      child->setHeight(0);
+      child->setNeedsLayout(false);
+
+      child = child->nextSibling();
+  }
+}
+
+bool RenderFrameSet::userResize(MouseEvent* evt)
+{
+    if (needsLayout())
+        return false;
+    
+    bool res = false;
+    int _x = evt->clientX();
+    int _y = evt->clientY();
+    
+    if (!m_resizing && evt->type() == mousemoveEvent || evt->type() == mousedownEvent) {
+        m_hSplit = -1;
+        m_vSplit = -1;
+        //bool resizePossible = true;
+        
+        // check if we're over a horizontal or vertical boundary
+        int pos = m_gridLayout[1][0] + xPos();
+        for (int c = 1; c < element()->totalCols(); c++) {
+            if (_x >= pos && _x <= pos+element()->border()) {
+                if (m_vSplitVar && m_vSplitVar[c - 1])
+                    m_vSplit = c - 1;
+                res = true;
+                break;
+            }
+            pos += m_gridLayout[1][c] + element()->border();
+        }
+        
+        pos = m_gridLayout[0][0] + yPos();
+        for (int r = 1; r < element()->totalRows(); r++) {
+            if (_y >= pos && _y <= pos+element()->border()) {
+                if (m_hSplitVar && m_hSplitVar[r - 1])
+                    m_hSplit = r - 1;
+                res = true;
+                break;
+            }
+            pos += m_gridLayout[0][r] + element()->border();
+        }
+        
+        if (evt->type() == mousedownEvent) {
+            setResizing(true);
+            m_vSplitPos = _x;
+            m_hSplitPos = _y;
+            m_oldpos = -1;
+        } else
+            canvas()->view()->setCursor(pointerCursor());
+    }
+    
+    // ### check the resize is not going out of bounds.
+    if (m_resizing && evt->type() == mouseupEvent) {
+        setResizing(false);
+        
+        if (m_vSplit != -1) {
+            int delta = m_vSplitPos - _x;
+            m_gridDelta[1][m_vSplit] -= delta;
+            m_gridDelta[1][m_vSplit+1] += delta;
+        }
+        if (m_hSplit != -1) {
+            int delta = m_hSplitPos - _y;
+            m_gridDelta[0][m_hSplit] -= delta;
+            m_gridDelta[0][m_hSplit+1] += delta;
+        }
+        
+        // this just schedules the relayout
+        // important, otherwise the moving indicator is not correctly erased
+        setNeedsLayout(true);
+    } else if (m_resizing || evt->type() == mouseupEvent) {
+        FrameView* v = canvas()->view();        
+        v->disableFlushDrawing();
+        GraphicsContext* context = v->lockDrawingFocus();
+        
+        IntRect r(xPos(), yPos(), width(), height());
+        const int rBord = 3;
+        int sw = element()->border();
+        int p = m_resizing ? (m_vSplit > -1 ? _x : _y) : -1;
+        const RGBA32 greyQuarterOpacity = 0x40A0A0A0;
+        if (m_vSplit > -1) {
+            if (m_oldpos >= 0)
+                v->updateContents(IntRect(m_oldpos + sw/2 - rBord, r.y(), 2 * rBord, r.height()), true);
+            if (p >= 0) {
+                context->setPen(Pen::NoPen);
+                context->setFillColor(greyQuarterOpacity);
+                context->drawRect(IntRect(p + sw/2 - rBord, r.y(), 2 * rBord, r.height()));
+            }
+        } else {
+            if (m_oldpos >= 0)
+                v->updateContents(IntRect(r.x(), m_oldpos + sw/2 - rBord, r.width(), 2 * rBord), true);
+            if (p >= 0) {
+                context->setPen(Pen::NoPen);
+                context->setFillColor(greyQuarterOpacity);
+                context->drawRect(IntRect(r.x(), p + sw/2 - rBord, r.width(), 2 * rBord));
+            }
+        }
+        m_oldpos = p;
+
+        v->unlockDrawingFocus(context);
+        v->enableFlushDrawing();
+    }
+    
+    return res;
+}
+
+void RenderFrameSet::setResizing(bool e)
+{
+    m_resizing = e;
+    for (RenderObject* p = parent(); p; p = p->parent())
+        if (p->isFrameSet())
+            static_cast<RenderFrameSet*>(p)->m_clientResizing = m_resizing;
+    canvas()->view()->setResizingFrameSet(e ? element() : 0);
+}
+
+bool RenderFrameSet::canResize(int _x, int _y)
+{
+    // if we haven't received a layout, then the gridLayout doesn't contain useful data yet
+    if (needsLayout() || !m_gridLayout[0] || !m_gridLayout[1])
+        return false;
+
+    // check if we're over a horizontal or vertical boundary
+    int pos = m_gridLayout[1][0];
+    for (int c = 1; c < element()->totalCols(); c++)
+        if (_x >= pos && _x <= pos+element()->border())
+            return true;
+
+    pos = m_gridLayout[0][0];
+    for (int r = 1; r < element()->totalRows(); r++)
+        if (_y >= pos && _y <= pos+element()->border())
+            return true;
+
+    return false;
+}
+
+#ifndef NDEBUG
+void RenderFrameSet::dump(QTextStream* stream, DeprecatedString ind) const
+{
+  *stream << " totalrows=" << element()->totalRows();
+  *stream << " totalcols=" << element()->totalCols();
+
+  unsigned i;
+  for (i = 0; i < (unsigned)element()->totalRows(); i++)
+    *stream << " hSplitvar(" << i << ")=" << m_hSplitVar[i];
+
+  for (i = 0; i < (unsigned)element()->totalCols(); i++)
+    *stream << " vSplitvar(" << i << ")=" << m_vSplitVar[i];
+
+  RenderContainer::dump(stream,ind);
+}
+#endif
+
+}
diff --git a/WebCore/rendering/RenderFrameSet.h b/WebCore/rendering/RenderFrameSet.h
new file mode 100644
index 0000000..6c078a0
--- /dev/null
+++ b/WebCore/rendering/RenderFrameSet.h
@@ -0,0 +1,86 @@
+/*
+ * This file is part of the KDE project.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ *           (C) 2000 Simon Hausmann <hausmann@kde.org>
+ * Copyright (C) 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef RenderFrameSet_H
+#define RenderFrameSet_H
+
+#include "RenderContainer.h"
+#include "HTMLFrameSetElement.h"
+
+
+namespace WebCore {
+
+class HTMLFrameSetElement;
+class MouseEvent;
+
+class RenderFrameSet : public RenderContainer
+{
+    friend class HTMLFrameSetElement;
+public:
+    RenderFrameSet(HTMLFrameSetElement*);
+    virtual ~RenderFrameSet();
+
+    virtual const char* renderName() const { return "RenderFrameSet"; }
+    virtual bool isFrameSet() const { return true; }
+
+    virtual void layout();
+
+    void positionFrames();
+
+    bool resizing() const { return m_resizing; }
+
+    bool userResize(MouseEvent*);
+    bool canResize(int x, int y);
+    void setResizing(bool);
+
+    virtual bool nodeAtPoint(NodeInfo&, int x, int y, int tx, int ty, HitTestAction);
+
+    HTMLFrameSetElement* element() const
+        { return static_cast<HTMLFrameSetElement*>(RenderContainer::element()); }
+
+#ifndef NDEBUG
+    virtual void dump(QTextStream* stream, DeprecatedString ind = "") const;
+#endif
+
+private:
+    int m_oldpos;
+    int m_gridLen[2];
+    int* m_gridDelta[2];
+    int* m_gridLayout[2];
+
+    bool* m_hSplitVar; // is this split variable?
+    bool* m_vSplitVar;
+
+    int m_hSplit; // the split currently resized
+    int m_vSplit;
+    int m_hSplitPos;
+    int m_vSplitPos;
+
+    bool m_resizing;
+    bool m_clientResizing;
+};
+
+}
+
+#endif
diff --git a/WebCore/rendering/RenderImage.h b/WebCore/rendering/RenderImage.h
index c0ce1d1..c1dc64e 100644
--- a/WebCore/rendering/RenderImage.h
+++ b/WebCore/rendering/RenderImage.h
@@ -29,7 +29,7 @@
 
 #include "CachedImage.h"
 #include "HTMLElement.h"
-#include "render_replaced.h"
+#include "RenderReplaced.h"
 
 namespace WebCore {
 
diff --git a/WebCore/rendering/RenderPart.cpp b/WebCore/rendering/RenderPart.cpp
new file mode 100644
index 0000000..70e10ac
--- /dev/null
+++ b/WebCore/rendering/RenderPart.cpp
@@ -0,0 +1,125 @@
+/**
+ * This file is part of the KDE project.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ *           (C) 2000 Simon Hausmann <hausmann@kde.org>
+ *           (C) 2000 Stefan Schimanski (1Stein@gmx.de)
+ * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+#include "config.h"
+#include "RenderPart.h"
+
+#include "Document.h"
+#include "Frame.h"
+#include "FrameTree.h"
+#include "FrameView.h"
+#include "HTMLElement.h"
+#include "HTMLNames.h"
+#include "Page.h"
+
+namespace WebCore {
+
+using namespace HTMLNames;
+
+RenderPart::RenderPart(HTMLElement* node)
+    : RenderWidget(node)
+    , m_frame(0)
+{
+    // init RenderObject attributes
+    setInline(false);
+}
+
+RenderPart::~RenderPart()
+{
+    // Since deref ends up calling setWidget back on us, need to make sure
+    // that widget is already 0 so it won't do any work.
+    Widget* widget = m_widget;
+    m_widget = 0;
+    if (widget && widget->isFrameView())
+        static_cast<FrameView*>(widget)->deref();
+    else
+        delete widget;
+
+    setFrame(0);
+}
+
+void RenderPart::setFrame(Frame* frame)
+{
+    if (frame == m_frame)
+        return;
+    if (m_frame)
+        m_frame->disconnectOwnerRenderer();
+    m_frame = frame;
+}
+
+void RenderPart::setWidget(Widget* widget)
+{
+    if (widget != m_widget) {
+        if (widget && widget->isFrameView())
+            static_cast<FrameView*>(widget)->ref();
+        RenderWidget::setWidget(widget);
+
+        setNeedsLayoutAndMinMaxRecalc();
+
+        // make sure the scrollbars are set correctly for restore
+        // ### find better fix
+        viewCleared();
+    }
+}
+
+void RenderPart::viewCleared()
+{
+}
+
+void RenderPart::deleteWidget()
+{
+    if (m_widget && m_widget->isFrameView())
+        static_cast<FrameView*>(m_widget)->deref();
+    else
+        delete m_widget;
+}
+
+// FIXME: This should not be necessary.  Remove this once WebKit knows to properly schedule
+// layouts using WebCore when objects resize.
+void RenderPart::updateWidgetPosition()
+{
+    if (!m_widget)
+        return;
+    
+    int x, y, width, height;
+    absolutePosition(x, y);
+    x += borderLeft() + paddingLeft();
+    y += borderTop() + paddingTop();
+    width = m_width - borderLeft() - borderRight() - paddingLeft() - paddingRight();
+    height = m_height - borderTop() - borderBottom() - paddingTop() - paddingBottom();
+    IntRect newBounds(x,y,width,height);
+    if (newBounds != m_widget->frameGeometry()) {
+        // The widget changed positions.  Update the frame geometry.
+        RenderArena *arena = ref();
+        element()->ref();
+        m_widget->setFrameGeometry(newBounds);
+        element()->deref();
+        deref(arena);
+        
+        if (m_widget && m_widget->isFrameView())
+            static_cast<FrameView*>(m_widget)->layout();
+    }
+}
+
+}
diff --git a/WebCore/rendering/RenderPart.h b/WebCore/rendering/RenderPart.h
new file mode 100644
index 0000000..c1cdf54
--- /dev/null
+++ b/WebCore/rendering/RenderPart.h
@@ -0,0 +1,64 @@
+/*
+ * This file is part of the KDE project.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ *           (C) 2000 Simon Hausmann <hausmann@kde.org>
+ * Copyright (C) 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef RenderPart_H
+#define RenderPart_H
+
+#include "RenderWidget.h"
+
+namespace WebCore {
+
+class Frame;
+class HTMLElement;
+
+class RenderPart : public RenderWidget {
+public:
+    RenderPart(HTMLElement*);
+    virtual ~RenderPart();
+    
+    virtual const char* renderName() const { return "RenderPart"; }
+
+    void setFrame(Frame*);
+    void setWidget(Widget*);
+
+    // FIXME: This should not be necessary.
+    // Remove this once WebKit knows to properly schedule layouts using WebCore when objects resize.
+    void updateWidgetPosition();
+
+    bool hasFallbackContent() const { return m_hasFallbackContent; }
+
+    virtual void viewCleared();
+
+protected:
+    bool m_hasFallbackContent;
+
+private:
+    virtual void deleteWidget();
+
+    Frame* m_frame;
+};
+
+}
+
+#endif
diff --git a/WebCore/rendering/RenderPartObject.cpp b/WebCore/rendering/RenderPartObject.cpp
new file mode 100644
index 0000000..cfd384b
--- /dev/null
+++ b/WebCore/rendering/RenderPartObject.cpp
@@ -0,0 +1,287 @@
+/**
+ * This file is part of the KDE project.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ *           (C) 2000 Simon Hausmann <hausmann@kde.org>
+ *           (C) 2000 Stefan Schimanski (1Stein@gmx.de)
+ * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+#include "config.h"
+#include "RenderPartObject.h"
+
+#include "Document.h"
+#include "Frame.h"
+#include "FrameTree.h"
+#include "HTMLNames.h"
+#include "HTMLEmbedElement.h"
+#include "HTMLIFrameElement.h"
+#include "HTMLObjectElement.h"
+#include "HTMLParamElement.h"
+#include "Page.h"
+#include "Text.h"
+
+namespace WebCore {
+
+using namespace HTMLNames;
+
+RenderPartObject::RenderPartObject(HTMLElement* element)
+    : RenderPart(element)
+{
+    // init RenderObject attributes
+    setInline(true);
+    m_hasFallbackContent = false;
+}
+
+static bool isURLAllowed(Document *doc, const String &url)
+{
+    KURL newURL(doc->completeURL(url.deprecatedString()));
+    newURL.setRef(DeprecatedString::null);
+    
+    if (doc->frame()->page()->frameCount() >= 200)
+        return false;
+
+    // We allow one level of self-reference because some sites depend on that.
+    // But we don't allow more than one.
+    bool foundSelfReference = false;
+    for (Frame *frame = doc->frame(); frame; frame = frame->tree()->parent()) {
+        KURL frameURL = frame->url();
+        frameURL.setRef(DeprecatedString::null);
+        if (frameURL == newURL) {
+            if (foundSelfReference)
+                return false;
+            foundSelfReference = true;
+        }
+    }
+    return true;
+}
+
+static inline void mapClassIdToServiceType(const String& classId, String& serviceType)
+{
+    // It is ActiveX, but the nsplugin system handling
+    // should also work, that's why we don't override the
+    // serviceType with application/x-activex-handler
+    // but let the KTrader in khtmlpart::createPart() detect
+    // the user's preference: launch with activex viewer or
+    // with nspluginviewer (Niko)
+    if (classId.contains("D27CDB6E-AE6D-11cf-96B8-444553540000"))
+        serviceType = "application/x-shockwave-flash";
+    else if (classId.contains("CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA"))
+        serviceType = "audio/x-pn-realaudio-plugin";
+    else if (classId.contains("02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"))
+        serviceType = "video/quicktime";
+    else if (classId.contains("166B1BCA-3F9C-11CF-8075-444553540000"))
+        serviceType = "application/x-director";
+    else if (classId.contains("6BF52A52-394A-11d3-B153-00C04F79FAA6"))
+        serviceType = "application/x-mplayer2";
+    else if (!classId.isEmpty())
+        // We have a clsid, means this is activex (Niko)
+        serviceType = "application/x-activex-handler";
+    // TODO: add more plugins here
+}
+
+void RenderPartObject::updateWidget()
+{
+  String url;
+  String serviceType;
+  Vector<String> paramNames;
+  Vector<String> paramValues;
+  Frame* frame = m_view->frame();
+
+  setNeedsLayoutAndMinMaxRecalc();
+
+  if (element()->hasTagName(objectTag)) {
+
+      HTMLObjectElement* o = static_cast<HTMLObjectElement*>(element());
+
+      if (!o->isComplete())
+        return;
+      // Check for a child EMBED tag.
+      HTMLEmbedElement* embed = 0;
+      for (Node* child = o->firstChild(); child;) {
+          if (child->hasTagName(embedTag)) {
+              embed = static_cast<HTMLEmbedElement*>(child);
+              break;
+          } else if (child->hasTagName(objectTag))
+              child = child->nextSibling();         // Don't descend into nested OBJECT tags
+          else
+              child = child->traverseNextNode(o);   // Otherwise descend (EMBEDs may be inside COMMENT tags)
+      }
+      
+      // Use the attributes from the EMBED tag instead of the OBJECT tag including WIDTH and HEIGHT.
+      HTMLElement *embedOrObject;
+      if (embed) {
+          embedOrObject = (HTMLElement *)embed;
+          String attribute = embedOrObject->getAttribute(widthAttr);
+          if (!attribute.isEmpty())
+              o->setAttribute(widthAttr, attribute);
+          attribute = embedOrObject->getAttribute(heightAttr);
+          if (!attribute.isEmpty())
+              o->setAttribute(heightAttr, attribute);
+          url = embed->url;
+          serviceType = embed->serviceType;
+      } else
+          embedOrObject = (HTMLElement *)o;
+      
+      // If there was no URL or type defined in EMBED, try the OBJECT tag.
+      if (url.isEmpty())
+          url = o->url;
+      if (serviceType.isEmpty())
+          serviceType = o->serviceType;
+      
+      HashSet<StringImpl*, CaseInsensitiveHash> uniqueParamNames;
+      
+      // Scan the PARAM children.
+      // Get the URL and type from the params if we don't already have them.
+      // Get the attributes from the params if there is no EMBED tag.
+      Node *child = o->firstChild();
+      while (child && (url.isEmpty() || serviceType.isEmpty() || !embed)) {
+          if (child->hasTagName(paramTag)) {
+              HTMLParamElement* p = static_cast<HTMLParamElement*>(child);
+              String name = p->name().lower();
+              if (url.isEmpty() && (name == "src" || name == "movie" || name == "code" || name == "url"))
+                  url = p->value();
+              if (serviceType.isEmpty() && name == "type") {
+                  serviceType = p->value();
+                  int pos = serviceType.find(";");
+                  if (pos != -1)
+                      serviceType = serviceType.left(pos);
+              }
+              if (!embed && !name.isEmpty()) {
+                  uniqueParamNames.add(p->name().impl());
+                  paramNames.append(p->name());
+                  paramValues.append(p->value());
+              }
+          }
+          child = child->nextSibling();
+      }
+      
+      // When OBJECT is used for an applet via Sun's Java plugin, the CODEBASE attribute in the tag
+      // points to the Java plugin itself (an ActiveX component) while the actual applet CODEBASE is
+      // in a PARAM tag. See <http://java.sun.com/products/plugin/1.2/docs/tags.html>. This means
+      // we have to explicitly suppress the tag's CODEBASE attribute if there is none in a PARAM,
+      // else our Java plugin will misinterpret it. [4004531]
+      String codebase;
+      if (!embed && serviceType.lower() == "application/x-java-applet") {
+          codebase = "codebase";
+          uniqueParamNames.add(codebase.impl()); // pretend we found it in a PARAM already
+      }
+      
+      // Turn the attributes of either the EMBED tag or OBJECT tag into arrays, but don't override PARAM values.
+      NamedAttrMap* attributes = embedOrObject->attributes();
+      if (attributes) {
+          for (unsigned i = 0; i < attributes->length(); ++i) {
+              Attribute* it = attributes->attributeItem(i);
+              const AtomicString& name = it->name().localName();
+              if (embed || !uniqueParamNames.contains(name.impl())) {
+                  paramNames.append(name.domString());
+                  paramValues.append(it->value().domString());
+              }
+          }
+      }
+      
+      // If we still don't have a type, try to map from a specific CLASSID to a type.
+      if (serviceType.isEmpty() && !o->classId.isEmpty())
+          mapClassIdToServiceType(o->classId, serviceType);
+      
+      // If no URL and type, abort.
+      if (url.isEmpty() && serviceType.isEmpty())
+          return;
+      if (!isURLAllowed(document(), url))
+          return;
+
+      // Find out if we support fallback content.
+      m_hasFallbackContent = false;
+      for (Node *child = o->firstChild(); child && !m_hasFallbackContent; child = child->nextSibling()) {
+          if ((!child->isTextNode() && !child->hasTagName(embedTag) && !child->hasTagName(paramTag)) || // Discount <embed> and <param>
+              (child->isTextNode() && !static_cast<Text*>(child)->containsOnlyWhitespace()))
+              m_hasFallbackContent = true;
+      }
+      bool success = frame->requestObject(this, url, AtomicString(o->name()), serviceType, paramNames, paramValues);
+      if (!success && m_hasFallbackContent)
+          o->renderFallbackContent();
+  } else if (element()->hasTagName(embedTag)) {
+      HTMLEmbedElement *o = static_cast<HTMLEmbedElement*>(element());
+      url = o->url;
+      serviceType = o->serviceType;
+
+      if (url.isEmpty() && serviceType.isEmpty())
+          return;
+      if (!isURLAllowed(document(), url))
+          return;
+      
+      // add all attributes set on the embed object
+      NamedAttrMap* a = o->attributes();
+      if (a) {
+          for (unsigned i = 0; i < a->length(); ++i) {
+              Attribute* it = a->attributeItem(i);
+              paramNames.append(it->name().localName().domString());
+              paramValues.append(it->value().domString());
+          }
+      }
+      frame->requestObject(this, url, o->getAttribute(nameAttr), serviceType, paramNames, paramValues);
+  } else {
+      assert(element()->hasTagName(iframeTag));
+      HTMLIFrameElement* o = static_cast<HTMLIFrameElement*>(element());
+      url = o->m_URL;
+      if (!isURLAllowed(document(), url))
+          return;
+      if (url.isEmpty())
+          url = "about:blank";
+      FrameView* v = static_cast<FrameView*>(m_view);
+      v->frame()->requestFrame(this, url, o->m_name);
+  }
+}
+
+void RenderPartObject::layout()
+{
+    KHTMLAssert(needsLayout());
+    KHTMLAssert(minMaxKnown());
+
+    calcWidth();
+    calcHeight();
+
+    RenderPart::layout();
+
+    setNeedsLayout(false);
+}
+
+void RenderPartObject::viewCleared()
+{
+    if (element() && m_widget && m_widget->isFrameView()) {
+        FrameView* view = static_cast<FrameView*>(m_widget);
+        bool hasBorder = false;
+        int marginw = -1;
+        int marginh = -1;
+        if (element()->hasTagName(iframeTag)) {
+            HTMLIFrameElement* frame = static_cast<HTMLIFrameElement*>(element());
+            hasBorder = frame->m_frameBorder;
+            marginw = frame->m_marginWidth;
+            marginh = frame->m_marginHeight;
+        }
+
+        view->setHasBorder(hasBorder);
+        view->setIgnoreWheelEvents(element()->hasTagName(iframeTag));
+        if (marginw != -1)
+            view->setMarginWidth(marginw);
+        if (marginh != -1)
+            view->setMarginHeight(marginh);
+    }
+}
+
+}
diff --git a/WebCore/rendering/RenderPartObject.h b/WebCore/rendering/RenderPartObject.h
new file mode 100644
index 0000000..5d600d0
--- /dev/null
+++ b/WebCore/rendering/RenderPartObject.h
@@ -0,0 +1,47 @@
+/*
+ * This file is part of the KDE project.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ *           (C) 2000 Simon Hausmann <hausmann@kde.org>
+ * Copyright (C) 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef RenderPartObject_H
+#define RenderPartObject_H
+
+#include "RenderPart.h"
+
+namespace WebCore {
+
+class RenderPartObject : public RenderPart
+{
+public:
+    RenderPartObject(HTMLElement*);
+
+    virtual const char* renderName() const { return "RenderPartObject"; }
+
+    virtual void layout();
+    virtual void updateWidget();
+
+    virtual void viewCleared();
+};
+
+}
+
+#endif
diff --git a/WebCore/rendering/RenderReplaced.cpp b/WebCore/rendering/RenderReplaced.cpp
new file mode 100644
index 0000000..3411be8
--- /dev/null
+++ b/WebCore/rendering/RenderReplaced.cpp
@@ -0,0 +1,227 @@
+/**
+ * This file is part of the HTML widget for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+#include "config.h"
+#include "RenderReplaced.h"
+
+#include "render_line.h"
+#include "RenderBlock.h"
+
+using namespace std;
+
+namespace WebCore {
+
+RenderReplaced::RenderReplaced(Node* node)
+    : RenderBox(node)
+{
+    // init RenderObject attributes
+    setReplaced(true);
+
+    m_intrinsicWidth = 300;
+    m_intrinsicHeight = 150;
+    m_selectionState = SelectionNone;
+}
+
+bool RenderReplaced::shouldPaint(PaintInfo& i, int& _tx, int& _ty)
+{
+    if (i.phase != PaintPhaseForeground && i.phase != PaintPhaseOutline && i.phase != PaintPhaseSelfOutline 
+        && i.phase != PaintPhaseSelection)
+        return false;
+
+    if (!shouldPaintWithinRoot(i))
+        return false;
+        
+    // if we're invisible or haven't received a layout yet, then just bail.
+    if (style()->visibility() != VISIBLE || m_y <=  -500000)  return false;
+
+    int tx = _tx + m_x;
+    int ty = _ty + m_y;
+
+    // Early exit if the element touches the edges.
+    int top = ty;
+    int bottom = ty + m_height;
+    if (isSelected() && m_inlineBoxWrapper) {
+        int selTop = _ty + m_inlineBoxWrapper->root()->selectionTop();
+        int selBottom = _ty + selTop + m_inlineBoxWrapper->root()->selectionHeight();
+        top = min(selTop, top);
+        bottom = max(selBottom, bottom);
+    }
+    
+    int os = 2*maximalOutlineSize(i.phase);
+    if (tx >= i.r.right() + os || tx + m_width <= i.r.x() - os)
+        return false;
+    if (top >= i.r.bottom() + os || bottom <= i.r.y() - os)
+        return false;
+
+    return true;
+}
+
+void RenderReplaced::calcMinMaxWidth()
+{
+    KHTMLAssert( !minMaxKnown());
+
+#ifdef DEBUG_LAYOUT
+    kdDebug( 6040 ) << "RenderReplaced::calcMinMaxWidth() known=" << minMaxKnown() << endl;
+#endif
+
+    int width = calcReplacedWidth() + paddingLeft() + paddingRight() + borderLeft() + borderRight();
+    if (style()->width().isPercent() || (style()->width().isAuto() && style()->height().isPercent())) {
+        m_minWidth = 0;
+        m_maxWidth = width;
+    } else
+        m_minWidth = m_maxWidth = width;
+
+    setMinMaxKnown();
+}
+
+short RenderReplaced::lineHeight( bool, bool ) const
+{
+    return height()+marginTop()+marginBottom();
+}
+
+short RenderReplaced::baselinePosition( bool, bool ) const
+{
+    return height()+marginTop()+marginBottom();
+}
+
+int RenderReplaced::caretMinOffset() const 
+{ 
+    return 0; 
+}
+
+// Returns 1 since a replaced element can have the caret positioned 
+// at its beginning (0), or at its end (1).
+// NOTE: Yet, "select" elements can have any number of "option" elements
+// as children, so this "0 or 1" idea does not really hold up.
+int RenderReplaced::caretMaxOffset() const 
+{ 
+    return 1; 
+}
+
+unsigned RenderReplaced::caretMaxRenderedOffset() const
+{
+    return 1; 
+}
+
+VisiblePosition RenderReplaced::positionForCoordinates(int _x, int _y)
+{
+    InlineBox *box = inlineBoxWrapper();
+    if (!box)
+        return VisiblePosition(element(), 0, DOWNSTREAM);
+
+    RootInlineBox *root = box->root();
+
+    int absx, absy;
+    containingBlock()->absolutePosition(absx, absy);
+
+    int top = absy + root->topOverflow();
+    int bottom = root->nextRootBox() ? absy + root->nextRootBox()->topOverflow() : absy + root->bottomOverflow();
+
+    if (_y < top)
+        return VisiblePosition(element(), caretMinOffset(), DOWNSTREAM); // coordinates are above
+    
+    if (_y >= bottom)
+        return VisiblePosition(element(), caretMaxOffset(), DOWNSTREAM); // coordinates are below
+    
+    if (element()) {
+        if (_x <= absx + xPos() + (width() / 2))
+            return VisiblePosition(element(), 0, DOWNSTREAM);
+
+        return VisiblePosition(element(), 1, DOWNSTREAM);
+    }
+
+    return RenderBox::positionForCoordinates(_x, _y);
+}
+
+IntRect RenderReplaced::selectionRect()
+{
+    if (!isSelected())
+        return IntRect();
+    if (!m_inlineBoxWrapper)
+        // We're a block-level replaced element.  Just return our own dimensions.
+        return absoluteBoundingBoxRect();
+
+    RenderBlock* cb =  containingBlock();
+    if (!cb)
+        return IntRect();
+    
+    RootInlineBox* root = m_inlineBoxWrapper->root();
+    int selectionTop = root->selectionTop();
+    int selectionHeight = root->selectionHeight();
+    int selectionLeft = xPos();
+    int selectionRight = xPos() + width();
+    
+    int absx, absy;
+    cb->absolutePosition(absx, absy);
+    if (cb->hasOverflowClip())
+        cb->layer()->subtractScrollOffset(absx, absy);
+
+    return IntRect(selectionLeft + absx, selectionTop + absy, selectionRight - selectionLeft, selectionHeight);
+}
+
+void RenderReplaced::setSelectionState(SelectionState s)
+{
+    m_selectionState = s;
+    if (m_inlineBoxWrapper) {
+        RootInlineBox* line = m_inlineBoxWrapper->root();
+        if (line)
+            line->setHasSelectedChildren(isSelected());
+    }
+    
+    containingBlock()->setSelectionState(s);
+}
+
+bool RenderReplaced::isSelected()
+{
+    SelectionState s = selectionState();
+    if (s == SelectionNone)
+        return false;
+    if (s == SelectionInside)
+        return true;
+
+    int selectionStart, selectionEnd;
+    RenderObject::selectionStartEnd(selectionStart, selectionEnd);
+    if (s == SelectionStart)
+        return selectionStart == 0;
+        
+    int end = element()->hasChildNodes() ? element()->childNodeCount() : 1;
+    if (s == SelectionEnd)
+        return selectionEnd == end;
+    if (s == SelectionBoth)
+        return selectionStart == 0 && selectionEnd == end;
+        
+    ASSERT(0);
+    return false;
+}
+
+Color RenderReplaced::selectionColor(GraphicsContext* p) const
+{
+    Color color = RenderBox::selectionColor(p);
+         
+    // Limit the opacity so that no user-specified selection color can obscure selected images.
+    if (color.alpha() > selectionColorImageOverlayAlpha)
+        color = Color(color.red(), color.green(), color.blue(), selectionColorImageOverlayAlpha);
+
+    return color;
+}
+}
diff --git a/WebCore/rendering/render_replaced.h b/WebCore/rendering/RenderReplaced.h
similarity index 67%
rename from WebCore/rendering/render_replaced.h
rename to WebCore/rendering/RenderReplaced.h
index cd7bda8..e9c5344 100644
--- a/WebCore/rendering/render_replaced.h
+++ b/WebCore/rendering/RenderReplaced.h
@@ -21,8 +21,8 @@
  *
  */
 
-#ifndef render_replaced_h
-#define render_replaced_h
+#ifndef RenderReplaced_H
+#define RenderReplaced_H
 
 #include "RenderBox.h"
 
@@ -73,53 +73,7 @@
 };
 
 
-class RenderWidget : public RenderReplaced, public WidgetClient
-{
-public:
-    RenderWidget(Node*);
-    virtual ~RenderWidget();
 
-    virtual void setStyle(RenderStyle*);
-
-    virtual void paint(PaintInfo&, int tx, int ty);
-
-    virtual bool isWidget() const { return true; };
-
-    virtual void destroy();
-    virtual void layout( );
-
-    Widget* widget() const { return m_widget; }
-    FrameView* view() const { return m_view; }
-
-    RenderArena* ref() { ++m_refCount; return renderArena(); }
-    void deref(RenderArena*);
-    
-    virtual void setSelectionState(SelectionState);
-
-    virtual void updateWidgetPosition();
-
-    virtual void setWidget(Widget*);
-
-    using RenderReplaced::element;
-
-private:
-    virtual void focusIn(Widget*);
-    virtual void focusOut(Widget*);
-    virtual void scrollToVisible(Widget*);
-    virtual Element* element(Widget*);
-    virtual bool isVisible(Widget*);
-    virtual void sendConsumedMouseUp(Widget*);
-
-    void resizeWidget(Widget*, int w, int h);
-
-    virtual void deleteWidget();
-
-protected:
-    Widget* m_widget;
-    FrameView* m_view;
-private:
-    int m_refCount;
-};
 
 }
 
diff --git a/WebCore/rendering/RenderWidget.cpp b/WebCore/rendering/RenderWidget.cpp
new file mode 100644
index 0000000..59d8b8e
--- /dev/null
+++ b/WebCore/rendering/RenderWidget.cpp
@@ -0,0 +1,284 @@
+/**
+ * This file is part of the HTML widget for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+#include "config.h"
+#include "RenderWidget.h"
+
+#include "Document.h"
+#include "Element.h"
+#include "EventNames.h"
+#include "FrameView.h"
+#include "GraphicsContext.h"
+#include "RenderCanvas.h"
+
+using namespace std;
+
+namespace WebCore {
+
+using namespace EventNames;
+
+// Returns 1 since a replaced element can have the caret positioned 
+// at its beginning (0), or at its end (1).
+// NOTE: Yet, "select" elements can have any number of "option" elements
+// as children, so this "0 or 1" idea does not really hold up.
+
+RenderWidget::RenderWidget(Node* node)
+      : RenderReplaced(node)
+      , m_widget(0)
+      , m_refCount(0)
+{
+    // a replaced element doesn't support being anonymous
+    ASSERT(node);
+    m_view = node->document()->view();
+
+    canvas()->addWidget(this);
+
+    // this is no real reference counting, its just there
+    // to make sure that we're not deleted while we're recursed
+    // in an eventFilter of the widget
+    ref();
+}
+
+void RenderWidget::destroy()
+{
+    // We can't call the base class's destroy because we don't
+    // want to unconditionally delete ourselves (we're ref-counted).
+    // So the code below includes copied and pasted contents of
+    // both RenderBox::destroy() and RenderObject::destroy().
+    // Fix originally made for <rdar://problem/4228818>.
+
+    if (RenderCanvas *c = canvas())
+        c->removeWidget(this);
+
+    remove();
+
+    if (m_widget) {
+        if (m_view)
+            m_view->removeChild(m_widget);
+        m_widget->setClient(0);
+    }
+
+    RenderLayer* layer = m_layer;
+    RenderArena* arena = renderArena();
+    
+    if (layer)
+        layer->clearClipRect();
+    
+    setNode(0);
+    deref(arena);
+    
+    if (layer)
+        layer->destroy(arena);
+}
+
+RenderWidget::~RenderWidget()
+{
+    KHTMLAssert(m_refCount <= 0);
+    deleteWidget();
+}
+
+void RenderWidget::resizeWidget(Widget* widget, int w, int h)
+{
+    if (element() && (widget->width() != w || widget->height() != h)) {
+        RenderArena *arena = ref();
+        element()->ref();
+        widget->resize(w, h);
+        element()->deref();
+        deref(arena);
+    }
+}
+
+void RenderWidget::setWidget(Widget* widget)
+{
+    if (widget != m_widget) {
+        if (m_widget) {
+            m_widget->setClient(0);
+            deleteWidget();
+        }
+        m_widget = widget;
+        if (m_widget) {
+            m_widget->setClient(this);
+            // if we've already received a layout, apply the calculated space to the
+            // widget immediately, but we have to have really been full constructed (with a non-null
+            // style pointer).
+            if (!needsLayout() && style())
+                resizeWidget(m_widget,
+                    m_width - borderLeft() - borderRight() - paddingLeft() - paddingRight(),
+                    m_height - borderTop() - borderBottom() - paddingTop() - paddingBottom());
+            else
+                setPos(xPos(), -500000);
+            if (style()) {
+                if (style()->visibility() != VISIBLE)
+                    m_widget->hide();
+                else
+                    m_widget->show();
+            }
+            m_view->addChild(m_widget, -500000, 0);
+        }
+    }
+}
+
+void RenderWidget::layout()
+{
+    KHTMLAssert(needsLayout());
+    KHTMLAssert(minMaxKnown());
+
+    setNeedsLayout(false);
+}
+
+void RenderWidget::sendConsumedMouseUp(Widget*)
+{
+    RenderArena* arena = ref();
+    EventTargetNodeCast(node())->dispatchSimulatedMouseEvent(mouseupEvent);
+    deref(arena);
+}
+
+void RenderWidget::setStyle(RenderStyle *_style)
+{
+    RenderReplaced::setStyle(_style);
+    if (m_widget) {
+        m_widget->setFont(style()->font());
+        if (style()->visibility() != VISIBLE)
+            m_widget->hide();
+        else
+            m_widget->show();
+    }
+}
+
+void RenderWidget::paint(PaintInfo& i, int tx, int ty)
+{
+    if (!shouldPaint(i, tx, ty))
+        return;
+
+    tx += m_x;
+    ty += m_y;
+
+    if (shouldPaintBackgroundOrBorder() && i.phase != PaintPhaseOutline && i.phase != PaintPhaseSelfOutline) 
+        paintBoxDecorations(i, tx, ty);
+
+    if (!m_view || i.phase != PaintPhaseForeground || style()->visibility() != VISIBLE)
+        return;
+
+    if (m_widget) {
+        // Move the widget if necessary.  We normally move and resize widgets during layout, but sometimes
+        // widgets can move without layout occurring (most notably when you scroll a document that
+        // contains fixed positioned elements).
+        m_widget->move(tx + borderLeft() + paddingLeft(), ty + borderTop() + paddingTop());
+
+        // Tell the widget to paint now.  This is the only time the widget is allowed
+        // to paint itself.  That way it will composite properly with z-indexed layers.
+        m_widget->paint(i.p, i.r);
+    }
+
+    // Paint a partially transparent wash over selected widgets.
+    if (isSelected() && !document()->printing())
+        i.p->fillRect(selectionRect(), selectionColor(i.p));
+}
+
+void RenderWidget::focusIn(Widget*)
+{
+    RenderArena* arena = ref();
+    RefPtr<Node> elem = element();
+    if (elem)
+        elem->document()->setFocusNode(elem);
+    deref(arena);
+}
+
+void RenderWidget::focusOut(Widget*)
+{
+    RenderArena* arena = ref();
+    RefPtr<Node> elem = element();
+    if (elem && elem == elem->document()->focusNode())
+        elem->document()->setFocusNode(0);
+    deref(arena);
+}
+
+void RenderWidget::scrollToVisible(Widget* widget)
+{
+    if (RenderLayer* layer = enclosingLayer())
+        layer->scrollRectToVisible(absoluteBoundingBoxRect());
+}
+
+bool RenderWidget::isVisible(Widget* widget)
+{
+    return style()->visibility() == VISIBLE;
+}
+
+Element* RenderWidget::element(Widget* widget)
+{
+    Node* n = node();
+    return n->isElementNode() ? static_cast<Element*>(n) : 0;
+}
+
+void RenderWidget::deref(RenderArena *arena)
+{
+    if (--m_refCount <= 0)
+        arenaDelete(arena, this);
+}
+
+void RenderWidget::updateWidgetPosition()
+{
+    if (!m_widget)
+        return;
+    
+    int x, y, width, height;
+    absolutePosition(x, y);
+    x += borderLeft() + paddingLeft();
+    y += borderTop() + paddingTop();
+    width = m_width - borderLeft() - borderRight() - paddingLeft() - paddingRight();
+    height = m_height - borderTop() - borderBottom() - paddingTop() - paddingBottom();
+    IntRect newBounds(x,y,width,height);
+    IntRect oldBounds(m_widget->frameGeometry());
+    if (newBounds != oldBounds) {
+        // The widget changed positions.  Update the frame geometry.
+        if (checkForRepaintDuringLayout()) {
+            RenderCanvas* c = canvas();
+            if (!c->printingMode()) {
+                c->repaintViewRectangle(oldBounds);
+                c->repaintViewRectangle(newBounds);
+            }
+        }
+
+        RenderArena *arena = ref();
+        element()->ref();
+        m_widget->setFrameGeometry(newBounds);
+        element()->deref();
+        deref(arena);
+    }
+}
+
+void RenderWidget::setSelectionState(SelectionState s) 
+{
+    if (selectionState() != s) {
+        RenderReplaced::setSelectionState(s);
+        m_selectionState = s;
+        if (m_widget)
+            m_widget->setIsSelected(isSelected());
+    }
+}
+
+void RenderWidget::deleteWidget()
+{
+    delete m_widget;
+}
+}
diff --git a/WebCore/rendering/RenderWidget.h b/WebCore/rendering/RenderWidget.h
new file mode 100644
index 0000000..d2d9606
--- /dev/null
+++ b/WebCore/rendering/RenderWidget.h
@@ -0,0 +1,81 @@
+/*
+ * This file is part of the HTML widget for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef RenderWidget_H
+#define RenderWidget_H
+
+#include "RenderReplaced.h"
+
+namespace WebCore {
+
+class RenderWidget : public RenderReplaced, public WidgetClient
+{
+public:
+    RenderWidget(Node*);
+    virtual ~RenderWidget();
+
+    virtual void setStyle(RenderStyle*);
+
+    virtual void paint(PaintInfo&, int tx, int ty);
+
+    virtual bool isWidget() const { return true; };
+
+    virtual void destroy();
+    virtual void layout( );
+
+    Widget* widget() const { return m_widget; }
+    FrameView* view() const { return m_view; }
+
+    RenderArena* ref() { ++m_refCount; return renderArena(); }
+    void deref(RenderArena*);
+    
+    virtual void setSelectionState(SelectionState);
+
+    virtual void updateWidgetPosition();
+
+    virtual void setWidget(Widget*);
+
+    using RenderReplaced::element;
+
+private:
+    virtual void focusIn(Widget*);
+    virtual void focusOut(Widget*);
+    virtual void scrollToVisible(Widget*);
+    virtual Element* element(Widget*);
+    virtual bool isVisible(Widget*);
+    virtual void sendConsumedMouseUp(Widget*);
+
+    void resizeWidget(Widget*, int w, int h);
+
+    virtual void deleteWidget();
+
+protected:
+    Widget* m_widget;
+    FrameView* m_view;
+private:
+    int m_refCount;
+};
+
+}
+
+#endif
diff --git a/WebCore/rendering/render_form.h b/WebCore/rendering/render_form.h
index 27643ce..8acf4b3 100644
--- a/WebCore/rendering/render_form.h
+++ b/WebCore/rendering/render_form.h
@@ -26,6 +26,7 @@
 #ifndef RENDER_FORM_H
 #define RENDER_FORM_H
 
+#include "RenderWidget.h"
 #include "GraphicsTypes.h"
 #include "RenderBlock.h"
 #include "RenderImage.h"
diff --git a/WebCore/rendering/render_frames.cpp b/WebCore/rendering/render_frames.cpp
deleted file mode 100644
index 0557d13..0000000
--- a/WebCore/rendering/render_frames.cpp
+++ /dev/null
@@ -1,939 +0,0 @@
-/**
- * This file is part of the KDE project.
- *
- * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
- *           (C) 2000 Simon Hausmann <hausmann@kde.org>
- *           (C) 2000 Stefan Schimanski (1Stein@gmx.de)
- * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- */
-
-#include "config.h"
-#include "render_frames.h"
-
-#include "Cursor.h"
-#include "Document.h"
-#include "EventNames.h"
-#include "Frame.h"
-#include "FrameTree.h"
-#include "FrameView.h"
-#include "GraphicsContext.h"
-#include "Page.h"
-#include "Text.h"
-#include "dom2_eventsimpl.h"
-#include "html_baseimpl.h"
-#include "HTMLEmbedElement.h"
-#include "HTMLNames.h"
-#include "HTMLObjectElement.h"
-#include "HTMLParamElement.h"
-#include "HTMLTokenizer.h"
-#include "RenderArena.h"
-#include "RenderCanvas.h"
-#include "KWQTextStream.h"
-
-namespace WebCore {
-
-using namespace EventNames;
-using namespace HTMLNames;
-
-RenderFrameSet::RenderFrameSet( HTMLFrameSetElement *frameSet)
-    : RenderContainer(frameSet)
-{
-  // init RenderObject attributes
-    setInline(false);
-
-  for (int k = 0; k < 2; ++k) {
-      m_gridLen[k] = -1;
-      m_gridDelta[k] = 0;
-      m_gridLayout[k] = 0;
-  }
-
-  m_resizing = m_clientResizing = false;
-
-  m_hSplit = -1;
-  m_vSplit = -1;
-
-  m_hSplitVar = 0;
-  m_vSplitVar = 0;
-}
-
-RenderFrameSet::~RenderFrameSet()
-{
-    for (int k = 0; k < 2; ++k) {
-        if (m_gridLayout[k]) delete [] m_gridLayout[k];
-        if (m_gridDelta[k]) delete [] m_gridDelta[k];
-    }
-  if (m_hSplitVar)
-      delete [] m_hSplitVar;
-  if (m_vSplitVar)
-      delete [] m_vSplitVar;
-}
-
-bool RenderFrameSet::nodeAtPoint(NodeInfo& info, int _x, int _y, int _tx, int _ty,
-                                 HitTestAction hitTestAction)
-{
-    if (hitTestAction != HitTestForeground)
-        return false;
-
-    bool inside = RenderContainer::nodeAtPoint(info, _x, _y, _tx, _ty, hitTestAction) || 
-                  m_resizing || canResize(_x, _y);
-    if (inside && element() && !element()->noResize() && !info.readonly() && !info.innerNode()) {
-        info.setInnerNode(element());
-        info.setInnerNonSharedNode(element());
-    }
-
-    return inside || m_clientResizing;
-}
-
-void RenderFrameSet::layout( )
-{
-    KHTMLAssert( needsLayout() );
-    KHTMLAssert( minMaxKnown() );
-
-    if ( !parent()->isFrameSet() ) {
-        FrameView* view = canvas()->view();
-        m_width = view->visibleWidth();
-        m_height = view->visibleHeight();
-    }
-
-    int remainingLen[2];
-    remainingLen[1] = m_width - (element()->totalCols()-1)*element()->border();
-    if(remainingLen[1]<0) remainingLen[1]=0;
-    remainingLen[0] = m_height - (element()->totalRows()-1)*element()->border();
-    if(remainingLen[0]<0) remainingLen[0]=0;
-
-    int availableLen[2];
-    availableLen[0] = remainingLen[0];
-    availableLen[1] = remainingLen[1];
-
-    if (m_gridLen[0] != element()->totalRows() || m_gridLen[1] != element()->totalCols()) {
-        // number of rows or cols changed
-        // need to zero out the deltas
-        m_gridLen[0] = element()->totalRows();
-        m_gridLen[1] = element()->totalCols();
-        for (int k = 0; k < 2; ++k) {
-            if (m_gridDelta[k]) delete [] m_gridDelta[k];
-            m_gridDelta[k] = new int[m_gridLen[k]];
-            if (m_gridLayout[k]) delete [] m_gridLayout[k];
-            m_gridLayout[k] = new int[m_gridLen[k]];
-            for (int i = 0; i < m_gridLen[k]; ++i)
-                m_gridDelta[k][i] = 0;
-        }
-    }
-
-    for (int k = 0; k < 2; ++k) {
-        int totalRelative = 0;
-        int totalFixed = 0;
-        int totalPercent = 0;
-        int countRelative = 0;
-        int countFixed = 0;
-        int countPercent = 0;
-        int gridLen = m_gridLen[k];
-        int* gridDelta = m_gridDelta[k];
-        WebCore::Length* grid =  k ? element()->m_cols : element()->m_rows;
-        int* gridLayout = m_gridLayout[k];
-
-        if (grid) {
-            assert(gridLen);
-            // First we need to investigate how many columns of each type we have and
-            // how much space these columns are going to require.
-            for (int i = 0; i < gridLen; ++i) {
-                // Count the total length of all of the fixed columns/rows -> totalFixed
-                // Count the number of columns/rows which are fixed -> countFixed
-                if (grid[i].isFixed()) {
-                    gridLayout[i] = max(grid[i].value(), 0);
-                    totalFixed += gridLayout[i];
-                    countFixed++;
-                }
-                
-                // Count the total percentage of all of the percentage columns/rows -> totalPercent
-                // Count the number of columns/rows which are percentages -> countPercent
-                if (grid[i].isPercent()) {
-                    gridLayout[i] = max(grid[i].calcValue(availableLen[k]), 0);
-                    totalPercent += gridLayout[i];
-                    countPercent++;
-                }
-
-                // Count the total relative of all the relative columns/rows -> totalRelative
-                // Count the number of columns/rows which are relative -> countRelative
-                if (grid[i].isRelative()) {
-                    totalRelative += max(grid[i].value(), 1);
-                    countRelative++;
-                }            
-            }
-
-            // Fixed columns/rows are our first priority. If there is not enough space to fit all fixed
-            // columns/rows we need to proportionally adjust their size. 
-            if (totalFixed > remainingLen[k]) {
-                int remainingFixed = remainingLen[k];
-
-                for (int i = 0; i < gridLen; ++i) {
-                    if (grid[i].isFixed()) {
-                        gridLayout[i] = (gridLayout[i] * remainingFixed) / totalFixed;
-                        remainingLen[k] -= gridLayout[i];
-                    }
-                }
-            } else {
-                remainingLen[k] -= totalFixed;
-            }
-
-            // Percentage columns/rows are our second priority. Divide the remaining space proportionally 
-            // over all percentage columns/rows. IMPORTANT: the size of each column/row is not relative 
-            // to 100%, but to the total percentage. For example, if there are three columns, each of 75%,
-            // and the available space is 300px, each column will become 100px in width.
-            if (totalPercent > remainingLen[k]) {
-                int remainingPercent = remainingLen[k];
-
-                for (int i = 0; i < gridLen; ++i) {
-                    if (grid[i].isPercent()) {
-                        gridLayout[i] = (gridLayout[i] * remainingPercent) / totalPercent;
-                        remainingLen[k] -= gridLayout[i];
-                    }
-                }
-            } else {
-                remainingLen[k] -= totalPercent;
-            }
-
-            // Relative columns/rows are our last priority. Divide the remaining space proportionally
-            // over all relative columns/rows. IMPORTANT: the relative value of 0* is treated as 1*.
-            if (countRelative) {
-                int lastRelative = 0;
-                int remainingRelative = remainingLen[k];
-
-                for (int i = 0; i < gridLen; ++i) {
-                    if (grid[i].isRelative()) {
-                        gridLayout[i] = (max(grid[i].value(), 1) * remainingRelative) / totalRelative;
-                        remainingLen[k] -= gridLayout[i];
-                        lastRelative = i;
-                    }
-                }
-                
-                // If we could not evently distribute the available space of all of the relative  
-                // columns/rows, the remainder will be added to the last column/row.
-                // For example: if we have a space of 100px and three columns (*,*,*), the remainder will
-                // be 1px and will be added to the last column: 33px, 33px, 34px.
-                if (remainingLen[k]) {
-                    gridLayout[lastRelative] += remainingLen[k];
-                    remainingLen[k] = 0;
-                }
-            }
-
-            // If we still have some left over space we need to divide it over the already existing
-            // columns/rows
-            if (remainingLen[k]) {
-                // Our first priority is to spread if over the percentage columns. The remaining
-                // space is spread evenly, for example: if we have a space of 100px, the columns 
-                // definition of 25%,25% used to result in two columns of 25px. After this the 
-                // columns will each be 50px in width. 
-                if (countPercent && totalPercent) {
-                    int remainingPercent = remainingLen[k];
-                    int changePercent = 0;
-
-                    for (int i = 0; i < gridLen; ++i) {
-                        if (grid[i].isPercent()) {
-                            changePercent = (remainingPercent * gridLayout[i]) / totalPercent;
-                            gridLayout[i] += changePercent;
-                            remainingLen[k] -= changePercent;
-                        }
-                    }
-                } else if (totalFixed) {
-                    // Our last priority is to spread the remaining space over the fixed columns.
-                    // For example if we have 100px of space and two column of each 40px, both
-                    // columns will become exactly 50px.
-                    int remainingFixed = remainingLen[k];
-                    int changeFixed = 0;
-
-                    for (int i = 0; i < gridLen; ++i) {
-                        if (grid[i].isFixed()) {
-                            changeFixed = (remainingFixed * gridLayout[i]) / totalFixed;
-                            gridLayout[i] += changeFixed;
-                            remainingLen[k] -= changeFixed;
-                        } 
-                    }
-                }
-            }
-            
-            // If we still have some left over space we probably ended up with a remainder of
-            // a division. We can not spread it evenly anymore. If we have any percentage 
-            // columns/rows simply spread the remainder equally over all available percentage columns, 
-            // regardless of their size.
-            if (remainingLen[k] && countPercent) {
-                int remainingPercent = remainingLen[k];
-                int changePercent = 0;
-
-                for (int i = 0; i < gridLen; ++i) {
-                    if (grid[i].isPercent()) {
-                        changePercent = remainingPercent / countPercent;
-                        gridLayout[i] += changePercent;
-                        remainingLen[k] -= changePercent;
-                    }
-                }
-            } 
-            
-            // If we don't have any percentage columns/rows we only have fixed columns. Spread
-            // the remainder equally over all fixed columns/rows.
-            else if (remainingLen[k] && countFixed) {
-                int remainingFixed = remainingLen[k];
-                int changeFixed = 0;
-                
-                for (int i = 0; i < gridLen; ++i) {
-                    if (grid[i].isFixed()) {
-                        changeFixed = remainingFixed / countFixed;
-                        gridLayout[i] += changeFixed;
-                        remainingLen[k] -= changeFixed;
-                    }
-                }
-            }
-
-            // Still some left over... simply add it to the last column, because it is impossible
-            // spread it evenly or equally.
-            if (remainingLen[k]) {
-                gridLayout[gridLen - 1] += remainingLen[k];
-            }
-
-            // now we have the final layout, distribute the delta over it
-            bool worked = true;
-            for (int i = 0; i < gridLen; ++i) {
-                if (gridLayout[i] && gridLayout[i] + gridDelta[i] <= 0)
-                    worked = false;
-                gridLayout[i] += gridDelta[i];
-            }
-            // now the delta's broke something, undo it and reset deltas
-            if (!worked)
-                for (int i = 0; i < gridLen; ++i) {
-                    gridLayout[i] -= gridDelta[i];
-                    gridDelta[i] = 0;
-                }
-        }
-        else
-            gridLayout[0] = remainingLen[k];
-    }
-
-    positionFrames();
-
-    RenderObject *child = firstChild();
-    if ( !child )
-        goto end2;
-
-    if(!m_hSplitVar && !m_vSplitVar)
-    {
-        if(!m_vSplitVar && element()->totalCols() > 1)
-        {
-            m_vSplitVar = new bool[element()->totalCols()];
-            for(int i = 0; i < element()->totalCols(); i++) m_vSplitVar[i] = true;
-        }
-        if(!m_hSplitVar && element()->totalRows() > 1)
-        {
-            m_hSplitVar = new bool[element()->totalRows()];
-            for(int i = 0; i < element()->totalRows(); i++) m_hSplitVar[i] = true;
-        }
-
-        for(int r = 0; r < element()->totalRows(); r++)
-        {
-            for(int c = 0; c < element()->totalCols(); c++)
-            {
-                bool fixed = false;
-
-                if ( child->isFrameSet() )
-                  fixed = static_cast<RenderFrameSet *>(child)->element()->noResize();
-                else
-                  fixed = static_cast<RenderFrame *>(child)->element()->noResize();
-
-                if(fixed)
-                {
-                    if( element()->totalCols() > 1)
-                    {
-                        if(c>0) m_vSplitVar[c-1] = false;
-                        m_vSplitVar[c] = false;
-                    }
-                    if( element()->totalRows() > 1)
-                    {
-                        if(r>0) m_hSplitVar[r-1] = false;
-                        m_hSplitVar[r] = false;
-                    }
-                    child = child->nextSibling();
-                    if(!child)
-                        goto end1;
-                }
-            }
-        }
-
-    }
- end1:
-    RenderContainer::layout();
- end2:
-    setNeedsLayout(false);
-}
-
-void RenderFrameSet::positionFrames()
-{
-  int r;
-  int c;
-
-  RenderObject *child = firstChild();
-  if ( !child )
-    return;
-
-  //  Node *child = _first;
-  //  if(!child) return;
-
-  int yPos = 0;
-
-  for(r = 0; r < element()->totalRows(); r++)
-  {
-    int xPos = 0;
-    for(c = 0; c < element()->totalCols(); c++)
-    {
-      child->setPos( xPos, yPos );
-      // has to be resized and itself resize its contents
-      if ((m_gridLayout[1][c] != child->width()) || (m_gridLayout[0][r] != child->height())) {
-          child->setWidth( m_gridLayout[1][c] );
-          child->setHeight( m_gridLayout[0][r] );
-          child->setNeedsLayout(true);
-          child->layout();
-      }
-
-      xPos += m_gridLayout[1][c] + element()->border();
-      child = child->nextSibling();
-
-      if ( !child )
-        return;
-
-    }
-
-    yPos += m_gridLayout[0][r] + element()->border();
-  }
-
-  // all the remaining frames are hidden to avoid ugly
-  // spurious unflowed frames
-  while ( child ) {
-      child->setWidth( 0 );
-      child->setHeight( 0 );
-      child->setNeedsLayout(false);
-
-      child = child->nextSibling();
-  }
-}
-
-bool RenderFrameSet::userResize( MouseEvent *evt )
-{
-    if (needsLayout()) return false;
-    
-    bool res = false;
-    int _x = evt->clientX();
-    int _y = evt->clientY();
-    
-    if ( !m_resizing && evt->type() == mousemoveEvent || evt->type() == mousedownEvent )
-    {
-        m_hSplit = -1;
-        m_vSplit = -1;
-        //bool resizePossible = true;
-        
-        // check if we're over a horizontal or vertical boundary
-        int pos = m_gridLayout[1][0] + xPos();
-        for (int c = 1; c < element()->totalCols(); c++) {
-            if (_x >= pos && _x <= pos+element()->border()) {
-                if (m_vSplitVar && m_vSplitVar[c - 1])
-                    m_vSplit = c - 1;
-                res = true;
-                break;
-            }
-            pos += m_gridLayout[1][c] + element()->border();
-        }
-        
-        pos = m_gridLayout[0][0] + yPos();
-        for (int r = 1; r < element()->totalRows(); r++) {
-            if ( _y >= pos && _y <= pos+element()->border()) {
-                if (m_hSplitVar && m_hSplitVar[r - 1])
-                    m_hSplit = r - 1;
-                res = true;
-                break;
-            }
-            pos += m_gridLayout[0][r] + element()->border();
-        }
-        
-        if (evt->type() == mousedownEvent) {
-            setResizing(true);
-            m_vSplitPos = _x;
-            m_hSplitPos = _y;
-            m_oldpos = -1;
-        } else
-            canvas()->view()->setCursor(pointerCursor());
-    }
-    
-    // ### check the resize is not going out of bounds.
-    if (m_resizing && evt->type() == mouseupEvent) {
-        setResizing(false);
-        
-        if(m_vSplit != -1 )
-        {
-            int delta = m_vSplitPos - _x;
-            m_gridDelta[1][m_vSplit] -= delta;
-            m_gridDelta[1][m_vSplit+1] += delta;
-        }
-        if(m_hSplit != -1 )
-        {
-            int delta = m_hSplitPos - _y;
-            m_gridDelta[0][m_hSplit] -= delta;
-            m_gridDelta[0][m_hSplit+1] += delta;
-        }
-        
-        // this just schedules the relayout
-        // important, otherwise the moving indicator is not correctly erased
-        setNeedsLayout(true);
-    }
-    
-    else if (m_resizing || evt->type() == mouseupEvent) {
-        FrameView *v = canvas()->view();        
-        v->disableFlushDrawing();
-        GraphicsContext* context = v->lockDrawingFocus();
-        
-        IntRect r(xPos(), yPos(), width(), height());
-        const int rBord = 3;
-        int sw = element()->border();
-        int p = m_resizing ? (m_vSplit > -1 ? _x : _y) : -1;
-        const RGBA32 greyQuarterOpacity = 0x40A0A0A0;
-        if (m_vSplit > -1) {
-            if (m_oldpos >= 0)
-                v->updateContents(IntRect(m_oldpos + sw/2 - rBord, r.y(), 2 * rBord, r.height()), true);
-            if (p >= 0) {
-                context->setPen(Pen::NoPen);
-                context->setFillColor(greyQuarterOpacity);
-                context->drawRect(IntRect(p + sw/2 - rBord, r.y(), 2 * rBord, r.height()));
-            }
-        } else {
-            if (m_oldpos >= 0)
-                v->updateContents(IntRect(r.x(), m_oldpos + sw/2 - rBord, r.width(), 2 * rBord), true);
-            if (p >= 0) {
-                context->setPen(Pen::NoPen);
-                context->setFillColor(greyQuarterOpacity);
-                context->drawRect(IntRect(r.x(), p + sw/2 - rBord, r.width(), 2 * rBord));
-            }
-        }
-        m_oldpos = p;
-
-        v->unlockDrawingFocus(context);
-        v->enableFlushDrawing();
-    }
-    
-    return res;
-}
-
-void RenderFrameSet::setResizing(bool e)
-{
-    m_resizing = e;
-    for (RenderObject* p = parent(); p; p = p->parent())
-        if (p->isFrameSet())
-            static_cast<RenderFrameSet*>(p)->m_clientResizing = m_resizing;
-    canvas()->view()->setResizingFrameSet(e ? element() : 0);
-}
-
-bool RenderFrameSet::canResize( int _x, int _y )
-{
-    // if we haven't received a layout, then the gridLayout doesn't contain useful data yet
-    if (needsLayout() || !m_gridLayout[0] || !m_gridLayout[1] ) return false;
-
-    // check if we're over a horizontal or vertical boundary
-    int pos = m_gridLayout[1][0];
-    for(int c = 1; c < element()->totalCols(); c++)
-        if(_x >= pos && _x <= pos+element()->border())
-            return true;
-
-    pos = m_gridLayout[0][0];
-    for(int r = 1; r < element()->totalRows(); r++)
-        if( _y >= pos && _y <= pos+element()->border())
-            return true;
-
-    return false;
-}
-
-#ifndef NDEBUG
-void RenderFrameSet::dump(QTextStream *stream, DeprecatedString ind) const
-{
-  *stream << " totalrows=" << element()->totalRows();
-  *stream << " totalcols=" << element()->totalCols();
-
-  unsigned i;
-  for (i = 0; i < (unsigned)element()->totalRows(); i++)
-    *stream << " hSplitvar(" << i << ")=" << m_hSplitVar[i];
-
-  for (i = 0; i < (unsigned)element()->totalCols(); i++)
-    *stream << " vSplitvar(" << i << ")=" << m_vSplitVar[i];
-
-  RenderContainer::dump(stream,ind);
-}
-#endif
-
-/**************************************************************************************/
-
-RenderPart::RenderPart(HTMLElement* node)
-    : RenderWidget(node), m_frame(0)
-{
-    // init RenderObject attributes
-    setInline(false);
-}
-
-RenderPart::~RenderPart()
-{
-    // Since deref ends up calling setWidget back on us, need to make sure
-    // that widget is already 0 so it won't do any work.
-    Widget* widget = m_widget;
-    m_widget = 0;
-    if (widget && widget->isFrameView())
-        static_cast<FrameView*>(widget)->deref();
-    else
-        delete widget;
-
-    setFrame(0);
-}
-
-void RenderPart::setFrame(Frame* frame)
-{
-    if (frame == m_frame)
-        return;
-    if (m_frame)
-        m_frame->disconnectOwnerRenderer();
-    m_frame = frame;
-}
-
-void RenderPart::setWidget(Widget* widget)
-{
-    if (widget != m_widget) {
-        if (widget && widget->isFrameView())
-            static_cast<FrameView*>(widget)->ref();
-        RenderWidget::setWidget(widget);
-
-        setNeedsLayoutAndMinMaxRecalc();
-
-        // make sure the scrollbars are set correctly for restore
-        // ### find better fix
-        viewCleared();
-    }
-}
-
-void RenderPart::viewCleared()
-{
-}
-
-void RenderPart::deleteWidget()
-{
-    if (m_widget && m_widget->isFrameView())
-        static_cast<FrameView*>(m_widget)->deref();
-    else
-        delete m_widget;
-}
-
-/***************************************************************************************/
-
-RenderFrame::RenderFrame(HTMLFrameElement* frame)
-    : RenderPart(frame)
-{
-    setInline(false);
-}
-
-void RenderFrame::viewCleared()
-{
-    if (element() && m_widget && m_widget->isFrameView()) {
-        FrameView* view = static_cast<FrameView*>(m_widget);
-        HTMLFrameSetElement* frameSet = static_cast<HTMLFrameSetElement *>(element()->parentNode());
-        bool hasBorder = element()->m_frameBorder && frameSet->frameBorder();
-        int marginw = element()->m_marginWidth;
-        int marginh = element()->m_marginHeight;
-
-        view->setHasBorder(hasBorder);
-        if (marginw != -1)
-            view->setMarginWidth(marginw);
-        if (marginh != -1)
-            view->setMarginHeight(marginh);
-    }
-}
-
-/****************************************************************************************/
-
-RenderPartObject::RenderPartObject(HTMLElement* element)
-    : RenderPart(element)
-{
-    // init RenderObject attributes
-    setInline(true);
-    m_hasFallbackContent = false;
-}
-
-static bool isURLAllowed(WebCore::Document *doc, const String &url)
-{
-    KURL newURL(doc->completeURL(url.deprecatedString()));
-    newURL.setRef(DeprecatedString::null);
-    
-    if (doc->frame()->page()->frameCount() >= 200)
-        return false;
-
-    // We allow one level of self-reference because some sites depend on that.
-    // But we don't allow more than one.
-    bool foundSelfReference = false;
-    for (Frame *frame = doc->frame(); frame; frame = frame->tree()->parent()) {
-        KURL frameURL = frame->url();
-        frameURL.setRef(DeprecatedString::null);
-        if (frameURL == newURL) {
-            if (foundSelfReference)
-                return false;
-            foundSelfReference = true;
-        }
-    }
-    return true;
-}
-
-static inline void mapClassIdToServiceType(const String& classId, String& serviceType)
-{
-    // It is ActiveX, but the nsplugin system handling
-    // should also work, that's why we don't override the
-    // serviceType with application/x-activex-handler
-    // but let the KTrader in khtmlpart::createPart() detect
-    // the user's preference: launch with activex viewer or
-    // with nspluginviewer (Niko)
-    if (classId.contains("D27CDB6E-AE6D-11cf-96B8-444553540000"))
-        serviceType = "application/x-shockwave-flash";
-    else if (classId.contains("CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA"))
-        serviceType = "audio/x-pn-realaudio-plugin";
-    else if (classId.contains("02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"))
-        serviceType = "video/quicktime";
-    else if (classId.contains("166B1BCA-3F9C-11CF-8075-444553540000"))
-        serviceType = "application/x-director";
-    else if (classId.contains("6BF52A52-394A-11d3-B153-00C04F79FAA6"))
-        serviceType = "application/x-mplayer2";
-    else if (!classId.isEmpty())
-        // We have a clsid, means this is activex (Niko)
-        serviceType = "application/x-activex-handler";
-    // TODO: add more plugins here
-}
-
-void RenderPartObject::updateWidget()
-{
-  String url;
-  String serviceType;
-  Vector<String> paramNames;
-  Vector<String> paramValues;
-  Frame *frame = m_view->frame();
-
-  setNeedsLayoutAndMinMaxRecalc();
-
-  if (element()->hasTagName(objectTag)) {
-
-      HTMLObjectElement *o = static_cast<HTMLObjectElement *>(element());
-
-      if (!o->isComplete())
-        return;
-      // Check for a child EMBED tag.
-      HTMLEmbedElement* embed = 0;
-      for (Node *child = o->firstChild(); child; ) {
-          if (child->hasTagName(embedTag)) {
-              embed = static_cast<HTMLEmbedElement *>( child );
-              break;
-          } else if (child->hasTagName(objectTag))
-              child = child->nextSibling();         // Don't descend into nested OBJECT tags
-          else
-              child = child->traverseNextNode(o);   // Otherwise descend (EMBEDs may be inside COMMENT tags)
-      }
-      
-      // Use the attributes from the EMBED tag instead of the OBJECT tag including WIDTH and HEIGHT.
-      HTMLElement *embedOrObject;
-      if (embed) {
-          embedOrObject = (HTMLElement *)embed;
-          String attribute = embedOrObject->getAttribute(widthAttr);
-          if (!attribute.isEmpty())
-              o->setAttribute(widthAttr, attribute);
-          attribute = embedOrObject->getAttribute(heightAttr);
-          if (!attribute.isEmpty())
-              o->setAttribute(heightAttr, attribute);
-          url = embed->url;
-          serviceType = embed->serviceType;
-      } else
-          embedOrObject = (HTMLElement *)o;
-      
-      // If there was no URL or type defined in EMBED, try the OBJECT tag.
-      if (url.isEmpty())
-          url = o->url;
-      if (serviceType.isEmpty())
-          serviceType = o->serviceType;
-      
-      HashSet<StringImpl*, CaseInsensitiveHash> uniqueParamNames;
-      
-      // Scan the PARAM children.
-      // Get the URL and type from the params if we don't already have them.
-      // Get the attributes from the params if there is no EMBED tag.
-      Node *child = o->firstChild();
-      while (child && (url.isEmpty() || serviceType.isEmpty() || !embed)) {
-          if (child->hasTagName(paramTag)) {
-              HTMLParamElement* p = static_cast<HTMLParamElement*>(child);
-              String name = p->name().lower();
-              if (url.isEmpty() && (name == "src" || name == "movie" || name == "code" || name == "url"))
-                  url = p->value();
-              if (serviceType.isEmpty() && name == "type") {
-                  serviceType = p->value();
-                  int pos = serviceType.find(";");
-                  if (pos != -1)
-                      serviceType = serviceType.left(pos);
-              }
-              if (!embed && !name.isEmpty()) {
-                  uniqueParamNames.add(p->name().impl());
-                  paramNames.append(p->name());
-                  paramValues.append(p->value());
-              }
-          }
-          child = child->nextSibling();
-      }
-      
-      // When OBJECT is used for an applet via Sun's Java plugin, the CODEBASE attribute in the tag
-      // points to the Java plugin itself (an ActiveX component) while the actual applet CODEBASE is
-      // in a PARAM tag. See <http://java.sun.com/products/plugin/1.2/docs/tags.html>. This means
-      // we have to explicitly suppress the tag's CODEBASE attribute if there is none in a PARAM,
-      // else our Java plugin will misinterpret it. [4004531]
-      String codebase;
-      if (!embed && serviceType.lower() == "application/x-java-applet") {
-          codebase = "codebase";
-          uniqueParamNames.add(codebase.impl()); // pretend we found it in a PARAM already
-      }
-      
-      // Turn the attributes of either the EMBED tag or OBJECT tag into arrays, but don't override PARAM values.
-      NamedAttrMap* attributes = embedOrObject->attributes();
-      if (attributes) {
-          for (unsigned i = 0; i < attributes->length(); ++i) {
-              Attribute* it = attributes->attributeItem(i);
-              const AtomicString& name = it->name().localName();
-              if (embed || !uniqueParamNames.contains(name.impl())) {
-                  paramNames.append(name.domString());
-                  paramValues.append(it->value().domString());
-              }
-          }
-      }
-      
-      // If we still don't have a type, try to map from a specific CLASSID to a type.
-      if (serviceType.isEmpty() && !o->classId.isEmpty())
-          mapClassIdToServiceType(o->classId, serviceType);
-      
-      // If no URL and type, abort.
-      if (url.isEmpty() && serviceType.isEmpty())
-          return;
-      if (!isURLAllowed(document(), url))
-          return;
-
-      // Find out if we support fallback content.
-      m_hasFallbackContent = false;
-      for (Node *child = o->firstChild(); child && !m_hasFallbackContent; child = child->nextSibling()) {
-          if ((!child->isTextNode() && !child->hasTagName(embedTag) && !child->hasTagName(paramTag)) || // Discount <embed> and <param>
-              (child->isTextNode() && !static_cast<Text*>(child)->containsOnlyWhitespace()))
-              m_hasFallbackContent = true;
-      }
-      bool success = frame->requestObject(this, url, AtomicString(o->name()), serviceType, paramNames, paramValues);
-      if (!success && m_hasFallbackContent)
-          o->renderFallbackContent();
-  } else if (element()->hasTagName(embedTag)) {
-      HTMLEmbedElement *o = static_cast<HTMLEmbedElement *>(element());
-      url = o->url;
-      serviceType = o->serviceType;
-
-      if (url.isEmpty() && serviceType.isEmpty())
-          return;
-      if (!isURLAllowed(document(), url))
-          return;
-      
-      // add all attributes set on the embed object
-      NamedAttrMap* a = o->attributes();
-      if (a) {
-          for (unsigned i = 0; i < a->length(); ++i) {
-              Attribute* it = a->attributeItem(i);
-              paramNames.append(it->name().localName().domString());
-              paramValues.append(it->value().domString());
-          }
-      }
-      frame->requestObject(this, url, o->getAttribute(nameAttr), serviceType, paramNames, paramValues);
-  } else {
-      assert(element()->hasTagName(iframeTag));
-      HTMLIFrameElement *o = static_cast<HTMLIFrameElement *>(element());
-      url = o->m_URL;
-      if (!isURLAllowed(document(), url))
-          return;
-      if (url.isEmpty())
-          url = "about:blank";
-      FrameView *v = static_cast<FrameView *>(m_view);
-      v->frame()->requestFrame(this, url, o->m_name);
-  }
-}
-
-void RenderPartObject::layout()
-{
-    KHTMLAssert(needsLayout());
-    KHTMLAssert(minMaxKnown());
-
-    calcWidth();
-    calcHeight();
-
-    RenderPart::layout();
-
-    setNeedsLayout(false);
-}
-
-void RenderPartObject::viewCleared()
-{
-    if (element() && m_widget && m_widget->isFrameView()) {
-        FrameView* view = static_cast<FrameView*>(m_widget);
-        bool hasBorder = false;
-        int marginw = -1;
-        int marginh = -1;
-        if (element()->hasTagName(iframeTag)) {
-            HTMLIFrameElement* frame = static_cast<HTMLIFrameElement *>(element());
-            hasBorder = frame->m_frameBorder;
-            marginw = frame->m_marginWidth;
-            marginh = frame->m_marginHeight;
-        }
-
-        view->setHasBorder(hasBorder);
-        view->setIgnoreWheelEvents(element()->hasTagName(iframeTag));
-        if (marginw != -1)
-            view->setMarginWidth(marginw);
-        if (marginh != -1)
-            view->setMarginHeight(marginh);
-    }
-}
-
-// FIXME: This should not be necessary.  Remove this once WebKit knows to properly schedule
-// layouts using WebCore when objects resize.
-void RenderPart::updateWidgetPosition()
-{
-    if (!m_widget)
-        return;
-    
-    int x, y, width, height;
-    absolutePosition(x, y);
-    x += borderLeft() + paddingLeft();
-    y += borderTop() + paddingTop();
-    width = m_width - borderLeft() - borderRight() - paddingLeft() - paddingRight();
-    height = m_height - borderTop() - borderBottom() - paddingTop() - paddingBottom();
-    IntRect newBounds(x,y,width,height);
-    if (newBounds != m_widget->frameGeometry()) {
-        // The widget changed positions.  Update the frame geometry.
-        RenderArena *arena = ref();
-        element()->ref();
-        m_widget->setFrameGeometry(newBounds);
-        element()->deref();
-        deref(arena);
-        
-        if (m_widget && m_widget->isFrameView())
-            static_cast<FrameView*>(m_widget)->layout();
-    }
-}
-
-}
diff --git a/WebCore/rendering/render_frames.h b/WebCore/rendering/render_frames.h
deleted file mode 100644
index b115bdf..0000000
--- a/WebCore/rendering/render_frames.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * This file is part of the KDE project.
- *
- * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
- *           (C) 2000 Simon Hausmann <hausmann@kde.org>
- * Copyright (C) 2006 Apple Computer, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- */
-
-#ifndef render_frames_h__
-#define render_frames_h__
-
-#include "RenderContainer.h"
-#include "render_replaced.h"
-#include "html_baseimpl.h"
-
-namespace WebCore {
-
-class FrameView;
-class HTMLElement;
-class HTMLFrameElement;
-class MouseEvent;
-
-struct ChildFrame;
-
-class RenderFrameSet : public RenderContainer
-{
-    friend class HTMLFrameSetElement;
-public:
-    RenderFrameSet(HTMLFrameSetElement*);
-    virtual ~RenderFrameSet();
-
-    virtual const char* renderName() const { return "RenderFrameSet"; }
-    virtual bool isFrameSet() const { return true; }
-
-    virtual void layout();
-
-    void positionFrames();
-
-    bool resizing() const { return m_resizing; }
-
-    bool userResize(MouseEvent*);
-    bool canResize(int x, int y);
-    void setResizing(bool);
-
-    virtual bool nodeAtPoint(NodeInfo&, int x, int y, int tx, int ty, HitTestAction);
-
-    HTMLFrameSetElement* element() const
-        { return static_cast<HTMLFrameSetElement*>(RenderContainer::element()); }
-
-#ifndef NDEBUG
-    virtual void dump(QTextStream *stream, DeprecatedString ind = "") const;
-#endif
-
-private:
-    int m_oldpos;
-    int m_gridLen[2];
-    int* m_gridDelta[2];
-    int* m_gridLayout[2];
-
-    bool* m_hSplitVar; // is this split variable?
-    bool* m_vSplitVar;
-
-    int m_hSplit; // the split currently resized
-    int m_vSplit;
-    int m_hSplitPos;
-    int m_vSplitPos;
-
-    bool m_resizing;
-    bool m_clientResizing;
-};
-
-class RenderPart : public RenderWidget {
-public:
-    RenderPart(HTMLElement*);
-    virtual ~RenderPart();
-    
-    virtual const char* renderName() const { return "RenderPart"; }
-
-    void setFrame(Frame*);
-    void setWidget(Widget*);
-
-    // FIXME: This should not be necessary.
-    // Remove this once WebKit knows to properly schedule layouts using WebCore when objects resize.
-    void updateWidgetPosition();
-
-    bool hasFallbackContent() const { return m_hasFallbackContent; }
-
-    virtual void viewCleared();
-
-protected:
-    bool m_hasFallbackContent;
-
-private:
-    virtual void deleteWidget();
-
-    Frame* m_frame;
-};
-
-class RenderFrame : public RenderPart
-{
-public:
-    RenderFrame(HTMLFrameElement*);
-
-    virtual const char* renderName() const { return "RenderFrame"; }
-
-    HTMLFrameElement* element() const
-        { return static_cast<HTMLFrameElement*>(RenderPart::element()); }
-
-    virtual void viewCleared();
-};
-
-// I can hardly call the class RenderObject ;-)
-class RenderPartObject : public RenderPart
-{
-public:
-    RenderPartObject(HTMLElement*);
-
-    virtual const char* renderName() const { return "RenderPartObject"; }
-
-    virtual void layout();
-    virtual void updateWidget();
-
-    virtual void viewCleared();
-};
-
-}
-
-#endif
diff --git a/WebCore/rendering/render_replaced.cpp b/WebCore/rendering/render_replaced.cpp
deleted file mode 100644
index fe1102323..0000000
--- a/WebCore/rendering/render_replaced.cpp
+++ /dev/null
@@ -1,480 +0,0 @@
-/**
- * This file is part of the HTML widget for KDE.
- *
- * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
- * Copyright (C) 2000 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2004, 2006 Apple Computer, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- */
-
-#include "config.h"
-#include "render_replaced.h"
-
-#include "BrowserExtension.h"
-#include "Document.h" // ### remove dependency
-#include "Element.h"
-#include "EventNames.h"
-#include "FrameView.h"
-#include "GraphicsContext.h"
-#include "RenderArena.h"
-#include "RenderCanvas.h"
-#include "dom2_eventsimpl.h"
-
-using namespace std;
-
-namespace WebCore {
-
-using namespace EventNames;
-
-RenderReplaced::RenderReplaced(Node* node)
-    : RenderBox(node)
-{
-    // init RenderObject attributes
-    setReplaced(true);
-
-    m_intrinsicWidth = 300;
-    m_intrinsicHeight = 150;
-    m_selectionState = SelectionNone;
-}
-
-bool RenderReplaced::shouldPaint(PaintInfo& i, int& _tx, int& _ty)
-{
-    if (i.phase != PaintPhaseForeground && i.phase != PaintPhaseOutline && i.phase != PaintPhaseSelfOutline 
-        && i.phase != PaintPhaseSelection)
-        return false;
-
-    if (!shouldPaintWithinRoot(i))
-        return false;
-        
-    // if we're invisible or haven't received a layout yet, then just bail.
-    if (style()->visibility() != VISIBLE || m_y <=  -500000)  return false;
-
-    int tx = _tx + m_x;
-    int ty = _ty + m_y;
-
-    // Early exit if the element touches the edges.
-    int top = ty;
-    int bottom = ty + m_height;
-    if (isSelected() && m_inlineBoxWrapper) {
-        int selTop = _ty + m_inlineBoxWrapper->root()->selectionTop();
-        int selBottom = _ty + selTop + m_inlineBoxWrapper->root()->selectionHeight();
-        top = min(selTop, top);
-        bottom = max(selBottom, bottom);
-    }
-    
-    int os = 2*maximalOutlineSize(i.phase);
-    if (tx >= i.r.right() + os || tx + m_width <= i.r.x() - os)
-        return false;
-    if (top >= i.r.bottom() + os || bottom <= i.r.y() - os)
-        return false;
-
-    return true;
-}
-
-void RenderReplaced::calcMinMaxWidth()
-{
-    KHTMLAssert( !minMaxKnown());
-
-#ifdef DEBUG_LAYOUT
-    kdDebug( 6040 ) << "RenderReplaced::calcMinMaxWidth() known=" << minMaxKnown() << endl;
-#endif
-
-    int width = calcReplacedWidth() + paddingLeft() + paddingRight() + borderLeft() + borderRight();
-    if (style()->width().isPercent() || (style()->width().isAuto() && style()->height().isPercent())) {
-        m_minWidth = 0;
-        m_maxWidth = width;
-    } else
-        m_minWidth = m_maxWidth = width;
-
-    setMinMaxKnown();
-}
-
-short RenderReplaced::lineHeight( bool, bool ) const
-{
-    return height()+marginTop()+marginBottom();
-}
-
-short RenderReplaced::baselinePosition( bool, bool ) const
-{
-    return height()+marginTop()+marginBottom();
-}
-
-int RenderReplaced::caretMinOffset() const 
-{ 
-    return 0; 
-}
-
-// Returns 1 since a replaced element can have the caret positioned 
-// at its beginning (0), or at its end (1).
-// NOTE: Yet, "select" elements can have any number of "option" elements
-// as children, so this "0 or 1" idea does not really hold up.
-int RenderReplaced::caretMaxOffset() const 
-{ 
-    return 1; 
-}
-
-unsigned RenderReplaced::caretMaxRenderedOffset() const
-{
-    return 1; 
-}
-
-VisiblePosition RenderReplaced::positionForCoordinates(int _x, int _y)
-{
-    InlineBox *box = inlineBoxWrapper();
-    if (!box)
-        return VisiblePosition(element(), 0, DOWNSTREAM);
-
-    RootInlineBox *root = box->root();
-
-    int absx, absy;
-    containingBlock()->absolutePosition(absx, absy);
-
-    int top = absy + root->topOverflow();
-    int bottom = root->nextRootBox() ? absy + root->nextRootBox()->topOverflow() : absy + root->bottomOverflow();
-
-    if (_y < top)
-        return VisiblePosition(element(), caretMinOffset(), DOWNSTREAM); // coordinates are above
-    
-    if (_y >= bottom)
-        return VisiblePosition(element(), caretMaxOffset(), DOWNSTREAM); // coordinates are below
-    
-    if (element()) {
-        if (_x <= absx + xPos() + (width() / 2))
-            return VisiblePosition(element(), 0, DOWNSTREAM);
-
-        return VisiblePosition(element(), 1, DOWNSTREAM);
-    }
-
-    return RenderBox::positionForCoordinates(_x, _y);
-}
-
-IntRect RenderReplaced::selectionRect()
-{
-    if (!isSelected())
-        return IntRect();
-    if (!m_inlineBoxWrapper)
-        // We're a block-level replaced element.  Just return our own dimensions.
-        return absoluteBoundingBoxRect();
-
-    RenderBlock* cb =  containingBlock();
-    if (!cb)
-        return IntRect();
-    
-    RootInlineBox* root = m_inlineBoxWrapper->root();
-    int selectionTop = root->selectionTop();
-    int selectionHeight = root->selectionHeight();
-    int selectionLeft = xPos();
-    int selectionRight = xPos() + width();
-    
-    int absx, absy;
-    cb->absolutePosition(absx, absy);
-    if (cb->hasOverflowClip())
-        cb->layer()->subtractScrollOffset(absx, absy);
-
-    return IntRect(selectionLeft + absx, selectionTop + absy, selectionRight - selectionLeft, selectionHeight);
-}
-
-void RenderReplaced::setSelectionState(SelectionState s)
-{
-    m_selectionState = s;
-    if (m_inlineBoxWrapper) {
-        RootInlineBox* line = m_inlineBoxWrapper->root();
-        if (line)
-            line->setHasSelectedChildren(isSelected());
-    }
-    
-    containingBlock()->setSelectionState(s);
-}
-
-bool RenderReplaced::isSelected()
-{
-    SelectionState s = selectionState();
-    if (s == SelectionNone)
-        return false;
-    if (s == SelectionInside)
-        return true;
-
-    int selectionStart, selectionEnd;
-    RenderObject::selectionStartEnd(selectionStart, selectionEnd);
-    if (s == SelectionStart)
-        return selectionStart == 0;
-        
-    int end = element()->hasChildNodes() ? element()->childNodeCount() : 1;
-    if (s == SelectionEnd)
-        return selectionEnd == end;
-    if (s == SelectionBoth)
-        return selectionStart == 0 && selectionEnd == end;
-        
-    ASSERT(0);
-    return false;
-}
-
-Color RenderReplaced::selectionColor(GraphicsContext* p) const
-{
-    Color color = RenderBox::selectionColor(p);
-         
-    // Limit the opacity so that no user-specified selection color can obscure selected images.
-    if (color.alpha() > selectionColorImageOverlayAlpha)
-        color = Color(color.red(), color.green(), color.blue(), selectionColorImageOverlayAlpha);
-
-    return color;
-}
-
-// -----------------------------------------------------------------------------
-
-RenderWidget::RenderWidget(Node* node)
-      : RenderReplaced(node)
-      , m_widget(0)
-      , m_refCount(0)
-{
-    // a replaced element doesn't support being anonymous
-    ASSERT(node);
-    m_view = node->document()->view();
-
-    canvas()->addWidget(this);
-
-    // this is no real reference counting, its just there
-    // to make sure that we're not deleted while we're recursed
-    // in an eventFilter of the widget
-    ref();
-}
-
-void RenderWidget::destroy()
-{
-    // We can't call the base class's destroy because we don't
-    // want to unconditionally delete ourselves (we're ref-counted).
-    // So the code below includes copied and pasted contents of
-    // both RenderBox::destroy() and RenderObject::destroy().
-    // Fix originally made for <rdar://problem/4228818>.
-
-    if (RenderCanvas *c = canvas())
-        c->removeWidget(this);
-
-    remove();
-
-    if (m_widget) {
-        if (m_view)
-            m_view->removeChild(m_widget);
-        m_widget->setClient(0);
-    }
-
-    RenderLayer* layer = m_layer;
-    RenderArena* arena = renderArena();
-    
-    if (layer)
-        layer->clearClipRect();
-    
-    setNode(0);
-    deref(arena);
-    
-    if (layer)
-        layer->destroy(arena);
-}
-
-RenderWidget::~RenderWidget()
-{
-    KHTMLAssert(m_refCount <= 0);
-    deleteWidget();
-}
-
-void RenderWidget::resizeWidget(Widget* widget, int w, int h)
-{
-    if (element() && (widget->width() != w || widget->height() != h)) {
-        RenderArena *arena = ref();
-        element()->ref();
-        widget->resize(w, h);
-        element()->deref();
-        deref(arena);
-    }
-}
-
-void RenderWidget::setWidget(Widget* widget)
-{
-    if (widget != m_widget) {
-        if (m_widget) {
-            m_widget->setClient(0);
-            deleteWidget();
-        }
-        m_widget = widget;
-        if (m_widget) {
-            m_widget->setClient(this);
-            // if we've already received a layout, apply the calculated space to the
-            // widget immediately, but we have to have really been full constructed (with a non-null
-            // style pointer).
-            if (!needsLayout() && style())
-                resizeWidget(m_widget,
-                    m_width - borderLeft() - borderRight() - paddingLeft() - paddingRight(),
-                    m_height - borderTop() - borderBottom() - paddingTop() - paddingBottom());
-            else
-                setPos(xPos(), -500000);
-            if (style()) {
-                if (style()->visibility() != VISIBLE)
-                    m_widget->hide();
-                else
-                    m_widget->show();
-            }
-            m_view->addChild(m_widget, -500000, 0);
-        }
-    }
-}
-
-void RenderWidget::layout()
-{
-    KHTMLAssert(needsLayout());
-    KHTMLAssert(minMaxKnown());
-
-    setNeedsLayout(false);
-}
-
-void RenderWidget::sendConsumedMouseUp(Widget*)
-{
-    RenderArena* arena = ref();
-    EventTargetNodeCast(node())->dispatchSimulatedMouseEvent(mouseupEvent);
-    deref(arena);
-}
-
-void RenderWidget::setStyle(RenderStyle *_style)
-{
-    RenderReplaced::setStyle(_style);
-    if (m_widget) {
-        m_widget->setFont(style()->font());
-        if (style()->visibility() != VISIBLE)
-            m_widget->hide();
-        else
-            m_widget->show();
-    }
-}
-
-void RenderWidget::paint(PaintInfo& i, int tx, int ty)
-{
-    if (!shouldPaint(i, tx, ty))
-        return;
-
-    tx += m_x;
-    ty += m_y;
-
-    if (shouldPaintBackgroundOrBorder() && i.phase != PaintPhaseOutline && i.phase != PaintPhaseSelfOutline) 
-        paintBoxDecorations(i, tx, ty);
-
-    if (!m_view || i.phase != PaintPhaseForeground || style()->visibility() != VISIBLE)
-        return;
-
-    if (m_widget) {
-        // Move the widget if necessary.  We normally move and resize widgets during layout, but sometimes
-        // widgets can move without layout occurring (most notably when you scroll a document that
-        // contains fixed positioned elements).
-        m_widget->move(tx + borderLeft() + paddingLeft(), ty + borderTop() + paddingTop());
-
-        // Tell the widget to paint now.  This is the only time the widget is allowed
-        // to paint itself.  That way it will composite properly with z-indexed layers.
-        m_widget->paint(i.p, i.r);
-    }
-
-    // Paint a partially transparent wash over selected widgets.
-    if (isSelected() && !document()->printing())
-        i.p->fillRect(selectionRect(), selectionColor(i.p));
-}
-
-void RenderWidget::focusIn(Widget*)
-{
-    RenderArena* arena = ref();
-    RefPtr<Node> elem = element();
-    if (elem)
-        elem->document()->setFocusNode(elem);
-    deref(arena);
-}
-
-void RenderWidget::focusOut(Widget*)
-{
-    RenderArena* arena = ref();
-    RefPtr<Node> elem = element();
-    if (elem && elem == elem->document()->focusNode())
-        elem->document()->setFocusNode(0);
-    deref(arena);
-}
-
-void RenderWidget::scrollToVisible(Widget* widget)
-{
-    if (RenderLayer* layer = enclosingLayer())
-        layer->scrollRectToVisible(absoluteBoundingBoxRect());
-}
-
-bool RenderWidget::isVisible(Widget* widget)
-{
-    return style()->visibility() == VISIBLE;
-}
-
-Element* RenderWidget::element(Widget* widget)
-{
-    Node* n = node();
-    return n->isElementNode() ? static_cast<Element*>(n) : 0;
-}
-
-void RenderWidget::deref(RenderArena *arena)
-{
-    if (--m_refCount <= 0)
-        arenaDelete(arena, this);
-}
-
-void RenderWidget::updateWidgetPosition()
-{
-    if (!m_widget)
-        return;
-    
-    int x, y, width, height;
-    absolutePosition(x, y);
-    x += borderLeft() + paddingLeft();
-    y += borderTop() + paddingTop();
-    width = m_width - borderLeft() - borderRight() - paddingLeft() - paddingRight();
-    height = m_height - borderTop() - borderBottom() - paddingTop() - paddingBottom();
-    IntRect newBounds(x,y,width,height);
-    IntRect oldBounds(m_widget->frameGeometry());
-    if (newBounds != oldBounds) {
-        // The widget changed positions.  Update the frame geometry.
-        if (checkForRepaintDuringLayout()) {
-            RenderCanvas* c = canvas();
-            if (!c->printingMode()) {
-                c->repaintViewRectangle(oldBounds);
-                c->repaintViewRectangle(newBounds);
-            }
-        }
-
-        RenderArena *arena = ref();
-        element()->ref();
-        m_widget->setFrameGeometry(newBounds);
-        element()->deref();
-        deref(arena);
-    }
-}
-
-void RenderWidget::setSelectionState(SelectionState s) 
-{
-    if (selectionState() != s) {
-        RenderReplaced::setSelectionState(s);
-        m_selectionState = s;
-        if (m_widget)
-            m_widget->setIsSelected(isSelected());
-    }
-}
-
-void RenderWidget::deleteWidget()
-{
-    delete m_widget;
-}
-
-}