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

Timothy thatcher at opensource.apple.com
Fri Nov 18 14:46:54 PST 2005


thatcher    05/11/18 14:46:53

  Modified:    .        Tag: Safari-1-3-branch ChangeLog
               khtml    Tag: Safari-1-3-branch khtml_part.cpp khtml_part.h
                        khtmlview.cpp
               khtml/css Tag: Safari-1-3-branch cssparser.cpp
                        cssstyleselector.cpp html4.css
               khtml/rendering Tag: Safari-1-3-branch render_layer.cpp
                        render_object.cpp render_object.h render_style.h
               khtml/xml Tag: Safari-1-3-branch dom_docimpl.cpp
                        dom_docimpl.h dom_nodeimpl.cpp dom_nodeimpl.h
               kwq      Tag: Safari-1-3-branch KWQKHTMLPart.h
                        KWQKHTMLPart.mm
  Log:
          Merged fix from TOT to Safari-1-3-branch
  
      2005-07-29  David Hyatt  <hyatt at apple.com>
  
  	(1) Fixes khtml-user-select: none to have the following additional behavior (that matches Firefox's implementation of the property as well)
  	(a) If you mouse down (or click, double click, triple click) inside a "none" region, the selection should not be cleared or changed
          (b) If you drag from within a "none" region out to a selectable region, so what, no selection should be changed or started.
  
  	(2) Adds a new value to khtml-user-select called "element" that is used for any object that should have the behavior of (a) and (b) above (but that is selectable aside from that).  This includes images, links, buttons, and so on.  html4.css is patched to add support for these objects.
  	    This feature fixes the big contenteditable issue and selection is no longer cleared now when you click on these controls (or on links).  This behavior matches other browsers.
  
  	(3) :active and :hover have been substantially reworked.
  	    (a) If you mouse down on a selectable region, then the behavior is unchanged.  :hover/:active is completely frozen, and they aren't updated at all.
  	    (b) If you mouse down on a non-selectable region and start moving, then the behavior has changed.  Instead of not updating at all, we mark the chain at the time the mouse goes down, and we restrict :hover/:active updates to only apply to elements that are in that chain.  This yields perfect hover/active control behavior, even when :active has been applied hierarchically.
  	    (c) :hover has moved onto the node and is no longer on the renderobject (allowing them to be consistent).
  
          Reviewed by john
  
          * khtml/css/cssparser.cpp:
          (CSSParser::parseValue):
          * khtml/css/cssstyleselector.cpp:
          (khtml::CSSStyleSelector::canShareStyleWithElement):
          (khtml::CSSStyleSelector::checkOneSelector):
          (khtml::CSSStyleSelector::applyProperty):
          * khtml/css/html4.css:
          * khtml/khtml_part.cpp:
          (KHTMLPart::setSelection):
          (KHTMLPart::selectClosestWordFromMouseEvent):
          (KHTMLPart::handleMousePressEventTripleClick):
          (KHTMLPart::handleMousePressEventSingleClick):
          (KHTMLPart::handleMouseMoveEventSelection):
          (KHTMLPart::khtmlMouseReleaseEvent):
          * khtml/khtml_part.h:
          (KHTMLPart::mouseDownMayStartSelect):
          * khtml/khtmlview.cpp:
          (KHTMLView::viewportMouseMoveEvent):
          * khtml/rendering/render_layer.cpp:
          (RenderLayer::hitTest):
          (RenderLayer::updateHoverActiveState):
          * khtml/rendering/render_object.cpp:
          (RenderObject::RenderObject):
          (RenderObject::information):
          * khtml/rendering/render_object.h:
          (khtml::RenderObject::isRunIn):
          (khtml::RenderObject::setInline):
          (khtml::RenderObject::NodeInfo::NodeInfo):
          (khtml::RenderObject::NodeInfo::mouseMove):
          * khtml/rendering/render_style.h:
          (khtml::):
          * khtml/xml/dom_docimpl.cpp:
          (DocumentImpl::DocumentImpl):
          (DocumentImpl::~DocumentImpl):
          (DocumentImpl::prepareMouseEvent):
          (DocumentImpl::setActiveNode):
          * khtml/xml/dom_docimpl.h:
          (DOM::DocumentImpl::activeNode):
          * khtml/xml/dom_nodeimpl.cpp:
          (DOM::ContainerNodeImpl::setHovered):
          * khtml/xml/dom_nodeimpl.h:
          (DOM::NodeImpl::inActiveChain):
          (DOM::NodeImpl::hovered):
          (DOM::NodeImpl::setInActiveChain):
          (DOM::NodeImpl::setHovered):
          * kwq/KWQKHTMLPart.h:
          (KWQKHTMLPart::mouseDownMayStartSelect):
          * kwq/KWQKHTMLPart.mm:
          (KWQKHTMLPart::canMouseDownStartSelect):
          (KWQKHTMLPart::khtmlMousePressEvent):
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.335.2.29 +71 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.335.2.28
  retrieving revision 1.335.2.29
  diff -u -r1.335.2.28 -r1.335.2.29
  --- ChangeLog	18 Nov 2005 18:27:07 -0000	1.335.2.28
  +++ ChangeLog	18 Nov 2005 22:46:18 -0000	1.335.2.29
  @@ -1,3 +1,74 @@
  +2005-11-18  Timothy Hatcher  <timothy at apple.com>
  +
  +        Merged fix from TOT to Safari-1-3-branch
  +
  +    2005-07-29  David Hyatt  <hyatt at apple.com>
  +
  +	(1) Fixes khtml-user-select: none to have the following additional behavior (that matches Firefox's implementation of the property as well)
  +	(a) If you mouse down (or click, double click, triple click) inside a "none" region, the selection should not be cleared or changed
  +        (b) If you drag from within a "none" region out to a selectable region, so what, no selection should be changed or started.
  +
  +	(2) Adds a new value to khtml-user-select called "element" that is used for any object that should have the behavior of (a) and (b) above (but that is selectable aside from that).  This includes images, links, buttons, and so on.  html4.css is patched to add support for these objects.
  +	    This feature fixes the big contenteditable issue and selection is no longer cleared now when you click on these controls (or on links).  This behavior matches other browsers.
  +
  +	(3) :active and :hover have been substantially reworked.
  +	    (a) If you mouse down on a selectable region, then the behavior is unchanged.  :hover/:active is completely frozen, and they aren't updated at all.
  +	    (b) If you mouse down on a non-selectable region and start moving, then the behavior has changed.  Instead of not updating at all, we mark the chain at the time the mouse goes down, and we restrict :hover/:active updates to only apply to elements that are in that chain.  This yields perfect hover/active control behavior, even when :active has been applied hierarchically.
  +	    (c) :hover has moved onto the node and is no longer on the renderobject (allowing them to be consistent).
  +	
  +        Reviewed by john
  +
  +        * khtml/css/cssparser.cpp:
  +        (CSSParser::parseValue):
  +        * khtml/css/cssstyleselector.cpp:
  +        (khtml::CSSStyleSelector::canShareStyleWithElement):
  +        (khtml::CSSStyleSelector::checkOneSelector):
  +        (khtml::CSSStyleSelector::applyProperty):
  +        * khtml/css/html4.css:
  +        * khtml/khtml_part.cpp:
  +        (KHTMLPart::setSelection):
  +        (KHTMLPart::selectClosestWordFromMouseEvent):
  +        (KHTMLPart::handleMousePressEventTripleClick):
  +        (KHTMLPart::handleMousePressEventSingleClick):
  +        (KHTMLPart::handleMouseMoveEventSelection):
  +        (KHTMLPart::khtmlMouseReleaseEvent):
  +        * khtml/khtml_part.h:
  +        (KHTMLPart::mouseDownMayStartSelect):
  +        * khtml/khtmlview.cpp:
  +        (KHTMLView::viewportMouseMoveEvent):
  +        * khtml/rendering/render_layer.cpp:
  +        (RenderLayer::hitTest):
  +        (RenderLayer::updateHoverActiveState):
  +        * khtml/rendering/render_object.cpp:
  +        (RenderObject::RenderObject):
  +        (RenderObject::information):
  +        * khtml/rendering/render_object.h:
  +        (khtml::RenderObject::isRunIn):
  +        (khtml::RenderObject::setInline):
  +        (khtml::RenderObject::NodeInfo::NodeInfo):
  +        (khtml::RenderObject::NodeInfo::mouseMove):
  +        * khtml/rendering/render_style.h:
  +        (khtml::):
  +        * khtml/xml/dom_docimpl.cpp:
  +        (DocumentImpl::DocumentImpl):
  +        (DocumentImpl::~DocumentImpl):
  +        (DocumentImpl::prepareMouseEvent):
  +        (DocumentImpl::setActiveNode):
  +        * khtml/xml/dom_docimpl.h:
  +        (DOM::DocumentImpl::activeNode):
  +        * khtml/xml/dom_nodeimpl.cpp:
  +        (DOM::ContainerNodeImpl::setHovered):
  +        * khtml/xml/dom_nodeimpl.h:
  +        (DOM::NodeImpl::inActiveChain):
  +        (DOM::NodeImpl::hovered):
  +        (DOM::NodeImpl::setInActiveChain):
  +        (DOM::NodeImpl::setHovered):
  +        * kwq/KWQKHTMLPart.h:
  +        (KWQKHTMLPart::mouseDownMayStartSelect):
  +        * kwq/KWQKHTMLPart.mm:
  +        (KWQKHTMLPart::canMouseDownStartSelect):
  +        (KWQKHTMLPart::khtmlMousePressEvent):
  +
   2005-11-18  Mitz Pettel  <opendarwin.org at mitzpettel.com>
   
           Reviewed by Dave Harrson.
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.311.6.9 +19 -21    WebCore/khtml/khtml_part.cpp
  
  Index: khtml_part.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/khtml_part.cpp,v
  retrieving revision 1.311.6.8
  retrieving revision 1.311.6.9
  diff -u -r1.311.6.8 -r1.311.6.9
  --- khtml_part.cpp	13 Nov 2005 01:10:03 -0000	1.311.6.8
  +++ khtml_part.cpp	18 Nov 2005 22:46:23 -0000	1.311.6.9
  @@ -2478,7 +2478,7 @@
       d->m_selection = s;
       if (!s.isNone())
           setFocusNodeIfNeeded();
  -
  +    
       selectionLayoutChanged();
   
       // Always clear the x position used for vertical arrow navigation.
  @@ -4565,7 +4565,7 @@
   {
       Selection selection;
   
  -    if (!innerNode.isNull() && innerNode.handle()->renderer() && innerNode.handle()->renderer()->shouldSelect()) {
  +    if (!innerNode.isNull() && innerNode.handle()->renderer() && mouseDownMayStartSelect() && innerNode.handle()->renderer()->shouldSelect()) {
           VisiblePosition pos(innerNode.handle()->renderer()->positionForCoordinates(x, y));
           if (pos.isNotNull()) {
               selection.moveTo(pos);
  @@ -4604,24 +4604,22 @@
       QMouseEvent *mouse = event->qmouseEvent();
       DOM::Node innerNode = event->innerNode();
       
  -    Selection selection;
  -    
       if (mouse->button() == LeftButton && !innerNode.isNull() && innerNode.handle()->renderer() &&
  -        innerNode.handle()->renderer()->shouldSelect()) {
  +        mouseDownMayStartSelect() && innerNode.handle()->renderer()->shouldSelect()) {
  +        Selection selection;
           VisiblePosition pos(innerNode.handle()->renderer()->positionForCoordinates(event->x(), event->y()));
           if (pos.isNotNull()) {
               selection.moveTo(pos);
               selection.expandUsingGranularity(PARAGRAPH);
           }
  +        if (selection.isRange()) {
  +            d->m_selectionGranularity = PARAGRAPH;
  +            d->m_beganSelectingText = true;
  +        }
  +        
  +        setSelection(selection);
  +        startAutoScroll();
       }
  -    
  -    if (selection.isRange()) {
  -        d->m_selectionGranularity = PARAGRAPH;
  -        d->m_beganSelectingText = true;
  -    }
  -    
  -    setSelection(selection);
  -    startAutoScroll();
   }
   
   void KHTMLPart::handleMousePressEventSingleClick(khtml::MousePressEvent *event)
  @@ -4630,10 +4628,10 @@
       DOM::Node innerNode = event->innerNode();
       
       if (mouse->button() == LeftButton) {
  -        Selection sel;
  -
           if (!innerNode.isNull() && innerNode.handle()->renderer() &&
  -            innerNode.handle()->renderer()->shouldSelect()) {
  +            mouseDownMayStartSelect() && innerNode.handle()->renderer()->shouldSelect()) {
  +            Selection sel;
  +            
               // Extend the selection if the Shift key is down, unless the click is in a link.
               bool extendSelection = (mouse->state() & ShiftButton) && (event->url().isNull());
   
  @@ -4670,10 +4668,10 @@
                   sel = Selection(visiblePos);
                   d->m_selectionGranularity = CHARACTER;
               }
  +            
  +            setSelection(sel);
  +            startAutoScroll();
           }
  -
  -        setSelection(sel);
  -        startAutoScroll();
       }
   }
   
  @@ -4859,7 +4857,7 @@
       DOM::Node innerNode = event->innerNode();
   
       if (mouse->state() != LeftButton || !innerNode.handle() || !innerNode.handle()->renderer() ||
  -        !innerNode.handle()->renderer()->shouldSelect())
  +        !mouseDownMayStartSelect() || !innerNode.handle()->renderer()->shouldSelect())
       	return;
   
       // handle making selection
  @@ -4943,7 +4941,7 @@
       // Clear the selection if the mouse didn't move after the last mouse press.
       // We do this so when clicking on the selection, the selection goes away.
       // However, if we are editing, place the caret.
  -    if (!d->m_beganSelectingText
  +    if (mouseDownMayStartSelect() && !d->m_beganSelectingText
               && d->m_dragStartPos.x() == event->qmouseEvent()->x()
               && d->m_dragStartPos.y() == event->qmouseEvent()->y()
               && d->m_selection.isRange()) {
  
  
  
  1.127.6.3 +2 -0      WebCore/khtml/khtml_part.h
  
  Index: khtml_part.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/khtml_part.h,v
  retrieving revision 1.127.6.2
  retrieving revision 1.127.6.3
  diff -u -r1.127.6.2 -r1.127.6.3
  --- khtml_part.h	13 Jul 2005 00:56:57 -0000	1.127.6.2
  +++ khtml_part.h	18 Nov 2005 22:46:26 -0000	1.127.6.3
  @@ -1296,6 +1296,8 @@
     // Workaround for the fact that it's hard to delete a frame.
     // Call this after doing user-triggered selections to make it easy to delete the frame you entirely selected.
     void selectFrameElementInParentIfFullySelected();
  +
  +  virtual bool mouseDownMayStartSelect() const { return true; }
     
   private:
     khtml::ChildFrame *childFrame( const QObject *obj );
  
  
  
  1.128.6.3 +3 -2      WebCore/khtml/khtmlview.cpp
  
  Index: khtmlview.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/khtmlview.cpp,v
  retrieving revision 1.128.6.2
  retrieving revision 1.128.6.3
  diff -u -r1.128.6.2 -r1.128.6.3
  --- khtmlview.cpp	12 Nov 2005 01:57:42 -0000	1.128.6.2
  +++ khtmlview.cpp	18 Nov 2005 22:46:27 -0000	1.128.6.3
  @@ -891,11 +891,12 @@
       int xm, ym;
       viewportToContents(_mouse->x(), _mouse->y(), xm, ym);
   
  -    // Treat mouse move events while the mouse is pressed as "read-only" in prepareMouseEvent.
  +    // Treat mouse move events while the mouse is pressed as "read-only" in prepareMouseEvent
  +    // if we are allowed to select.
       // This means that :hover and :active freeze in the state they were in when the mouse
       // was pressed, rather than updating for nodes the mouse moves over as you hold the mouse down.
       DOM::NodeImpl::MouseEvent mev( _mouse->stateAfter(), DOM::NodeImpl::MouseMove );
  -    m_part->xmlDocImpl()->prepareMouseEvent( d->mousePressed, xm, ym, &mev );
  +    m_part->xmlDocImpl()->prepareMouseEvent(d->mousePressed && m_part->mouseDownMayStartSelect(), d->mousePressed, xm, ym, &mev );
   #if APPLE_CHANGES
       if (KWQ(m_part)->passSubframeEventToSubframe(mev))
           return;
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.95.6.2  +1 -1      WebCore/khtml/css/cssparser.cpp
  
  Index: cssparser.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/css/cssparser.cpp,v
  retrieving revision 1.95.6.1
  retrieving revision 1.95.6.2
  diff -u -r1.95.6.1 -r1.95.6.2
  --- cssparser.cpp	12 Jul 2005 21:08:36 -0000	1.95.6.1
  +++ cssparser.cpp	18 Nov 2005 22:46:31 -0000	1.95.6.2
  @@ -1061,7 +1061,7 @@
               valid_primitive = true;
           break;
       case CSS_PROP__KHTML_USER_SELECT: // auto | none | text
  -        if (id == CSS_VAL_AUTO || id == CSS_VAL_NONE || id == CSS_VAL_TEXT)
  +        if (id == CSS_VAL_AUTO || id == CSS_VAL_NONE || id == CSS_VAL_TEXT || id == CSS_VAL_ELEMENT)
               valid_primitive = true;
           break;
       case CSS_PROP_TEXT_OVERFLOW: // clip | ellipsis
  
  
  
  1.178.6.2 +4 -3      WebCore/khtml/css/cssstyleselector.cpp
  
  Index: cssstyleselector.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/css/cssstyleselector.cpp,v
  retrieving revision 1.178.6.1
  retrieving revision 1.178.6.2
  diff -u -r1.178.6.1 -r1.178.6.2
  --- cssstyleselector.cpp	13 Nov 2005 00:20:00 -0000	1.178.6.1
  +++ cssstyleselector.cpp	18 Nov 2005 22:46:32 -0000	1.178.6.2
  @@ -621,14 +621,13 @@
   bool CSSStyleSelector::canShareStyleWithElement(NodeImpl* n)
   {
       if (n->isHTMLElement()) {
  -        bool mouseInside = element->renderer() ? element->renderer()->mouseInside() : false;
           HTMLElementImpl* s = static_cast<HTMLElementImpl*>(n);
           if (s->renderer() && (s->id() == element->id()) && !s->hasID() &&
               (s->hasClass() == element->hasClass()) && !s->inlineStyleDecl() &&
               (s->hasMappedAttributes() == htmlElement->hasMappedAttributes()) &&
               (s->hasAnchor() == element->hasAnchor()) && 
               !s->renderer()->style()->affectedByAttributeSelectors() &&
  -            (s->renderer()->mouseInside() == mouseInside) &&
  +            (s->hovered() == element->hovered()) &&
               (s->active() == element->active()) &&
               (s->focused() == element->focused())) {
               bool classesMatch = true;
  @@ -1309,7 +1308,7 @@
                       if (e->renderer()) {
                           if (element != e)
                               e->renderer()->style()->setAffectedByHoverRules(true);
  -                        if (e->renderer()->mouseInside())
  +                        if (e->hovered())
                               return true;
                       }
                   }
  @@ -3710,6 +3709,8 @@
   	    case CSS_VAL_TEXT:
   		style->setUserSelect(SELECT_TEXT);
   		break;
  +            case CSS_VAL_ELEMENT:
  +                style->setUserSelect(SELECT_ELEMENT);
   	    default:
   		return;
   	}
  
  
  
  1.68.8.1  +8 -2      WebCore/khtml/css/html4.css
  
  Index: html4.css
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/css/html4.css,v
  retrieving revision 1.68
  retrieving revision 1.68.8.1
  diff -u -r1.68 -r1.68.8.1
  --- html4.css	1 Nov 2004 19:21:24 -0000	1.68
  +++ html4.css	18 Nov 2005 22:46:33 -0000	1.68.8.1
  @@ -311,7 +311,12 @@
   }
   
   input[type="radio"], input[type="checkbox"] {
  -    margin: 3px 0.5ex
  +    margin: 3px 0.5ex;
  +    -khtml-user-select: element
  +}
  +
  +select, button, input[type="button"], input[type="image"], input[type="submit"], input[type="reset"], img {
  +    -khtml-user-select: element
   }
   
   option, optgroup, area, param {
  @@ -386,7 +391,8 @@
   
   a:-khtml-any-link {
       color: -khtml-link;
  -    text-decoration: underline
  +    text-decoration: underline;
  +    -khtml-user-select: element
   }
   
   a:-khtml-any-link:active {
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.94.4.3  +39 -21    WebCore/khtml/rendering/render_layer.cpp
  
  Index: render_layer.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_layer.cpp,v
  retrieving revision 1.94.4.2
  retrieving revision 1.94.4.3
  diff -u -r1.94.4.2 -r1.94.4.3
  --- render_layer.cpp	13 Nov 2005 00:20:02 -0000	1.94.4.2
  +++ render_layer.cpp	18 Nov 2005 22:46:36 -0000	1.94.4.3
  @@ -1106,7 +1106,7 @@
   
       // Now determine if the result is inside an anchor; make sure an image map wins if
       // it already set URLElement and only use the innermost.
  -    DOM::NodeImpl* node = info.innerNode();
  +    NodeImpl* node = info.innerNode();
       while (node) {
           if (node->hasAnchor() && !info.URLElement())
               info.setURLElement(node);
  @@ -1368,16 +1368,43 @@
       if (info.readonly())
           return;
   
  +    DocumentImpl* doc = renderer()->document();
  +    if (!doc) return;
  +
  +    NodeImpl* activeNode = doc->activeNode();
  +    if (activeNode && !info.active()) {
  +        // We are clearing the :active chain because the mouse has been released.
  +        for (RenderObject* curr = activeNode->renderer(); curr; curr = curr->parent()) {
  +            if (curr->element() && !curr->isText())
  +                curr->element()->setInActiveChain(false);
  +        }
  +        doc->setActiveNode(0);
  +    } else {
  +        NodeImpl* newActiveNode = info.innerNode();
  +        if (!activeNode && newActiveNode && info.active()) {
  +            // We are setting the :active chain and freezing it. If future moves happen, they
  +            // will need to reference this chain.
  +            for (RenderObject* curr = newActiveNode->renderer(); curr; curr = curr->parent()) {
  +                if (curr->element() && !curr->isText()) {
  +                    curr->element()->setInActiveChain(true);
  +                }
  +            }
  +            doc->setActiveNode(newActiveNode);
  +        }
  +    }
  +
  +    // If the mouse is down and if this is a mouse move event, we want to restrict changes in 
  +    // :hover/:active to only apply to elements that are in the :active chain that we froze
  +    // at the time the mouse went down.
  +    bool mustBeInActiveChain = info.active() && info.mouseMove();
  +
       // Check to see if the hovered node has changed.  If not, then we don't need to
  -    // do anything.  An exception is if we just went from :hover into :hover:active,
  -    // in which case we need to update to get the new :active state.
  -    DOM::DocumentImpl* doc = renderer()->document();
  -    DOM::NodeImpl* oldHoverNode = doc ? doc->hoverNode() : 0;
  +    // do anything.  
  +    DOM::NodeImpl* oldHoverNode = doc->hoverNode();
       DOM::NodeImpl* newHoverNode = info.innerNode();
   
       // Update our current hover node.
  -    if (doc)
  -        doc->setHoverNode(newHoverNode);
  +    doc->setHoverNode(newHoverNode);
   
       // We have two different objects.  Fetch their renderers.
       RenderObject* oldHoverObj = oldHoverNode ? oldHoverNode->renderer() : 0;
  @@ -1385,31 +1412,22 @@
       
       // Locate the common ancestor render object for the two renderers.
       RenderObject* ancestor = commonAncestor(oldHoverObj, newHoverObj);
  -    
  +
       if (oldHoverObj != newHoverObj) {
           // The old hover path only needs to be cleared up to (and not including) the common ancestor;
           for (RenderObject* curr = oldHoverObj; curr && curr != ancestor; curr = hoverAncestor(curr)) {
  -            curr->setMouseInside(false);
  -            if (curr->element() && !curr->isText()) {
  -                bool oldActive = curr->element()->active();
  +            if (curr->element() && !curr->isText() && (!mustBeInActiveChain || curr->element()->inActiveChain())) {
                   curr->element()->setActive(false);
  -                if (curr->style()->affectedByHoverRules() ||
  -                    (curr->style()->affectedByActiveRules() && oldActive))
  -                    curr->element()->setChanged();
  +                curr->element()->setHovered(false);
               }
           }
       }
   
       // Now set the hover state for our new object up to the root.
       for (RenderObject* curr = newHoverObj; curr; curr = hoverAncestor(curr)) {
  -        bool oldInside = curr->mouseInside();
  -        curr->setMouseInside(true);
  -        if (curr->element() && !curr->isText()) {
  -            bool oldActive = curr->element()->active();
  +        if (curr->element() && !curr->isText() && (!mustBeInActiveChain || curr->element()->inActiveChain())) {
               curr->element()->setActive(info.active());
  -            if ((curr->style()->affectedByHoverRules() && !oldInside) ||
  -                (curr->style()->affectedByActiveRules() && oldActive != info.active()))
  -                curr->element()->setChanged();
  +            curr->element()->setHovered(true);
           }
       }
   }
  
  
  
  1.191.6.2 +0 -9      WebCore/khtml/rendering/render_object.cpp
  
  Index: render_object.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_object.cpp,v
  retrieving revision 1.191.6.1
  retrieving revision 1.191.6.2
  diff -u -r1.191.6.1 -r1.191.6.2
  --- render_object.cpp	13 Nov 2005 00:20:03 -0000	1.191.6.1
  +++ render_object.cpp	18 Nov 2005 22:46:37 -0000	1.191.6.2
  @@ -149,7 +149,6 @@
   m_inline( true ),
   
   m_replaced( false ),
  -m_mouseInside( false ),
   m_isDragging( false ),
   m_hasOverflowClip(false)
   {
  @@ -1321,7 +1320,6 @@
       if (isPositioned()) ts << "ps ";
       if (needsLayout()) ts << "nl ";
       if (m_recalcMinMax) ts << "rmm ";
  -    if (mouseInside()) ts << "mi ";
       if (style() && style()->zIndex()) ts << "zI: " << style()->zIndex();
       if (element() && element()->active()) ts << "act ";
       if (element() && element()->hasAnchor()) ts << "anchor ";
  @@ -1870,13 +1868,6 @@
       return VisiblePosition(element(), caretMinOffset(), DOWNSTREAM);
   }
   
  -bool RenderObject::mouseInside() const
  -{ 
  -    if (!m_mouseInside && continuation()) 
  -        return continuation()->mouseInside();
  -    return m_mouseInside; 
  -}
  -
   bool RenderObject::isDragging() const
   { 
       return m_isDragging; 
  
  
  
  1.147.6.2 +4 -5      WebCore/khtml/rendering/render_object.h
  
  Index: render_object.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_object.h,v
  retrieving revision 1.147.6.1
  retrieving revision 1.147.6.2
  diff -u -r1.147.6.1 -r1.147.6.2
  --- render_object.h	13 Nov 2005 00:20:03 -0000	1.147.6.1
  +++ render_object.h	18 Nov 2005 22:46:39 -0000	1.147.6.2
  @@ -293,7 +293,6 @@
       bool isInline() const { return m_inline; }  // inline object
       bool isCompact() const { return style()->display() == COMPACT; } // compact object
       bool isRunIn() const { return style()->display() == RUN_IN; } // run-in object
  -    bool mouseInside() const;
       bool isDragging() const;
       bool isReplaced() const { return m_replaced; } // a "replaced" element (see CSS)
       bool shouldPaintBackgroundOrBorder() const { return m_paintBackground; }
  @@ -357,7 +356,6 @@
       void setRelPositioned(bool b=true) { m_relPositioned = b; }
       void setFloating(bool b=true) { m_floating = b; }
       void setInline(bool b=true) { m_inline = b; }
  -    void setMouseInside(bool b=true) { m_mouseInside = b; }
       void setShouldPaintBackgroundOrBorder(bool b=true) { m_paintBackground = b; }
       void setRenderText() { m_isText = true; }
       void setReplaced(bool b=true) { m_replaced = b; }
  @@ -485,8 +483,8 @@
           friend class RenderFrameSet;
           friend class DOM::HTMLAreaElementImpl;
       public:
  -        NodeInfo(bool readonly, bool active)
  -            : m_innerNode(0), m_innerNonSharedNode(0), m_innerURLElement(0), m_readonly(readonly), m_active(active)
  +        NodeInfo(bool readonly, bool active, bool mouseMove = false)
  +            : m_innerNode(0), m_innerNonSharedNode(0), m_innerURLElement(0), m_readonly(readonly), m_active(active), m_mouseMove(mouseMove)
               { }
   
           DOM::NodeImpl* innerNode() const { return m_innerNode; }
  @@ -494,6 +492,7 @@
           DOM::NodeImpl* URLElement() const { return m_innerURLElement; }
           bool readonly() const { return m_readonly; }
           bool active() const { return m_active; }
  +        bool mouseMove() const { return m_mouseMove; }
   
       private:
           void setInnerNode(DOM::NodeImpl* n) { m_innerNode = n; }
  @@ -505,6 +504,7 @@
           DOM::NodeImpl* m_innerURLElement;
           bool m_readonly;
           bool m_active;
  +        bool m_mouseMove;
       };
   
       // Used to signal a specific subrect within an object that must be repainted after
  @@ -898,7 +898,6 @@
       bool m_isText                    : 1;
       bool m_inline                    : 1;
       bool m_replaced                  : 1;
  -    bool m_mouseInside               : 1;
       bool m_isDragging                : 1;
       
       bool m_hasOverflowClip           : 1;
  
  
  
  1.80.6.1  +1 -1      WebCore/khtml/rendering/render_style.h
  
  Index: render_style.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_style.h,v
  retrieving revision 1.80
  retrieving revision 1.80.6.1
  diff -u -r1.80 -r1.80.6.1
  --- render_style.h	18 Mar 2005 20:41:58 -0000	1.80
  +++ render_style.h	18 Nov 2005 22:46:40 -0000	1.80.6.1
  @@ -642,7 +642,7 @@
   // CSS3 User Select Values
   
   enum EUserSelect {
  -    SELECT_AUTO, SELECT_NONE, SELECT_TEXT
  +    SELECT_AUTO, SELECT_NONE, SELECT_TEXT, SELECT_ELEMENT
   };
   
   // Word Break Values. Matches WinIE, rather than CSS3
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.211.4.11 +21 -2     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.4.10
  retrieving revision 1.211.4.11
  diff -u -r1.211.4.10 -r1.211.4.11
  --- dom_docimpl.cpp	16 Nov 2005 00:11:03 -0000	1.211.4.10
  +++ dom_docimpl.cpp	18 Nov 2005 22:46:42 -0000	1.211.4.11
  @@ -338,6 +338,7 @@
       m_attrNameCount = 0;
       m_focusNode = 0;
       m_hoverNode = 0;
  +    m_activeNode = 0;
       m_defaultView = new AbstractViewImpl(this);
       m_defaultView->ref();
       m_listenerTypes = 0;
  @@ -416,6 +417,8 @@
           m_focusNode->deref();
       if (m_hoverNode)
           m_hoverNode->deref();
  +    if (m_activeNode)
  +        m_activeNode->deref();
   
       if (m_titleElement)
           m_titleElement->deref();
  @@ -2047,11 +2050,16 @@
       }
   }
   
  -bool DocumentImpl::prepareMouseEvent( bool readonly, int _x, int _y, MouseEvent *ev )
  +bool DocumentImpl::prepareMouseEvent(bool readonly, int x, int y, MouseEvent* ev)
  +{
  +    return prepareMouseEvent(readonly, ev->type == MousePress, x, y, ev);
  +}
  +
  +bool DocumentImpl::prepareMouseEvent(bool readonly, bool active, int _x, int _y, MouseEvent *ev)
   {
       if ( m_render ) {
           assert(m_render->isCanvas());
  -        RenderObject::NodeInfo renderInfo(readonly, ev->type == MousePress);
  +        RenderObject::NodeInfo renderInfo(readonly, active, ev->type == MouseMove);
           bool isInside = m_render->layer()->hitTest(renderInfo, _x, _y);
           ev->innerNode = renderInfo.innerNode();
   
  @@ -2498,6 +2506,17 @@
       }    
   }
   
  +void DocumentImpl::setActiveNode(NodeImpl* newActiveNode)
  +{
  +    if (m_activeNode != newActiveNode) {
  +        if (m_activeNode)
  +            m_activeNode->deref();
  +        m_activeNode = newActiveNode;
  +        if (m_activeNode)
  +            m_activeNode->ref();
  +    }    
  +}
  +
   #if APPLE_CHANGES
   
   bool DocumentImpl::relinquishesEditingFocus(NodeImpl *node)
  
  
  
  1.104.4.8 +6 -1      WebCore/khtml/xml/dom_docimpl.h
  
  Index: dom_docimpl.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/dom_docimpl.h,v
  retrieving revision 1.104.4.7
  retrieving revision 1.104.4.8
  diff -u -r1.104.4.7 -r1.104.4.8
  --- dom_docimpl.h	16 Nov 2005 00:11:04 -0000	1.104.4.7
  +++ dom_docimpl.h	18 Nov 2005 22:46:43 -0000	1.104.4.8
  @@ -390,7 +390,8 @@
       // internal
       NodeImpl *findElement( Id id );
   
  -    bool prepareMouseEvent( bool readonly, int x, int y, MouseEvent *ev );
  +    bool prepareMouseEvent(bool readonly, int x, int y, MouseEvent* ev);
  +    bool prepareMouseEvent(bool readonly, bool active, int x, int y, MouseEvent *ev);
   
       virtual bool childAllowed( NodeImpl *newChild );
       virtual bool childTypeAllowed( unsigned short nodeType );
  @@ -428,6 +429,9 @@
       NodeImpl *hoverNode() const { return m_hoverNode; }
       void setHoverNode(NodeImpl *newHoverNode);
       
  +    NodeImpl *activeNode() const { return m_activeNode; }
  +    void setActiveNode(NodeImpl *newActiveNode);
  +
       // Updates for :target (CSS3 selector).
       void setCSSTarget(NodeImpl* n);
       NodeImpl* getCSSTarget();
  @@ -638,6 +642,7 @@
   
       NodeImpl *m_focusNode;
       NodeImpl *m_hoverNode;
  +    NodeImpl *m_activeNode;
   
       unsigned int m_domtree_version;
       
  
  
  
  1.140.6.4 +14 -0     WebCore/khtml/xml/dom_nodeimpl.cpp
  
  Index: dom_nodeimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/dom_nodeimpl.cpp,v
  retrieving revision 1.140.6.3
  retrieving revision 1.140.6.4
  diff -u -r1.140.6.3 -r1.140.6.4
  --- dom_nodeimpl.cpp	18 Nov 2005 18:27:11 -0000	1.140.6.3
  +++ dom_nodeimpl.cpp	18 Nov 2005 22:46:44 -0000	1.140.6.4
  @@ -2282,6 +2282,20 @@
           setChanged();
   }
   
  +void NodeBaseImpl::setHovered(bool over)
  +{
  +    if (over == hovered()) return;
  +
  +    NodeImpl::setHovered(over);
  +
  +    // note that we need to recalc the style
  +    // FIXME: Move to ElementImpl
  +    if (m_render) {
  +        if (m_render->style()->affectedByHoverRules())
  +            setChanged();
  +    }
  +}
  +
   unsigned long NodeBaseImpl::childNodeCount() const
   {
       unsigned long count = 0;
  
  
  
  1.75.6.4  +7 -0      WebCore/khtml/xml/dom_nodeimpl.h
  
  Index: dom_nodeimpl.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/dom_nodeimpl.h,v
  retrieving revision 1.75.6.3
  retrieving revision 1.75.6.4
  diff -u -r1.75.6.3 -r1.75.6.4
  --- dom_nodeimpl.h	12 Nov 2005 01:31:01 -0000	1.75.6.3
  +++ dom_nodeimpl.h	18 Nov 2005 22:46:45 -0000	1.75.6.4
  @@ -238,6 +238,8 @@
       bool hasClass() const   { return m_hasClass; }
       bool hasStyle() const   { return m_hasStyle; }
       bool active() const     { return m_active; }
  +    bool inActiveChain() const { return m_inActiveChain; }
  +    bool hovered() const { return m_hovered; }
       bool focused() const { return m_focused; }
       bool attached() const   { return m_attached; }
       bool changed() const    { return m_changed; }
  @@ -254,6 +256,8 @@
       void setInDocument(bool b=true) { m_inDocument = b; }
       virtual void setFocus(bool b=true) { m_focused = b; }
       virtual void setActive(bool b=true) { m_active = b; }
  +    void setInActiveChain(bool b=true) { m_inActiveChain = b; }
  +    virtual void setHovered(bool b=true) { m_hovered = b; }
       void setChanged(bool b=true);
   
       unsigned short tabIndex() const { return m_tabIndex; }
  @@ -487,6 +491,8 @@
       bool m_specified : 1; // used in AttrImpl. Accessor functions there
       bool m_focused : 1;
       bool m_active : 1;
  +    bool m_hovered : 1;
  +    bool m_inActiveChain : 1;
       bool m_styleElement : 1; // contains stylesheet text
       bool m_implicit : 1; // implicitely generated by the parser
   
  @@ -530,6 +536,7 @@
   
       virtual void setFocus(bool=true);
       virtual void setActive(bool=true);
  +    virtual void setHovered(bool=true);
       virtual unsigned long childNodeCount() const;
       virtual NodeImpl *childNode(unsigned long index);
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.216.6.1 +3 -0      WebCore/kwq/KWQKHTMLPart.h
  
  Index: KWQKHTMLPart.h
  ===================================================================
  RCS file: /cvs/root/WebCore/kwq/KWQKHTMLPart.h,v
  retrieving revision 1.216
  retrieving revision 1.216.6.1
  diff -u -r1.216 -r1.216.6.1
  --- KWQKHTMLPart.h	26 Feb 2005 01:03:42 -0000	1.216
  +++ KWQKHTMLPart.h	18 Nov 2005 22:46:49 -0000	1.216.6.1
  @@ -385,7 +385,10 @@
       
       DOM::NodeImpl *mousePressNode();
       
  +    virtual bool mouseDownMayStartSelect() const { return _mouseDownMayStartSelect; }
  +    
   private:
  +    bool canMouseDownStartSelect(DOM::NodeImpl* node);
       virtual void khtmlMousePressEvent(khtml::MousePressEvent *);
       virtual void khtmlMouseDoubleClickEvent(khtml::MouseDoubleClickEvent *);
       virtual void khtmlMouseMoveEvent(khtml::MouseMoveEvent *);
  
  
  
  1.628.4.3 +20 -1     WebCore/kwq/KWQKHTMLPart.mm
  
  Index: KWQKHTMLPart.mm
  ===================================================================
  RCS file: /cvs/root/WebCore/kwq/KWQKHTMLPart.mm,v
  retrieving revision 1.628.4.2
  retrieving revision 1.628.4.3
  diff -u -r1.628.4.2 -r1.628.4.3
  --- KWQKHTMLPart.mm	16 Nov 2005 00:24:40 -0000	1.628.4.2
  +++ KWQKHTMLPart.mm	18 Nov 2005 22:46:50 -0000	1.628.4.3
  @@ -1964,13 +1964,32 @@
       return KHTMLPart::closeURL();
   }
   
  +bool KWQKHTMLPart::canMouseDownStartSelect(NodeImpl* node)
  +{
  +    if (!node || !node->renderer())
  +        return true;
  +
  +    // Check to see if khtml-user-select has been set to none
  +    if (!node->renderer()->canSelect())
  +        return false;
  +
  +    // Some controls and images can't start a select on a mouse down.
  +    for (RenderObject* curr = node->renderer(); curr; curr = curr->parent()) {
  +        if (curr->style()->userSelect() == khtml::SELECT_ELEMENT)
  +            return false;
  +    }
  +
  +    return true;
  +}
  +
   void KWQKHTMLPart::khtmlMousePressEvent(MousePressEvent *event)
   {
       bool singleClick = [_currentEvent clickCount] <= 1;
   
       // If we got the event back, that must mean it wasn't prevented,
       // so it's allowed to start a drag or selection.
  -    _mouseDownMayStartSelect = true;
  +    _mouseDownMayStartSelect = canMouseDownStartSelect(event->innerNode().handle());
  +    
       // Careful that the drag starting logic stays in sync with eventMayStartDrag()
       _mouseDownMayStartDrag = singleClick;
   
  
  
  



More information about the webkit-changes mailing list