Summary: | [testcase] focus javascript method called on a specified element after "Back" does not work | ||
---|---|---|---|
Product: | [Applications] konqueror | Reporter: | Enrico Oltolina <enrico.oltolina> |
Component: | khtml event | Assignee: | Konqueror Developers <konq-bugs> |
Status: | RESOLVED WORKSFORME | ||
Severity: | normal | CC: | james, mikelima |
Priority: | NOR | Keywords: | triaged |
Version: | 4.0.3 | ||
Target Milestone: | --- | ||
Platform: | openSUSE | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Enrico Oltolina
2005-11-08 14:56:13 UTC
Maybe the problem is in the KHTMLPart::slotFinishedParsing() method: void KHTMLPart::slotFinishedParsing() { d->m_doc->setParsing(false); checkEmitLoadEvent(); disconnect(d->m_doc,SIGNAL(finishedParsing()),this,SLOT(slotFinishedParsing())); if (!d->m_view) return; // We are probably being destructed. checkCompleted(); } First, the LOAD signal is emitted (and so the onLoad event handler function is executed), after that the checkCompleted function is executed. The checkCompleted, as first step, restores the cursor position. So, the onLoad set the focus, and the checkCompleted restore the original position. I tried to modify the slotFinishedParsing() in the following way: void KHTMLPart::slotFinishedParsing() { d->m_doc->setParsing(false); // restore the cursor position if (d->m_doc && !d->m_doc->parsing() && !d->m_focusNodeRestored) { if (d->m_focusNodeNumber >= 0) d->m_doc->setFocusNode(d->m_doc->nodeWithAbsIndex(d->m_focusNodeNumber)); d->m_focusNodeRestored = true; } checkEmitLoadEvent(); disconnect(d->m_doc,SIGNAL(finishedParsing()),this,SLOT(slotFinishedParsing())); if (!d->m_view) return; // We are probably being destructed. checkCompleted(); } and now it seems that konqueror works well. I know that this is not a definitive solution, maybe it could be enough to execute checkComplete and after that checkEmitLoadEvent, but I don't know if there are some side effects. Ok, my previous patch does not work! I changed the code in KHTMLPart::checkCompleted() in the following way: DOM::NodeImpl* firstFocus = NULL; DOM::DocumentImpl* document = xmlDocImpl() ; if (document) { firstFocus = document->focusNode(); } if (d->m_doc && !d->m_doc->parsing() && !d->m_focusNodeRestored) { if (d->m_focusNodeNumber >= 0 && firstFocus == NULL) d->m_doc->setFocusNode(d->m_doc->nodeWithAbsIndex(d->m_focusNodeNumber)); d->m_focusNodeRestored = true; } I hope this works well... I can confirm the behaviour described (3.5 branch r575787), but perhaps it's deliberate? (user's focus chosen by clicking on a link overrides the focus set by the JS). I'll mark confirmed so the developers can take a look This still happens in 4.0.3 Steps to reproduce are listed in the first entry, I'll copy paste for ease: >When loading the first page, the focus is on the second link. Clicking on the third one, and then press back: the focus is on the third link, while expecting always on the second. The first page can be found at http://nixeagle.org/kdebugs/115922/onLoadTest.html the "focus" should be on the middle link in the list. Click ok on that javascript popup, click the 3rd link (last one in the list). It will load page01.html on the same server. When it loads, click back. Click ok on the popup again. At this point, the focus should be on the middle link, instead its on the last link. (the one you just clicked). Using Gentoo Linux ~x86 (testing in gentoo lingo). KDE and the majority of packages compiled using gcc 4.3.0. There hasn't been any activity on this report for some time. Please check if the issue is still valid for Konqueror 4.8.4 or later. Thank you. Dear Bug Submitter, This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information as soon as possible and set the bug status as REPORTED. Due to regular bug tracker maintenance, if the bug is still in NEEDSINFO status with no change in 30 days, the bug will be closed as RESOLVED > WORKSFORME due to lack of needed information. For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging If you have already provided the requested information, please set the bug status as REPORTED so that the KDE team knows that the bug is ready to be confirmed. Thank you for helping us make KDE software even better for everyone! Dear Bug Submitter, This bug has been in NEEDSINFO status with no change for at least 30 days. The bug is now closed as RESOLVED > WORKSFORME due to lack of needed information. For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging Thank you for helping us make KDE software even better for everyone! |