WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 49888
Focused <area> should use CSS properties of <area> instead of associated <img>
https://bugs.webkit.org/show_bug.cgi?id=49888
Summary
Focused <area> should use CSS properties of <area> instead of associated <img>
Daniel Bates
Reported
2010-11-21 14:13:39 PST
Currently, when focusing an <area> (say by pressing option + tab in Mac Safari) we use the CSS style information for the <img> associated with the <area>. Instead, we should use the CSS style information for the focused <area>. This will also make the styling behavior of a focused <area> consistent with that of a focused hyperlink. In particular, this will make the outline-color of a focused <area> effect the color of its focus ring. Additional remarks: By default, an HTML Image element is not focusable and an HTML Area element is focusable. As a result of the current behavior the default focus ring color (as specified by CSS pseudo-class :focus in the file WebCore/css/html.css) is not honored for HTML Area elements since we use the style information of the associated <img> when drawing the focus ring for the focused <area>.
Attachments
Patch with test cases
(71.83 KB, patch)
2010-11-21 14:16 PST
,
Daniel Bates
hyatt
: review-
Details
Formatted Diff
Diff
Patch with test cases
(73.43 KB, patch)
2010-11-21 14:51 PST
,
Daniel Bates
no flags
Details
Formatted Diff
Diff
Patch with test cases
(73.62 KB, patch)
2010-11-21 15:45 PST
,
Daniel Bates
hyatt
: review-
Details
Formatted Diff
Diff
Patch with test cases
(119.00 KB, patch)
2010-11-30 13:26 PST
,
Daniel Bates
no flags
Details
Formatted Diff
Diff
Patch with test cases
(160.61 KB, patch)
2010-11-30 13:45 PST
,
Daniel Bates
hyatt
: review+
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
Daniel Bates
Comment 1
2010-11-21 14:16:57 PST
Created
attachment 74516
[details]
Patch with test cases
Daniel Bates
Comment 2
2010-11-21 14:21:34 PST
> Additional remarks: > By default, an HTML Image element is not focusable and an HTML Area element is focusable. As a result of the current behavior the default focus ring color (as specified by CSS pseudo-class :focus in the file WebCore/css/html.css) is not honored for HTML Area elements since we use the style information of the associated <img> when drawing the focus ring for the focused <area>.
I should add that with the current behavior the default focus ring color for a focused <area> is black. Instead, it should be -webkit-focus-ring-color as it is for focused hyperlinks and form controls.
Dave Hyatt
Comment 3
2010-11-21 14:29:36 PST
Comment on
attachment 74516
[details]
Patch with test cases Let's not just make a throwaway render style here. Fix the area element to do the right thing so we can get the style cached. That means implementing: virtual void setRenderStyle(PassRefPtr<RenderStyle>); and virtual RenderStyle* nonRendererRenderStyle() const; Study HTMLOptionElement for an example. This way you want repeatedly request the style every time you paint, since it will get properly cached.
Daniel Bates
Comment 4
2010-11-21 14:51:28 PST
Created
attachment 74517
[details]
Patch with test cases Updated patch based on Dave Hyatt's suggestions.
Eric Seidel (no email)
Comment 5
2010-11-21 15:00:44 PST
Attachment 74517
[details]
did not build on mac: Build output:
http://queues.webkit.org/results/6221121
Eric Seidel (no email)
Comment 6
2010-11-21 15:26:21 PST
Attachment 74517
[details]
did not build on chromium: Build output:
http://queues.webkit.org/results/6134105
Daniel Bates
Comment 7
2010-11-21 15:45:01 PST
Created
attachment 74519
[details]
Patch with test cases Include "NodeRenderStyle.h" in file RenderImage.cpp to fix the Mac Release build.
Dave Hyatt
Comment 8
2010-11-21 17:51:12 PST
Comment on
attachment 74519
[details]
Patch with test cases Actually I thought about this some more, and since Area is a child of Map, you'd have to patch HTMLMapElement also (if the area style depended on proper inheritance from the map style). I think the other caching mechanism, Element::computedStyle(), will work better and result in a smaller patch, since it will properly inherit form HTMLMapElement's computedStyle(). Sorry to make you change things again, but I think removing all the renderStyle() stuff and just calling computedStyle() instead of styleForElement will work better.
Daniel Bates
Comment 9
2010-11-30 13:22:42 PST
(In reply to
comment #8
)
> (From update of
attachment 74519
[details]
) > Actually I thought about this some more, and since Area is a child of Map, you'd have to patch HTMLMapElement also (if the area style depended on proper inheritance from the map style). >
As per section 18.4 "Dynamic outlines: the 'outline' property" of the CSS2.1 spec. <
http://www.w3.org/TR/CSS2/ui.html#dynamic-outlines
>, the outline properties are not inherited.
Daniel Bates
Comment 10
2010-11-30 13:26:05 PST
Created
attachment 75188
[details]
Patch with test cases Updated patch to use computed style. Added additional layout test, fast/images/imagemap-focus-ring-outline-color-not-inherited-from-map.html, to ensure we don't inherit the outline-color property as per section 18.4 of the CSS 2.1 spec.
Daniel Bates
Comment 11
2010-11-30 13:45:28 PST
Created
attachment 75197
[details]
Patch with test cases Added test case fast/images/imagemap-focus-ring-outline-color-explicitly-inherited-from-map.html to test that explicitly inheriting the outline-color works.
Dave Hyatt
Comment 12
2010-11-30 13:46:57 PST
Comment on
attachment 75197
[details]
Patch with test cases r=me
Daniel Bates
Comment 13
2010-11-30 13:57:43 PST
Committed
r72962
: <
http://trac.webkit.org/changeset/72962
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug