Index: WebCore/khtml/khtml_part.cpp
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/khtml/khtml_part.cpp,v
retrieving revision 1.311
diff -u -p -r1.311 WebCore/khtml/khtml_part.cpp
--- WebCore/khtml/khtml_part.cpp 2005/03/23 02:42:58 1.311
+++ WebCore/khtml/khtml_part.cpp 2005/04/28 01:52:10
@@ -52,6 +52,7 @@
#include "html/html_baseimpl.h"
#include "html/html_miscimpl.h"
#include "html/html_imageimpl.h"
+#include "html/html_objectimpl.h"
#include "rendering/render_block.h"
#include "rendering/render_text.h"
#include "rendering/render_frames.h"
@@ -3143,6 +3144,7 @@ bool KHTMLPart::requestObject( khtml::Re
(*it).m_type = khtml::ChildFrame::Object;
(*it).m_paramNames = paramNames;
(*it).m_paramValues = paramValues;
+ (*it).m_hasFallbackContent = frame->hasFallbackContent();
KURL completedURL;
if (!url.isEmpty())
@@ -5883,6 +5885,21 @@ void KHTMLPart::selectFrameElementInPare
// Focus on the parent frame, and then select from before this element to after.
parentView->setFocus();
parent->setSelection(Selection(beforeOwnerElement, afterOwnerElement));
+}
+
+void KHTMLPart::handleFallbackContent()
+{
+ KHTMLPart *parent = parentPart();
+ if (!parent)
+ return;
+ ChildFrame *childFrame = parent->childFrame(this);
+ if (!childFrame || childFrame->m_type != ChildFrame::Object)
+ return;
+ khtml::RenderPart *renderPart = childFrame->m_frame;
+ if (!renderPart)
+ return;
+ HTMLObjectElementImpl* elt = static_cast(renderPart->element());
+ elt->renderFallbackContent();
}
using namespace KParts;
Index: WebCore/khtml/khtml_part.h
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/khtml/khtml_part.h,v
retrieving revision 1.127
diff -u -p -r1.127 WebCore/khtml/khtml_part.h
--- WebCore/khtml/khtml_part.h 2005/03/20 21:18:26 1.127
+++ WebCore/khtml/khtml_part.h 2005/04/28 01:52:10
@@ -1295,6 +1295,8 @@ public:
// Call this after doing user-triggered selections to make it easy to delete the frame you entirely selected.
void selectFrameElementInParentIfFullySelected();
+ void handleFallbackContent();
+
private:
khtml::ChildFrame *childFrame( const QObject *obj );
Index: WebCore/khtml/khtmlpart_p.h
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/khtml/khtmlpart_p.h,v
retrieving revision 1.52
diff -u -p -r1.52 WebCore/khtml/khtmlpart_p.h
--- WebCore/khtml/khtmlpart_p.h 2005/03/10 01:00:26 1.52
+++ WebCore/khtml/khtmlpart_p.h 2005/04/28 01:52:10
@@ -61,7 +61,7 @@ namespace khtml
{
enum Type { Frame, IFrame, Object };
- ChildFrame() { m_bCompleted = false; m_bPreloaded = false; m_type = Frame; m_bNotify = false; }
+ ChildFrame() { m_bCompleted = false; m_bPreloaded = false; m_type = Frame; m_bNotify = false; m_hasFallbackContent = false; }
#if !APPLE_CHANGES
~ChildFrame() { if (m_run) m_run->abort(); }
@@ -85,6 +85,7 @@ namespace khtml
QStringList m_paramNames;
QStringList m_paramValues;
bool m_bNotify;
+ bool m_hasFallbackContent;
};
}
Index: WebCore/khtml/css/html4.css
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/khtml/css/html4.css,v
retrieving revision 1.68
diff -u -p -r1.68 WebCore/khtml/css/html4.css
--- WebCore/khtml/css/html4.css 2004/11/01 19:21:24 1.68
+++ WebCore/khtml/css/html4.css 2005/04/28 01:52:10
@@ -87,11 +87,6 @@ q:after {
/* FIXME: content: close-quote; */
}
-iframe, embed, object {
- width: 300px;
- height: 150px
-}
-
center {
display: block;
/* special centering to be able to emulate the html4/netscape behaviour */
Index: WebCore/khtml/html/html_objectimpl.cpp
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/khtml/html/html_objectimpl.cpp,v
retrieving revision 1.60
diff -u -p -r1.60 WebCore/khtml/html/html_objectimpl.cpp
--- WebCore/khtml/html/html_objectimpl.cpp 2005/03/10 21:09:24 1.60
+++ WebCore/khtml/html/html_objectimpl.cpp 2005/04/28 01:52:10
@@ -388,6 +388,7 @@ HTMLObjectElementImpl::HTMLObjectElement
#endif
{
needWidgetUpdate = false;
+ m_useFallbackContent = false;
}
HTMLObjectElementImpl::~HTMLObjectElementImpl()
@@ -458,7 +459,7 @@ void HTMLObjectElementImpl::parseHTMLAtt
serviceType = serviceType.left( pos );
if (m_render)
needWidgetUpdate = true;
- if (!canRenderImageType(serviceType) && m_imageLoader) {
+ if (!isImageType() && m_imageLoader) {
delete m_imageLoader;
m_imageLoader = 0;
}
@@ -467,7 +468,7 @@ void HTMLObjectElementImpl::parseHTMLAtt
url = khtml::parseURL( val ).string();
if (m_render)
needWidgetUpdate = true;
- if (m_render && canRenderImageType(serviceType)) {
+ if (m_render && isImageType()) {
if (!m_imageLoader)
m_imageLoader = new HTMLImageLoader(this);
m_imageLoader->updateFromElement();
@@ -505,9 +506,8 @@ DocumentImpl* HTMLObjectElementImpl::con
bool HTMLObjectElementImpl::rendererIsNeeded(RenderStyle *style)
{
- if (canRenderImageType(serviceType)) {
+ if (m_useFallbackContent || isImageType())
return HTMLElementImpl::rendererIsNeeded(style);
- }
KHTMLPart* part = getDocument()->part();
if (!part || !part->pluginsEnabled()) {
@@ -528,9 +528,10 @@ bool HTMLObjectElementImpl::rendererIsNe
RenderObject *HTMLObjectElementImpl::createRenderer(RenderArena *arena, RenderStyle *style)
{
- if (canRenderImageType(serviceType)) {
+ if (m_useFallbackContent)
+ return RenderObject::createObject(this, style);
+ if (isImageType())
return new (arena) RenderImage(this);
- }
return new (arena) RenderPartObject(this);
}
@@ -538,8 +539,8 @@ void HTMLObjectElementImpl::attach()
{
HTMLElementImpl::attach();
- if (m_render) {
- if (canRenderImageType(serviceType)) {
+ if (m_render && !m_useFallbackContent) {
+ if (isImageType()) {
if (!m_imageLoader)
m_imageLoader = new HTMLImageLoader(this);
m_imageLoader->updateFromElement();
@@ -565,7 +566,7 @@ void HTMLObjectElementImpl::attach()
void HTMLObjectElementImpl::detach()
{
// Only bother with an unload event if we had a render object. - dwh
- if (attached() && m_render)
+ if (attached() && m_render && !m_useFallbackContent)
// ### do this when we are actualy removed from document instead
dispatchHTMLEvent(EventImpl::UNLOAD_EVENT,false,false);
@@ -574,7 +575,7 @@ void HTMLObjectElementImpl::detach()
void HTMLObjectElementImpl::recalcStyle(StyleChange ch)
{
- if (needWidgetUpdate && m_render && !canRenderImageType(serviceType)) {
+ if (!m_useFallbackContent && needWidgetUpdate && m_render && !isImageType()) {
// Set needWidgetUpdate to false before calling updateWidget because updateWidget may cause
// this method or attach (which also calls updateWidget) to be called.
needWidgetUpdate = false;
@@ -586,7 +587,7 @@ void HTMLObjectElementImpl::recalcStyle(
void HTMLObjectElementImpl::childrenChanged()
{
- if (inDocument()) {
+ if (inDocument() && !m_useFallbackContent) {
needWidgetUpdate = true;
setChanged();
}
@@ -595,6 +596,39 @@ void HTMLObjectElementImpl::childrenChan
bool HTMLObjectElementImpl::isURLAttribute(AttributeImpl *attr) const
{
return (attr->id() == ATTR_DATA || (attr->id() == ATTR_USEMAP && attr->value().domString()[0] != '#'));
+}
+
+bool HTMLObjectElementImpl::isImageType()
+{
+ if (serviceType.isEmpty() && url.startsWith("data:")) {
+ // Extract the MIME type from the data URL.
+ int index = url.find(';');
+ if (index == -1)
+ index = url.find(',');
+ if (index != -1) {
+ int len = index - 5;
+ if (len > 0)
+ serviceType = url.mid(5, len);
+ else
+ serviceType = "text/plain"; // Data URLs with no MIME type are considered text/plain.
+ }
+ }
+
+ return canRenderImageType(serviceType);
+}
+
+void HTMLObjectElementImpl::renderFallbackContent()
+{
+ if (m_useFallbackContent)
+ return;
+
+ // Mark ourselves as using the fallback content.
+ m_useFallbackContent = true;
+
+ // Now do a detach and reattach.
+ // FIXME: Style gets recalculated which is suboptimal.
+ detach();
+ attach();
}
// -------------------------------------------------------------------------
Index: WebCore/khtml/html/html_objectimpl.h
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/khtml/html/html_objectimpl.h,v
retrieving revision 1.28
diff -u -p -r1.28 WebCore/khtml/html/html_objectimpl.h
--- WebCore/khtml/html/html_objectimpl.h 2005/03/10 21:09:24 1.28
+++ WebCore/khtml/html/html_objectimpl.h 2005/04/28 01:52:10
@@ -139,6 +139,10 @@ public:
virtual bool isURLAttribute(AttributeImpl *attr) const;
+ bool isImageType();
+
+ void renderFallbackContent();
+
#if APPLE_CHANGES
KJS::Bindings::Instance *getObjectInstance() const;
#endif
@@ -146,7 +150,8 @@ public:
QString serviceType;
QString url;
QString classId;
- bool needWidgetUpdate;
+ bool needWidgetUpdate : 1;
+ bool m_useFallbackContent : 1;
HTMLImageLoader* m_imageLoader;
#if APPLE_CHANGES
Index: WebCore/khtml/rendering/render_frames.cpp
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/khtml/rendering/render_frames.cpp,v
retrieving revision 1.66
diff -u -p -r1.66 WebCore/khtml/rendering/render_frames.cpp
--- WebCore/khtml/rendering/render_frames.cpp 2005/03/02 01:38:17 1.66
+++ WebCore/khtml/rendering/render_frames.cpp 2005/04/28 01:52:10
@@ -612,26 +612,6 @@ bool RenderPart::partLoadingErrorNotify(
return false;
}
-int RenderPart::intrinsicWidth() const
-{
- // KDE may need a non-zero width here, although this will mess up pages (e.g., thinker.org).
-#if APPLE_CHANGES
- return 0;
-#else
- return 300;
-#endif
-}
-
-int RenderPart::intrinsicHeight() const
-{
- // KDE may need a non-zero height here, although this will mess up pages (e.g., thinker.org).
-#if APPLE_CHANGES
- return 0;
-#else
- return 200;
-#endif
-}
-
void RenderPart::slotViewCleared()
{
}
@@ -681,6 +661,7 @@ RenderPartObject::RenderPartObject( DOM:
{
// init RenderObject attributes
setInline(true);
+ m_hasFallbackContent = false;
}
void RenderPartObject::updateWidget()
@@ -831,7 +812,16 @@ void RenderPartObject::updateWidget()
params.append( QString::fromLatin1("__KHTML__CODEBASE=\"%1\"").arg( o->getAttribute(ATTR_CODEBASE).string() ) );
#endif
- part->requestObject( this, url, serviceType, paramNames, paramValues );
+ // Find out if we support fallback content.
+ m_hasFallbackContent = false;
+ for (NodeImpl *child = o->firstChild(); child && !m_hasFallbackContent; child = child->nextSibling()) {
+ if ((!child->isTextNode() && child->id() != ID_EMBED && child->id() != ID_PARAM) || // Discount