<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>106930</bug_id>
          
          <creation_ts>2005-06-07 00:37:44 +0000</creation_ts>
          <short_desc>Package not rendered correctly (at all)</short_desc>
          <delta_ts>2006-02-04 18:49:35 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>2</classification_id>
          <classification>Applications</classification>
          <product>konqueror</product>
          <component>khtml</component>
          <version>unspecified</version>
          <rep_platform>Compiled Sources</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Isaac Clerencia">isaac</reporter>
          <assigned_to name="Konqueror Bugs">konqueror-bugs-null</assigned_to>
          <cc>maksim</cc>
          
          <cf_commitlink></cf_commitlink>
          <cf_versionfixedin></cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>348235</commentid>
    <comment_count>0</comment_count>
    <who name="Isaac Clerencia">isaac</who>
    <bug_when>2005-06-07 00:37:44 +0000</bug_when>
    <thetext>Version:            (using KDE Devel)
Installed from:    Compiled sources

http://www.carton.smurfit.es/ doesn&apos;t render correctly.

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

Best regards</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>348568</commentid>
    <comment_count>1</comment_count>
    <who name="Thiago Macieira">thiago</who>
    <bug_when>2005-06-08 05:37:07 +0000</bug_when>
    <thetext>Then this is quite likely a page bug, not a Konqueror one.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>409935</commentid>
    <comment_count>2</comment_count>
    <who name="Maksim Orlovich">maksim</who>
    <bug_when>2006-01-30 06:46:17 +0000</bug_when>
    <thetext>Seems to be trying to find a frameset under frames by id...
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>409937</commentid>
    <comment_count>3</comment_count>
    <who name="Maksim Orlovich">maksim</who>
    <bug_when>2006-01-30 07:04:59 +0000</bug_when>
    <thetext>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&apos;t list name on frameset as attributed, and IE seems to follow that, and it doesn&apos;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&lt;DOM::DocumentImpl*&gt;(part-&gt;document().handle());
+  DOM::ElementImpl*  el  = 0;
+  if (doc &amp;&amp; (el = doc-&gt;getElementById(p.string())) &amp;&amp; el-&gt;id() == ID_FRAMESET)
+    return getDOMNode(exec, el);
+
   return ObjectImp::get(exec, p);
 }


</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>411564</commentid>
    <comment_count>4</comment_count>
    <who name="Maksim Orlovich">maksim</who>
    <bug_when>2006-02-04 18:45:58 +0000</bug_when>
    <thetext>SVN commit 505729 by orlovich:

Emulate IE quirk of finding -everything- by name/ID 
under document.frames (well, almost -- we don&apos;t let frames 
be hidden by non-frames)
Makes menu on  http://www.carton.smurfit.es/ work (moz and opera can&apos;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&lt;DOM::DocumentImpl*&gt;(frameElement.contentDocument().handle())-&gt;view();
-        if (view &amp;&amp; view-&gt;part())
-            return Value(Window::retrieveWindow(view-&gt;part()));
+        KHTMLPart* part = static_cast&lt;DOM::HTMLFrameElementImpl*&gt;(frameElement.handle())-&gt;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&lt;DOM::DocumentImpl*&gt;(iFrame.contentDocument().handle());
-        if (!contentDoc)
-            return Undefined();
-
-        KHTMLView *view = contentDoc-&gt;view();
-        if (view &amp;&amp; view-&gt;part())
-            return Value(Window::retrieveWindow(view-&gt;part()));
+        KHTMLPart* part = static_cast&lt;DOM::HTMLIFrameElementImpl*&gt;(iFrame.handle())-&gt;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&apos;t quite do that, but do this as a fallback.
+  DOM::DocumentImpl* doc  = static_cast&lt;DOM::DocumentImpl*&gt;(part-&gt;document().handle());
+  DOM::HTMLCollectionImpl docuAll(doc, DOM::HTMLCollectionImpl::DOC_ALL);
+  DOM::NodeImpl*     node = docuAll.namedItem(p.string());
+  if (node) {
+    if (node-&gt;id() == ID_FRAME || node-&gt;id() == ID_IFRAME) {
+      //Return the Window object.
+      KHTMLPart* part = static_cast&lt;DOM::HTMLFrameElementImpl*&gt;(node)-&gt;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&lt;RenderPart*&gt;( m_render );
+
+    if(render-&gt;widget() &amp;&amp; ::qt_cast&lt;KHTMLView*&gt;( render-&gt;widget()) )
+        return static_cast&lt;KHTMLView*&gt;( render-&gt;widget() )-&gt;part();
+
+    return 0;
+}
+
 // -------------------------------------------------------------------------
 
 HTMLFrameSetElementImpl::HTMLFrameSetElementImpl(DocumentPtr *doc)
--- branches/KDE/3.5/kdelibs/khtml/html/html_baseimpl.h #505728:505729
@@ -34,6 +34,7 @@
 #include &lt;qscrollview.h&gt;
 
 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;
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>411565</commentid>
    <comment_count>5</comment_count>
    <who name="Maksim Orlovich">maksim</who>
    <bug_when>2006-02-04 18:49:35 +0000</bug_when>
    <thetext>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
</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>