[Webkit-unassigned] [Bug 120273] Making a focused element invisible should make it blur

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Aug 26 09:58:35 PDT 2013


https://bugs.webkit.org/show_bug.cgi?id=120273


Darin Adler <darin at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #209593|review?, commit-queue?      |review-
               Flag|                            |




--- Comment #6 from Darin Adler <darin at apple.com>  2013-08-26 09:57:58 PST ---
(From update of attachment 209593)
View in context: https://bugs.webkit.org/attachment.cgi?id=209593&action=review

> Source/WebCore/dom/Document.cpp:381
> +// This class should be passed only to Document::postTask.

I don't understand the value of this comment. What other bad thing could someone do with this class. Next time just leave this out. I suspect this entire class will go away, but we if keep it I have a few comments.

> Source/WebCore/dom/Document.cpp:386
> +        return adoptPtr(new CheckFocusedNodeTask());

I suggest omitting the "()" here.

> Source/WebCore/dom/Document.cpp:388
> +    virtual ~CheckFocusedNodeTask() { }

I suggest omitting this entirely. It should be generated.

> Source/WebCore/dom/Document.cpp:391
> +    CheckFocusedNodeTask() { }

Doesn't seem to be valuable to make this private. There would be no harm if someone constructed one of these without using the create function. I suggest just omitting this and letting it be generated.

> Source/WebCore/dom/Document.cpp:395
> +        Document* document = toDocument(context);

I suggest using Document& here instead of Document* since it can’t be null. In newer code in general we are trying to use references for such things.

> Source/WebCore/dom/Document.cpp:401
> +        if (focusedElement->renderer() && focusedElement->renderer()->needsLayout())
> +            return;

This needsLayout check does not make sense. It's not helpful to check if the single renderer has the needs-layout bit set on it. What bug did it fix to check this?

> Source/WebCore/dom/Document.cpp:1885
> +    // FIXME: Using a Task doesn't look a good idea.

Yes, a Task is not a good fix for this. I suggest sharing the updateFocusAppearance timer.

> Source/WebCore/dom/Document.cpp:1889
> +    if (m_focusedElement && !m_didPostCheckFocusedNodeTask) {
> +        postTask(CheckFocusedNodeTask::create());
> +        m_didPostCheckFocusedNodeTask = true;
> +    }

Here’s what I think this code should say:

    if (!m_focusedElement->isFocusable())
        updateFocusAppearanceSoon(false);

Then, inside the updateFocusAppearanceTimerFired function:

        if (element->isFocusable())
            element->updateFocusAppearance(m_updateFocusAppearanceRestoresSelection);
        else
            document->setFocusedElement(0);

Please give that a try and see if there are any problems caused by that approach.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list