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

David hyatt at opensource.apple.com
Fri Jul 29 16:02:46 PDT 2005


hyatt       05/07/29 16:02:46

  Modified:    .        ChangeLog
               khtml    khtml_part.cpp khtml_part.h khtmlview.cpp
               khtml/css cssparser.cpp cssstyleselector.cpp html4.css
               khtml/rendering render_layer.cpp render_object.cpp
                        render_object.h render_style.h
               khtml/xml dom_docimpl.cpp dom_docimpl.h dom_nodeimpl.cpp
                        dom_nodeimpl.h
               kwq      KWQKHTMLPart.h KWQKHTMLPart.mm
  Log:
  Commit log editor still busted for me, have to commit like this.
  
  Revision  Changes    Path
  1.4497    +67 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.4496
  retrieving revision 1.4497
  diff -u -r1.4496 -r1.4497
  --- ChangeLog	29 Jul 2005 22:50:44 -0000	1.4496
  +++ ChangeLog	29 Jul 2005 23:02:37 -0000	1.4497
  @@ -1,3 +1,70 @@
  +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-07-29  Justin Garcia  <justin.garcia at apple.com>
   
           Reviewed by geoff
  
  
  
  1.332     +19 -21    WebCore/khtml/khtml_part.cpp
  
  Index: khtml_part.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/khtml_part.cpp,v
  retrieving revision 1.331
  retrieving revision 1.332
  diff -u -r1.331 -r1.332
  --- khtml_part.cpp	29 Jul 2005 21:22:14 -0000	1.331
  +++ khtml_part.cpp	29 Jul 2005 23:02:41 -0000	1.332
  @@ -2501,7 +2501,7 @@
       d->m_selection = s;
       if (!s.isNone())
           setFocusNodeIfNeeded();
  -
  +    
       selectionLayoutChanged();
   
       // Always clear the x position used for vertical arrow navigation.
  @@ -4588,7 +4588,7 @@
   {
       Selection selection;
   
  -    if (innerNode && innerNode->renderer() && innerNode->renderer()->shouldSelect()) {
  +    if (innerNode && innerNode->renderer() && mouseDownMayStartSelect() && innerNode->renderer()->shouldSelect()) {
           VisiblePosition pos(innerNode->renderer()->positionForCoordinates(x, y));
           if (pos.isNotNull()) {
               selection.moveTo(pos);
  @@ -4626,24 +4626,22 @@
       QMouseEvent *mouse = event->qmouseEvent();
       NodeImpl *innerNode = event->innerNode();
       
  -    Selection selection;
  -    
       if (mouse->button() == LeftButton && innerNode && innerNode->renderer() &&
  -        innerNode->renderer()->shouldSelect()) {
  +        mouseDownMayStartSelect() && innerNode->renderer()->shouldSelect()) {
  +        Selection selection;
           VisiblePosition pos(innerNode->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)
  @@ -4652,10 +4650,10 @@
       NodeImpl *innerNode = event->innerNode();
       
       if (mouse->button() == LeftButton) {
  -        Selection sel;
  -
           if (innerNode && innerNode->renderer() &&
  -            innerNode->renderer()->shouldSelect()) {
  +            mouseDownMayStartSelect() && innerNode->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());
   
  @@ -4692,10 +4690,10 @@
                   sel = Selection(visiblePos);
                   d->m_selectionGranularity = CHARACTER;
               }
  +            
  +            setSelection(sel);
  +            startAutoScroll();
           }
  -
  -        setSelection(sel);
  -        startAutoScroll();
       }
   }
   
  @@ -4881,7 +4879,7 @@
       NodeImpl *innerNode = event->innerNode();
   
       if (mouse->state() != LeftButton || !innerNode || !innerNode->renderer() ||
  -        !innerNode->renderer()->shouldSelect())
  +        !mouseDownMayStartSelect() || !innerNode->renderer()->shouldSelect())
       	return;
   
       // handle making selection
  @@ -4965,7 +4963,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.135     +2 -0      WebCore/khtml/khtml_part.h
  
  Index: khtml_part.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/khtml_part.h,v
  retrieving revision 1.134
  retrieving revision 1.135
  diff -u -r1.134 -r1.135
  --- khtml_part.h	28 Jul 2005 20:47:24 -0000	1.134
  +++ khtml_part.h	29 Jul 2005 23:02:41 -0000	1.135
  @@ -1327,6 +1327,8 @@
     // 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; }
  +
     void handleFallbackContent();
   
   private:
  
  
  
  1.137     +3 -2      WebCore/khtml/khtmlview.cpp
  
  Index: khtmlview.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/khtmlview.cpp,v
  retrieving revision 1.136
  retrieving revision 1.137
  diff -u -r1.136 -r1.137
  --- khtmlview.cpp	18 Jul 2005 21:52:14 -0000	1.136
  +++ khtmlview.cpp	29 Jul 2005 23:02:41 -0000	1.137
  @@ -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;
  
  
  
  1.102     +1 -1      WebCore/khtml/css/cssparser.cpp
  
  Index: cssparser.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/css/cssparser.cpp,v
  retrieving revision 1.101
  retrieving revision 1.102
  diff -u -r1.101 -r1.102
  --- cssparser.cpp	19 Jul 2005 00:02:07 -0000	1.101
  +++ cssparser.cpp	29 Jul 2005 23:02:42 -0000	1.102
  @@ -1066,7 +1066,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.197     +4 -3      WebCore/khtml/css/cssstyleselector.cpp
  
  Index: cssstyleselector.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/css/cssstyleselector.cpp,v
  retrieving revision 1.196
  retrieving revision 1.197
  diff -u -r1.196 -r1.197
  --- cssstyleselector.cpp	28 Jul 2005 23:27:12 -0000	1.196
  +++ cssstyleselector.cpp	29 Jul 2005 23:02:42 -0000	1.197
  @@ -607,14 +607,13 @@
   bool CSSStyleSelector::canShareStyleWithElement(NodeImpl* n)
   {
       if (n->isStyledElement()) {
  -        bool mouseInside = element->renderer() ? element->renderer()->mouseInside() : false;
           StyledElementImpl* s = static_cast<StyledElementImpl*>(n);
           if (s->renderer() && (s->tagName() == element->tagName()) && !s->hasID() &&
               (s->hasClass() == element->hasClass()) && !s->inlineStyleDecl() &&
               (s->hasMappedAttributes() == styledElement->hasMappedAttributes()) &&
               (s->isLink() == element->isLink()) && 
               !s->renderer()->style()->affectedByAttributeSelectors() &&
  -            (s->renderer()->mouseInside() == mouseInside) &&
  +            (s->hovered() == element->hovered()) &&
               (s->active() == element->active()) &&
               (s->focused() == element->focused())) {
               bool classesMatch = true;
  @@ -1300,7 +1299,7 @@
                       if (e->renderer()) {
                           if (element != e)
                               e->renderer()->style()->setAffectedByHoverRules(true);
  -                        if (e->renderer()->mouseInside())
  +                        if (e->hovered())
                               return true;
                       }
                   }
  @@ -3742,6 +3741,8 @@
   	    case CSS_VAL_TEXT:
   		style->setUserSelect(SELECT_TEXT);
   		break;
  +            case CSS_VAL_ELEMENT:
  +                style->setUserSelect(SELECT_ELEMENT);
   	    default:
   		return;
   	}
  
  
  
  1.71      +8 -2      WebCore/khtml/css/html4.css
  
  Index: html4.css
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/css/html4.css,v
  retrieving revision 1.70
  retrieving revision 1.71
  diff -u -r1.70 -r1.71
  --- html4.css	20 Jul 2005 00:45:48 -0000	1.70
  +++ html4.css	29 Jul 2005 23:02:42 -0000	1.71
  @@ -307,7 +307,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 {
  @@ -390,7 +395,8 @@
   
   a:-khtml-any-link {
       color: -khtml-link;
  -    text-decoration: underline
  +    text-decoration: underline;
  +    -khtml-user-select: element
   }
   
   a:-khtml-any-link:active {
  
  
  
  1.101     +39 -25    WebCore/khtml/rendering/render_layer.cpp
  
  Index: render_layer.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_layer.cpp,v
  retrieving revision 1.100
  retrieving revision 1.101
  diff -u -r1.100 -r1.101
  --- render_layer.cpp	29 Jul 2005 02:40:40 -0000	1.100
  +++ render_layer.cpp	29 Jul 2005 23:02:43 -0000	1.101
  @@ -985,7 +985,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->isLink() && !info.URLElement())
               info.setURLElement(node);
  @@ -1247,16 +1247,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;
  @@ -1264,35 +1291,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();
  -                if (curr && curr->style()->hasAppearance())
  -                    theme()->stateChanged(renderer(), HoverState);
  +                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();
  -            if (curr && curr->style()->hasAppearance() && !oldInside)
  -                theme()->stateChanged(renderer(), HoverState);
  +            curr->element()->setHovered(true);
           }
       }
   }
  
  
  
  1.202     +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.201
  retrieving revision 1.202
  diff -u -r1.201 -r1.202
  --- render_object.cpp	27 Jul 2005 01:12:28 -0000	1.201
  +++ render_object.cpp	29 Jul 2005 23:02:43 -0000	1.202
  @@ -149,7 +149,6 @@
   m_inline( true ),
   
   m_replaced( false ),
  -m_mouseInside( false ),
   m_isDragging( false ),
   m_hasOverflowClip(false)
   {
  @@ -1326,7 +1325,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()->isLink()) ts << "anchor ";
  @@ -1881,13 +1879,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.152     +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.151
  retrieving revision 1.152
  diff -u -r1.151 -r1.152
  --- render_object.h	5 Jul 2005 23:21:12 -0000	1.151
  +++ render_object.h	29 Jul 2005 23:02:43 -0000	1.152
  @@ -294,7 +294,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; }
  @@ -358,7 +357,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; }
  @@ -486,8 +484,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; }
  @@ -495,6 +493,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; }
  @@ -506,6 +505,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
  @@ -897,7 +897,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.87      +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.86
  retrieving revision 1.87
  diff -u -r1.86 -r1.87
  --- render_style.h	27 Jul 2005 01:12:28 -0000	1.86
  +++ render_style.h	29 Jul 2005 23:02:43 -0000	1.87
  @@ -654,7 +654,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
  
  
  
  1.241     +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.240
  retrieving revision 1.241
  diff -u -r1.240 -r1.241
  --- dom_docimpl.cpp	21 Jul 2005 04:10:54 -0000	1.240
  +++ dom_docimpl.cpp	29 Jul 2005 23:02:44 -0000	1.241
  @@ -348,6 +348,7 @@
       m_attrNameCount = 0;
       m_focusNode = 0;
       m_hoverNode = 0;
  +    m_activeNode = 0;
       m_defaultView = new AbstractViewImpl(this);
       m_defaultView->ref();
       m_listenerTypes = 0;
  @@ -425,6 +426,8 @@
           m_focusNode->deref();
       if (m_hoverNode)
           m_hoverNode->deref();
  +    if (m_activeNode)
  +        m_activeNode->deref();
   
       if (m_titleElement)
           m_titleElement->deref();
  @@ -1816,11 +1819,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.reset(renderInfo.innerNode());
   
  @@ -2098,6 +2106,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.121     +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.120
  retrieving revision 1.121
  diff -u -r1.120 -r1.121
  --- dom_docimpl.h	21 Jul 2005 04:10:54 -0000	1.120
  +++ dom_docimpl.h	29 Jul 2005 23:02:44 -0000	1.121
  @@ -384,7 +384,8 @@
       void resetVisitedLinkColor();
       void resetActiveLinkColor();
       
  -    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 );
  @@ -408,6 +409,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();
  @@ -615,6 +619,7 @@
   
       NodeImpl *m_focusNode;
       NodeImpl *m_hoverNode;
  +    NodeImpl *m_activeNode;
   
       unsigned int m_domtree_version;
       
  
  
  
  1.163     +16 -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.162
  retrieving revision 1.163
  diff -u -r1.162 -r1.163
  --- dom_nodeimpl.cpp	29 Jul 2005 02:40:41 -0000	1.162
  +++ dom_nodeimpl.cpp	29 Jul 2005 23:02:44 -0000	1.163
  @@ -2312,6 +2312,22 @@
       }
   }
   
  +void ContainerNodeImpl::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();
  +        if (renderer() && renderer()->style()->hasAppearance())
  +            theme()->stateChanged(renderer(), HoverState);
  +    }
  +}
  +
   unsigned long ContainerNodeImpl::childNodeCount() const
   {
       unsigned long count = 0;
  
  
  
  1.92      +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.91
  retrieving revision 1.92
  diff -u -r1.91 -r1.92
  --- dom_nodeimpl.h	28 Jul 2005 23:27:14 -0000	1.91
  +++ dom_nodeimpl.h	29 Jul 2005 23:02:44 -0000	1.92
  @@ -217,6 +217,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; }
  @@ -233,6 +235,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; }
  @@ -480,6 +484,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
   
  @@ -517,6 +523,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);
   
  
  
  
  1.224     +3 -0      WebCore/kwq/KWQKHTMLPart.h
  
  Index: KWQKHTMLPart.h
  ===================================================================
  RCS file: /cvs/root/WebCore/kwq/KWQKHTMLPart.h,v
  retrieving revision 1.223
  retrieving revision 1.224
  diff -u -r1.223 -r1.224
  --- KWQKHTMLPart.h	14 Jul 2005 00:26:04 -0000	1.223
  +++ KWQKHTMLPart.h	29 Jul 2005 23:02:45 -0000	1.224
  @@ -386,7 +386,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.655     +21 -1     WebCore/kwq/KWQKHTMLPart.mm
  
  Index: KWQKHTMLPart.mm
  ===================================================================
  RCS file: /cvs/root/WebCore/kwq/KWQKHTMLPart.mm,v
  retrieving revision 1.654
  retrieving revision 1.655
  diff -u -r1.654 -r1.655
  --- KWQKHTMLPart.mm	29 Jul 2005 02:42:31 -0000	1.654
  +++ KWQKHTMLPart.mm	29 Jul 2005 23:02:45 -0000	1.655
  @@ -138,6 +138,7 @@
   using khtml::RenderWidget;
   using khtml::RightWordIfOnBoundary;
   using khtml::Selection;
  +using khtml::SELECT_ELEMENT;
   using khtml::setEnd;
   using khtml::setStart;
   using khtml::ShadowData;
  @@ -2002,13 +2003,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() == 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());
  +    
       // Careful that the drag starting logic stays in sync with eventMayStartDrag()
       _mouseDownMayStartDrag = singleClick;
   
  
  
  



More information about the webkit-changes mailing list