Bug 106930 - Package not rendered correctly (at all)
Summary: Package not rendered correctly (at all)
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: khtml (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-07 00:37 UTC by Isaac Clerencia
Modified: 2006-02-04 18:49 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Isaac Clerencia 2005-06-07 00:37:44 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources

http://www.carton.smurfit.es/ doesn't render correctly.

When you load it, it displays a flash thing, then you are given a flash menu, where you can choose "products", that should display some product images using JavaScript but it doesn't work and just shows a blank page. Note that it doesn't work in Mozilla Firefox either. (but it does in Explorer in Windows).

Best regards
Comment 1 Thiago Macieira 2005-06-08 05:37:07 UTC
Then this is quite likely a page bug, not a Konqueror one.
Comment 2 Maksim Orlovich 2006-01-30 06:46:17 UTC
Seems to be trying to find a frameset under frames by id...
Comment 3 Maksim Orlovich 2006-01-30 07:04:59 UTC
The following makes it work, but it probably a bit too much of a hack (in particular, I need to double-check to see whether the frameset may be found by name -- probably not, since html4.01 doesn't list name on frameset as attributed, and IE seems to follow that, and it doesn't do the right thing if there is a non-frameset element with the same ID, but may be worth committing nonetheless)

--- /home/maksim/kde3/kdelibs/khtml/ecma/kjs_window.cpp (revision 502559)
+++ /home/maksim/kde3/kdelibs/khtml/ecma/kjs_window.cpp (working copy)
@@ -2147,6 +2147,12 @@ Value FrameArray::get(ExecState *exec, c
     return Window::retrieve(frame);
   }

+  // IE also likes to map framesets by ID here. Do an easy approximation of that.
+  DOM::DocumentImpl* doc = static_cast<DOM::DocumentImpl*>(part->document().handle());
+  DOM::ElementImpl*  el  = 0;
+  if (doc && (el = doc->getElementById(p.string())) && el->id() == ID_FRAMESET)
+    return getDOMNode(exec, el);
+
   return ObjectImp::get(exec, p);
 }


Comment 4 Maksim Orlovich 2006-02-04 18:45:58 UTC
SVN commit 505729 by orlovich:

Emulate IE quirk of finding -everything- by name/ID 
under document.frames (well, almost -- we don't let frames 
be hidden by non-frames)
Makes menu on  http://www.carton.smurfit.es/ work (moz and opera can't handle it ;-) )
BUG:106930


 M  +6 -10     ecma/kjs_html.cpp  
 M  +20 -0     ecma/kjs_window.cpp  
 M  +12 -0     html/html_baseimpl.cpp  
 M  +2 -0      html/html_baseimpl.h  


--- branches/KDE/3.5/kdelibs/khtml/ecma/kjs_html.cpp #505728:505729
@@ -1847,9 +1847,9 @@
     case FrameContentDocument: return checkNodeSecurity(exec,frameElement.contentDocument()) ?
 				      getDOMNode(exec, frameElement.contentDocument()) : Undefined();
     case FrameContentWindow:   {
-        KHTMLView *view = static_cast<DOM::DocumentImpl*>(frameElement.contentDocument().handle())->view();
-        if (view && view->part())
-            return Value(Window::retrieveWindow(view->part()));
+        KHTMLPart* part = static_cast<DOM::HTMLFrameElementImpl*>(frameElement.handle())->contentPart();
+        if (part)
+            return Value(Window::retrieveWindow(part));
         else
             return Undefined();
     }
@@ -1872,13 +1872,9 @@
     case IFrameContentDocument: return checkNodeSecurity(exec,iFrame.contentDocument()) ?
 				       getDOMNode(exec, iFrame.contentDocument()) : Undefined();
     case IFrameContentWindow:       {
-        DOM::DocumentImpl* contentDoc = static_cast<DOM::DocumentImpl*>(iFrame.contentDocument().handle());
-        if (!contentDoc)
-            return Undefined();
-
-        KHTMLView *view = contentDoc->view();
-        if (view && view->part())
-            return Value(Window::retrieveWindow(view->part()));
+        KHTMLPart* part = static_cast<DOM::HTMLIFrameElementImpl*>(iFrame.handle())->contentPart();
+        if (part)
+            return Value(Window::retrieveWindow(part));
         else
             return Undefined();
     }
--- branches/KDE/3.5/kdelibs/khtml/ecma/kjs_window.cpp #505728:505729
@@ -2147,6 +2147,26 @@
     return Window::retrieve(frame);
   }
 
+  // Fun IE quirk: name lookup in there is actually done by document.all 
+  // hence, it can find non-frame things (and even let them hide frame ones!)
+  // We don't quite do that, but do this as a fallback.
+  DOM::DocumentImpl* doc  = static_cast<DOM::DocumentImpl*>(part->document().handle());
+  DOM::HTMLCollectionImpl docuAll(doc, DOM::HTMLCollectionImpl::DOC_ALL);
+  DOM::NodeImpl*     node = docuAll.namedItem(p.string());
+  if (node) {
+    if (node->id() == ID_FRAME || node->id() == ID_IFRAME) {
+      //Return the Window object.
+      KHTMLPart* part = static_cast<DOM::HTMLFrameElementImpl*>(node)->contentPart();
+      if (part)
+        return Value(Window::retrieveWindow(part));
+      else
+        return Undefined();
+    } else {
+      //Just a regular node..
+      return getDOMNode(exec, node);
+    }
+  }
+
   return ObjectImp::get(exec, p);
 }
 
--- branches/KDE/3.5/kdelibs/khtml/html/html_baseimpl.cpp #505728:505729
@@ -418,6 +418,18 @@
     return 0;
 }
 
+KHTMLPart*   HTMLFrameElementImpl::contentPart() const
+{
+    if ( !m_render ) return 0;
+
+    RenderPart* render = static_cast<RenderPart*>( m_render );
+
+    if(render->widget() && ::qt_cast<KHTMLView*>( render->widget()) )
+        return static_cast<KHTMLView*>( render->widget() )->part();
+
+    return 0;
+}
+
 // -------------------------------------------------------------------------
 
 HTMLFrameSetElementImpl::HTMLFrameSetElementImpl(DocumentPtr *doc)
--- branches/KDE/3.5/kdelibs/khtml/html/html_baseimpl.h #505728:505729
@@ -34,6 +34,7 @@
 #include <qscrollview.h>
 
 class KHTMLView;
+class KHTMLPart;
 
 namespace khtml {
     class RenderFrameSet;
@@ -95,6 +96,7 @@
     virtual void setFocus(bool);
 
     DocumentImpl* contentDocument() const;
+    KHTMLPart*    contentPart() const;
 
     DOMString url;
     DOMString name;
Comment 5 Maksim Orlovich 2006-02-04 18:49:35 UTC
SVN commit 505730 by orlovich:

Regression tests for window.frames weirdness..
CCBUG:106930


 A             baseline/ecma/docu-frames.html-dom  
 A             baseline/ecma/docu-frames.html-render  
 M  +1 -0      baseline/ecma/svnignore  
 A             tests/ecma/docu-frames.html  
 A             tests/ecma/docu-frames2.html  
 M  +1 -0      tests/ecma/ignore  


--- trunk/tests/khtmltests/regression/baseline/ecma/svnignore #505729:505730
@@ -33,3 +33,4 @@
 innerhtml-getelbyid.html-render
 docu-all-frame.html-dump.png
 docu-all-iframe.html-dump.png
+docu-frames.html-dump.png
--- trunk/tests/khtmltests/regression/tests/ecma/ignore #505729:505730
@@ -4,3 +4,4 @@
 good.html
 bad.html
 docu-all-frame2.html
+docu-frames2.html