Bug 103925

Summary: Style sharing: Allow sharing between elements with classes not referenced by any selectors.
Product: WebKit Reporter: Andreas Kling <kling>
Component: CSSAssignee: Andreas Kling <kling>
Status: RESOLVED FIXED    
Severity: Normal CC: koivisto
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
buildbot: commit-queue-
Patch
none
Patch koivisto: review+, koivisto: commit-queue-

Description Andreas Kling 2012-12-03 14:01:04 PST
<div class="foo"> and <div> should be allowed to share style if there are no style rules with a ".foo" selector.
Comment 1 Andreas Kling 2012-12-03 14:34:41 PST
Created attachment 177334 [details]
Patch
Comment 2 Build Bot 2012-12-03 15:12:30 PST
Comment on attachment 177334 [details]
Patch

Attachment 177334 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/15105660

New failing tests:
compositing/iframes/invisible-nested-iframe-hide.html
css1/basic/class_as_selector.html
compositing/images/clip-on-directly-composited-image.html
canvas/philip/tests/2d.drawImage.negativeSourceHeightAndWidth.html
css1/color_and_background/color.html
css1/box_properties/border_bottom.html
css1/basic/grouping.html
css1/box_properties/border_bottom_width.html
css1/box_properties/border_bottom_width_inline.html
css1/classification/white_space.html
css1/basic/inheritance.html
css1/box_properties/border.html
css1/color_and_background/background_position.html
canvas/philip/tests/2d.drawImage.negativeSourceHeight2.html
canvas/philip/tests/2d.composite.operation.foobar.html
css1/cascade/cascade_order.html
css1/color_and_background/background.html
css1/conformance/forward_compatible_parsing.html
compositing/images/direct-image-background-color.html
css1/color_and_background/background_color.html
css1/basic/containment.html
canvas/philip/tests/2d.clearRect+fillRect.alpha0.5.html
css1/basic/comments.html
css1/color_and_background/background_repeat.html
css1/font_properties/font.html
compositing/color-matching/image-color-matching.html
canvas/philip/tests/2d.clearRect+fillRect.basic.html
css1/classification/display.html
canvas/philip/tests/2d.drawImage.negativeSourceHeight.html
css1/classification/list_style_type.html
Comment 3 Andreas Kling 2012-12-04 19:03:28 PST
Created attachment 177646 [details]
Patch
Comment 4 Andreas Kling 2012-12-04 19:04:23 PST
Created attachment 177647 [details]
Patch
Comment 5 Antti Koivisto 2012-12-04 19:36:50 PST
Comment on attachment 177647 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=177647&action=review

> Source/WebCore/css/StyleResolver.cpp:967
> +        m_elementAffectedByClassRules = m_element && m_element->hasClass() && classNamesAffectedByRules(m_element->classNames());

We should really factor the style sharing code differently so using StyleResolver member for passing things around wouldn't be needed. Better done separately though.
Comment 6 Antti Koivisto 2012-12-04 19:46:28 PST
Comment on attachment 177647 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=177647&action=review

>> Source/WebCore/css/StyleResolver.cpp:967
>>          m_elementLinkState = m_checker.determineLinkState(m_element);
>> +        m_elementAffectedByClassRules = m_element && m_element->hasClass() && classNamesAffectedByRules(m_element->classNames());
> 
> We should really factor the style sharing code differently so using StyleResolver member for passing things around wouldn't be needed. Better done separately though.

This should probably be set in locateSharedStyle instead of initElement. That's the only case where it is needed.
Comment 7 Andreas Kling 2012-12-04 20:10:22 PST
Committed r136615: <http://trac.webkit.org/changeset/136615>