Summary: | Package not rendered correctly (at all) | ||
---|---|---|---|
Product: | [Applications] konqueror | Reporter: | Isaac Clerencia <isaac> |
Component: | khtml | Assignee: | Konqueror Developers <konq-bugs> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | maksim |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Isaac Clerencia
2005-06-07 00:37:44 UTC
Then this is quite likely a page bug, not a Konqueror one. Seems to be trying to find a frameset under frames by id... 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); } 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; 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 |