[Webkit-unassigned] [Bug 110895] Focus ring for a child composited layer is incorrectly offset by parent layer's position

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Feb 27 10:07:31 PST 2013


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





--- Comment #6 from Xianzhu Wang <wangxianzhu at chromium.org>  2013-02-27 10:09:54 PST ---
(In reply to comment #5)
> Outlines are specified in CSS 2.1 [1] and also CSS 3 UI [2]. We definitely want to follow what the specifications are saying, not what we believe 'outline' should be. If other browsers don't match our behavior, we should get the specification updated to match the consensus.
> 
> Relevant bits:
> 
> * "Outlines may be non-rectangular." (note that this is a MAY which makes our implementation using rects compliant)
> * "By default, the outline is drawn starting just outside the border edge. However, it is possible to offset the outline and draw it beyond the border edge."
> * "For example, if the element is broken across several lines, the outline should be an outline or minimum set of outlines that encloses all the element's boxes."
> 
> [1] http://www.w3.org/TR/CSS21/ui.html#dynamic-outlines
> [2] http://dev.w3.org/csswg/css3-ui/#outline-properties

It only mentions the multiple-line case. The second half of the sentence seems to cover the overflow case but looks unclear. In our current code, the cases are in different code paths.

Another issue is, our behaviors for 'auto' and non-'auto' outlines are different. The former draws outlines of overflowed sub-elements, but the latter draws only a single rectangle enclosing the element itself only.

Tried other browsers:
- Firefox (19.0). a single rectangle enclosing the the element and its sub-elements when outline-style!=auto. Doesn't support 'auto'.
- IE9: a single rectangle enclosing the element only when outline-style!=auto. Doesn't support 'auto'.

IE9 is same as WebKit when outline-style!=auto.

For real focus ring (when an element is really focused):
- Firefox: same as outline, using dotted black and white outline style.
- 

Putting aside transformations, the issue is caused by the following lines in RenderBlock::addFocusRingRects():

                if (box->layer())
                    pos = curr->localToAbsolute();
                else
                    pos = FloatPoint(additionalOffset.x() + box->x(), additionalOffset.y() + box->y());
                box->addFocusRingRects(rects, flooredLayoutPoint(pos));

RenderObject::paintFocusRing() expects that the rects are in coordinates of current paint (in the case, coordinates of the outer GraphicsLayer). However, the above code will use the absolute coordinates of the inner layer, so the focus ring for the inner layer will be offset by the origin of the outer layer. This happens only when the inner layer is a sub-element of the element wanting the focus ring.

I tried to remove the 'if' part leaving only the 'else' part, and the focus ring will be at correct position (for the test case). Do you think this is a correct fix?

-- 
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