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

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>35259</bug_id>
          
          <creation_ts>2010-02-22 13:37:17 -0800</creation_ts>
          <short_desc>[Qt] QGraphicsScene mousePressEvent does not set the clickCausedFocus flag</short_desc>
          <delta_ts>2010-03-30 13:11:05 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKit Qt</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>S60 3rd edition</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>Qt</keywords>
          <priority>P2</priority>
          <bug_severity>Minor</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Joseph Ligman">joseph.ligman</reporter>
          <assigned_to name="QtWebKit Unassigned">webkit-qt-unassigned</assigned_to>
          <cc>commit-queue</cc>
    
    <cc>hausmann</cc>
    
    <cc>kenneth</cc>
    
    <cc>kent.hansen</cc>
    
    <cc>laszlo.gombos</cc>
    
    <cc>tonikitoo</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>192595</commentid>
    <comment_count>0</comment_count>
    <who name="Joseph Ligman">joseph.ligman</who>
    <bug_when>2010-02-22 13:37:17 -0800</bug_when>
    <thetext>Probably not too likely, but this flag not being set has impact on clients using QGraphicsWebView and QStyle::RSIP_OnMouseClickAndAlreadyFocused. And there are no tests for these flags, which would be good to add as well.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>200789</commentid>
    <comment_count>1</comment_count>
    <who name="Kent Hansen">kent.hansen</who>
    <bug_when>2010-03-17 08:08:21 -0700</bug_when>
    <thetext>Hi Joseph,
Could you add a testcase that demonstrates the issue? Thanks.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>200803</commentid>
    <comment_count>2</comment_count>
    <who name="Joseph Ligman">joseph.ligman</who>
    <bug_when>2010-03-17 08:34:21 -0700</bug_when>
    <thetext>Hi Kent, 

This is probably a minor issue. If you look at the following lines in qwebpage.cpp, you can see the issue. To me it would make sense to remove the handleSoftwareInputPanel altogether and just let the clients request it when needed.

QGraphicsSceneMouseEvent
771	void QWebPagePrivate::mousePressEvent(QGraphicsSceneMouseEvent* ev)
772	{
773	    WebCore::Frame* frame = QWebFramePrivate::core(mainFrame);
774	    if (!frame-&gt;view())
775	        return;
776	
777	    if (tripleClickTimer.isActive()
778	            &amp;&amp; (ev-&gt;pos().toPoint() - tripleClick).manhattanLength()
779	                &lt; QApplication::startDragDistance()) {
780	        mouseTripleClickEvent(ev);
781	        return;
782	    }
783	
784	    bool accepted = false;
785	    PlatformMouseEvent mev(ev, 1);
786	    // ignore the event if we can&apos;t map Qt&apos;s mouse buttons to WebCore::MouseButton
787	    if (mev.button() != NoButton)
788	        accepted = frame-&gt;eventHandler()-&gt;handleMousePressEvent(mev);
789	    ev-&gt;setAccepted(accepted);
790	}


QMouseEvent 
792	void QWebPagePrivate::mousePressEvent(QMouseEvent *ev)
793	{
822	    if (newNode &amp;&amp; oldNode != newNode)
823	        clickCausedFocus = true;
824	}



928	void QWebPagePrivate::handleSoftwareInputPanel(Qt::MouseButton button)
929	{
930	#if QT_VERSION &gt;= QT_VERSION_CHECK(4, 6, 0)
931	    Frame* frame = page-&gt;focusController()-&gt;focusedFrame();
932	    if (!frame)
933	        return;
934	
935	    if (client &amp;&amp; client-&gt;inputMethodEnabled()
936	        &amp;&amp; frame-&gt;document()-&gt;focusedNode()
937	        &amp;&amp; button == Qt::LeftButton &amp;&amp; qApp-&gt;autoSipEnabled()) {
938	        QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel(
939	            client-&gt;ownerWidget()-&gt;style()-&gt;styleHint(QStyle::SH_RequestSoftwareInputPanel));
940	        if (!clickCausedFocus || behavior == QStyle::RSIP_OnMouseClick) {
941	            QEvent event(QEvent::RequestSoftwareInputPanel);
942	            QApplication::sendEvent(client-&gt;ownerWidget(), &amp;event);
943	        }
944	    }
945	
946	    clickCausedFocus = false;
947	#endif
948	}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>200812</commentid>
    <comment_count>3</comment_count>
    <who name="Simon Hausmann">hausmann</who>
    <bug_when>2010-03-17 08:46:10 -0700</bug_when>
    <thetext>You&apos;re right, that&apos;s indeed missing</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>206056</commentid>
    <comment_count>4</comment_count>
      <attachid>52051</attachid>
    <who name="Joseph Ligman">joseph.ligman</who>
    <bug_when>2010-03-30 10:21:19 -0700</bug_when>
    <thetext>Created attachment 52051
Proposed patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>206060</commentid>
    <comment_count>5</comment_count>
    <who name="Antonio Gomes">tonikitoo</who>
    <bug_when>2010-03-30 10:27:40 -0700</bug_when>
    <thetext>(In reply to comment #4)
&gt; Created an attachment (id=52051) [details]
&gt; Proposed patch

I think it looks good, but code could be improved.

you do &quot;page-&gt;focusController()-&gt;focusedFrame()&quot; four times. It would be stored in aux vars, so it would like nicer.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>206061</commentid>
    <comment_count>6</comment_count>
    <who name="Antonio Gomes">tonikitoo</who>
    <bug_when>2010-03-30 10:29:47 -0700</bug_when>
    <thetext>(In reply to comment #5)
&gt; (In reply to comment #4)
&gt; &gt; Created an attachment (id=52051) [details] [details]
&gt; &gt; Proposed patch
&gt; 
&gt; I think it looks good, but code could be improved.
&gt; 
&gt; you do &quot;page-&gt;focusController()-&gt;focusedFrame()&quot; four times. It would be stored
&gt; in aux vars, so it would like nicer.

actually 6 times :)

also, here

+    RefPtr&lt;WebCore::Node&gt; oldNode;

are you sure you want to keep hold a reference just to compare it later one? 
it can be destroyed when unfocused, no?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>206064</commentid>
    <comment_count>7</comment_count>
    <who name="Kenneth Rohde Christiansen">kenneth</who>
    <bug_when>2010-03-30 10:33:45 -0700</bug_when>
    <thetext>&gt; +    RefPtr&lt;WebCore::Node&gt; oldNode;
&gt; 
&gt; are you sure you want to keep hold a reference just to compare it later one? 
&gt; it can be destroyed when unfocused, no?

He is not, they get out of scope after the method ends.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>206141</commentid>
    <comment_count>8</comment_count>
      <attachid>52051</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2010-03-30 13:11:00 -0700</bug_when>
    <thetext>Comment on attachment 52051
Proposed patch

Clearing flags on attachment: 52051

Committed r56805: &lt;http://trac.webkit.org/changeset/56805&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>206142</commentid>
    <comment_count>9</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2010-03-30 13:11:05 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>52051</attachid>
            <date>2010-03-30 10:21:19 -0700</date>
            <delta_ts>2010-03-30 13:11:00 -0700</delta_ts>
            <desc>Proposed patch</desc>
            <filename>bug35259.patch</filename>
            <type>text/plain</type>
            <size>2160</size>
            <attacher name="Joseph Ligman">joseph.ligman</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYktpdC9xdC9DaGFuZ2VMb2cKPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotLS0gV2ViS2l0L3F0L0NoYW5n
ZUxvZwkocmV2aXNpb24gNTY3OT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