[webkit-changes] cvs commit: WebCore/kwq KWQKHTMLPart.mm

Adele adele at opensource.apple.com
Thu Dec 8 20:10:04 PST 2005


adele       05/12/08 20:10:04

  Modified:    .        Tag: Safari-2-0-branch ChangeLog
               khtml/dom Tag: Safari-2-0-branch dom_element.cpp
               khtml/xml Tag: Safari-2-0-branch dom_docimpl.cpp
                        dom_elementimpl.cpp dom_elementimpl.h
               kwq      Tag: Safari-2-0-branch KWQKHTMLPart.mm
  Log:
          Reviewed by Tim Hatcher.
  
          - fixed <rdar://problem/4363794> 10.4.4 REGRESSION: Page scroll position jumps when clicking on word in editable div (5911)
          setFocusNode was trying to scroll to reveal elements unnecessarily.
          Now the callers have to decide whether or not to scroll.
  
          * khtml/xml/dom_docimpl.cpp:
          (DocumentImpl::setFocusNode): No longer calls scrolling code.
          * kwq/KWQKHTMLPart.mm:
          (KWQKHTMLPart::nextKeyViewInFrame): Now calls scrolling code after setting the focus node.
          * khtml/xml/dom_elementimpl.cpp:
          (ElementImpl::focus): Moved functionality from Element::focus.
           Now these functions also call scrolling code.
          (ElementImpl::blur): ditto.
          * khtml/xml/dom_elementimpl.h: Added focus and blur.
          * khtml/dom/dom_element.cpp:
          (Element::focus): Now calls ElementImpl::focus
          (Element::blur): ditto.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.98  +21 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.1.2.97
  retrieving revision 1.1.2.98
  diff -u -r1.1.2.97 -r1.1.2.98
  --- ChangeLog	8 Dec 2005 23:13:15 -0000	1.1.2.97
  +++ ChangeLog	9 Dec 2005 04:09:53 -0000	1.1.2.98
  @@ -1,3 +1,24 @@
  +2005-12-08  Adele Peterson  <adele at apple.com>
  +
  +        Reviewed by Tim Hatcher.
  +
  +        - fixed <rdar://problem/4363794> 10.4.4 REGRESSION: Page scroll position jumps when clicking on word in editable div (5911)
  +        setFocusNode was trying to scroll to reveal elements unnecessarily. 
  +        Now the callers have to decide whether or not to scroll.
  +
  +        * khtml/xml/dom_docimpl.cpp:
  +        (DocumentImpl::setFocusNode): No longer calls scrolling code.
  +        * kwq/KWQKHTMLPart.mm:
  +        (KWQKHTMLPart::nextKeyViewInFrame): Now calls scrolling code after setting the focus node.
  +        * khtml/xml/dom_elementimpl.cpp:
  +        (ElementImpl::focus): Moved functionality from Element::focus.
  +         Now these functions also call scrolling code.
  +        (ElementImpl::blur): ditto.
  +        * khtml/xml/dom_elementimpl.h: Added focus and blur.
  +        * khtml/dom/dom_element.cpp:
  +        (Element::focus): Now calls ElementImpl::focus
  +        (Element::blur): ditto.
  +
   2005-12-08  Tim Omernick  <timo at apple.com>
   
           Merged fix from TOT to Safari-2-0-branch
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.9.18.3  +2 -6      WebCore/khtml/dom/Attic/dom_element.cpp
  
  Index: dom_element.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/dom/Attic/dom_element.cpp,v
  retrieving revision 1.9.18.2
  retrieving revision 1.9.18.3
  diff -u -r1.9.18.2 -r1.9.18.3
  --- dom_element.cpp	15 Nov 2005 07:30:55 -0000	1.9.18.2
  +++ dom_element.cpp	9 Dec 2005 04:09:58 -0000	1.9.18.3
  @@ -303,17 +303,13 @@
   void Element::focus()
   {
       if(!impl) return;
  -    DocumentImpl* doc = impl->getDocument();
  -    if (doc && impl->isFocusable())
  -        doc->setFocusNode(impl);
  +    ((ElementImpl *)impl)->focus();
   }
   
   void Element::blur()
   {
       if(!impl) return;
  -    DocumentImpl* doc = impl->getDocument();
  -    if (doc && doc->focusNode() == impl)
  -	doc->setFocusNode(0);
  +    ((ElementImpl *)impl)->blur();
   }
   
   // FIXME: This should move down to HTMLElement.
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.211.6.17 +1 -7      WebCore/khtml/xml/dom_docimpl.cpp
  
  Index: dom_docimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/dom_docimpl.cpp,v
  retrieving revision 1.211.6.16
  retrieving revision 1.211.6.17
  diff -u -r1.211.6.16 -r1.211.6.17
  --- dom_docimpl.cpp	30 Nov 2005 22:40:23 -0000	1.211.6.16
  +++ dom_docimpl.cpp	9 Dec 2005 04:09:58 -0000	1.211.6.17
  @@ -2664,14 +2664,8 @@
               }
               if (focusWidget)
                   focusWidget->setFocus();
  -            else {
  +            else
                   view()->setFocus();
  -                // updateLayout in case this comes before a renderer is set up.
  -                updateLayout();
  -                // Check that there's still a renderer after updating the layout.
  -                if (m_focusNode->renderer())
  -                    m_focusNode->renderer()->enclosingLayer()->scrollRectToVisible(m_focusNode->getRect());
  -            }
           }
      }
   
  
  
  
  1.61.6.6  +17 -0     WebCore/khtml/xml/dom_elementimpl.cpp
  
  Index: dom_elementimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/dom_elementimpl.cpp,v
  retrieving revision 1.61.6.5
  retrieving revision 1.61.6.6
  diff -u -r1.61.6.5 -r1.61.6.6
  --- dom_elementimpl.cpp	12 Nov 2005 01:57:17 -0000	1.61.6.5
  +++ dom_elementimpl.cpp	9 Dec 2005 04:09:59 -0000	1.61.6.6
  @@ -270,6 +270,23 @@
       }
   }
   
  +void ElementImpl::focus()
  +{
  +    DocumentImpl *doc = getDocument();
  +    if (doc)
  +        doc->updateLayout();
  +    if (isFocusable() && renderer()) {
  +        renderer()->enclosingLayer()->scrollRectToVisible(getRect());
  +    }
  +}
  +
  +void ElementImpl::blur()
  +{
  +    DocumentImpl* doc = getDocument();
  +    if (doc && doc->focusNode() == this)
  +	doc->setFocusNode(0);
  +}
  +
   const AtomicString& ElementImpl::getAttributeNS(const DOMString &namespaceURI,
                                                   const DOMString &localName) const
   {   
  
  
  
  1.35.8.4  +2 -0      WebCore/khtml/xml/dom_elementimpl.h
  
  Index: dom_elementimpl.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/dom_elementimpl.h,v
  retrieving revision 1.35.8.3
  retrieving revision 1.35.8.4
  diff -u -r1.35.8.3 -r1.35.8.4
  --- dom_elementimpl.h	4 Aug 2005 01:58:20 -0000	1.35.8.3
  +++ dom_elementimpl.h	9 Dec 2005 04:09:59 -0000	1.35.8.4
  @@ -171,6 +171,8 @@
       bool hasAttributes() const;
       
       void scrollIntoView (bool alignToTop);
  +    void focus();
  +    void blur();
       
       DOMString prefix() const { return m_prefix; }
       void setPrefix(const DOMString &_prefix, int &exceptioncode );
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.628.6.15 +3 -3      WebCore/kwq/KWQKHTMLPart.mm
  
  Index: KWQKHTMLPart.mm
  ===================================================================
  RCS file: /cvs/root/WebCore/kwq/KWQKHTMLPart.mm,v
  retrieving revision 1.628.6.14
  retrieving revision 1.628.6.15
  diff -u -r1.628.6.14 -r1.628.6.15
  --- KWQKHTMLPart.mm	8 Dec 2005 21:44:27 -0000	1.628.6.14
  +++ KWQKHTMLPart.mm	9 Dec 2005 04:10:01 -0000	1.628.6.15
  @@ -1197,10 +1197,10 @@
               }
           }
           else {
  -            doc->setFocusNode(node);
  -            if (node->renderer())
  +            if (node->isFocusable() && node->renderer()) {
  +                doc->setFocusNode(node);
                   node->renderer()->enclosingLayer()->scrollRectToVisible(node->getRect());
  -                
  +            }
               [_bridge makeFirstResponder:[_bridge documentView]];
               return [_bridge documentView];
           }
  
  
  



More information about the webkit-changes mailing list