[webkit-reviews] review denied: [Bug 120273] Making a focused element invisible should make it blur : [Attachment 209593] Patch

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


Darin Adler <darin at apple.com> has denied Arunprasad Rajkumar
<arurajku at cisco.com>'s request for review:
Bug 120273: Making a focused element invisible should make it blur
https://bugs.webkit.org/show_bug.cgi?id=120273

Attachment 209593: Patch
https://bugs.webkit.org/attachment.cgi?id=209593&action=review

------- Additional Comments from Darin Adler <darin at apple.com>
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.


More information about the webkit-reviews mailing list