RESOLVED WONTFIX 109258
Web Inspector: [CSS Regions] InspectorCSSAgent::getMatchedStylesForNode should consider CSS region styles.
https://bugs.webkit.org/show_bug.cgi?id=109258
Summary Web Inspector: [CSS Regions] InspectorCSSAgent::getMatchedStylesForNode shoul...
Takashi Sakamoto
Reported 2013-02-07 22:08:25 PST
InspectorCSSAgent::getMatchedStylesForNode collects all matched styles for a given node. However, the method doesn't provide any render region parameter for StyleResolver. Writing in detail, - Whether any CSS region styles are obtained or not depends on just StyleResolver's internal state: m_regionForStyling. - m_regionForStyling is updated in StyleResolver::styleForElement by using a given region parameter. - Only RenderRegion::computeStyleInRegion uses styleForElement with a region parameter.
Attachments
Patch (7.81 KB, patch)
2013-02-07 22:16 PST, Takashi Sakamoto
no flags
Patch (7.80 KB, patch)
2013-02-12 00:19 PST, Takashi Sakamoto
no flags
Patch (15.83 KB, patch)
2013-02-12 02:45 PST, Takashi Sakamoto
no flags
Patch (18.07 KB, patch)
2013-02-18 20:49 PST, Takashi Sakamoto
achicu: review-
Takashi Sakamoto
Comment 1 2013-02-07 22:16:42 PST
Andrei Bucur
Comment 2 2013-02-08 02:19:58 PST
Comment on attachment 187238 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=187238&action=review Thanks for this patch! Informally, LGTM :). I've added a few comments. > Source/WebCore/inspector/InspectorCSSAgent.cpp:691 > + RenderFlowThread* flowThread = element->renderer()->enclosingRenderFlowThread(); I would ASSERT flowThread is not-null here. If the inRenderFlowThread bit is set, there should be an enclosingRenderFlowThread available. > Source/WebCore/inspector/InspectorCSSAgent.cpp:699 > + RefPtr<CSSRuleList> matchedRules = styleResolver->styleRulesForElement(element, StyleResolver::AllCSSRules, regionList); So this basically means that we will show all the region style matching rules for the element alongside the rest of the matching rules? I wonder if this can be confusing for the users reading the matching rules list. There could be conflicting rules in the list that don't even apply because the element doesn't flow in the appropriate region of the chain. Another option would be to show only the matching rules for the regions in the region range for that element. The problem is we have this range computed only for blocks.
Build Bot
Comment 3 2013-02-08 03:52:31 PST
Comment on attachment 187238 [details] Patch Attachment 187238 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://queues.webkit.org/results/16432604 New failing tests: compositing/absolute-inside-out-of-view-fixed.html animations/3d/matrix-transform-type-animation.html accessibility/accessibility-node-memory-management.html canvas/philip/tests/2d.canvas.reference.html animations/additive-transform-animations.html
Alexander Pavlov (apavlov)
Comment 4 2013-02-08 04:04:51 PST
Comment on attachment 187238 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=187238&action=review > Source/WebCore/css/StyleResolver.cpp:2096 > +void StyleResolver::collectRulesForStyleRulesForElement(unsigned rulesToInclude, RenderRegion* regionForStyling) Should it be "collectStyleRulesForElement" instead? >> Source/WebCore/inspector/InspectorCSSAgent.cpp:699 >> + RefPtr<CSSRuleList> matchedRules = styleResolver->styleRulesForElement(element, StyleResolver::AllCSSRules, regionList); > > So this basically means that we will show all the region style matching rules for the element alongside the rest of the matching rules? I wonder if this can be confusing for the users reading the matching rules list. There could be conflicting rules in the list that don't even apply because the element doesn't flow in the appropriate region of the chain. Another option would be to show only the matching rules for the regions in the region range for that element. The problem is we have this range computed only for blocks. Agree with Andrei - this will result in the users' confusion. Any further ideas about how to visually represent the data? Ideally, I believe, there should be some API extension - either a boolean flag to this method or an entirely new method.
Takashi Sakamoto
Comment 5 2013-02-12 00:19:33 PST
Takashi Sakamoto
Comment 6 2013-02-12 02:45:24 PST
Takashi Sakamoto
Comment 7 2013-02-12 02:48:49 PST
Comment on attachment 187238 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=187238&action=review Thank you for reviewing. >> Source/WebCore/css/StyleResolver.cpp:2096 >> +void StyleResolver::collectRulesForStyleRulesForElement(unsigned rulesToInclude, RenderRegion* regionForStyling) > > Should it be "collectStyleRulesForElement" instead? I see. Done. >> Source/WebCore/inspector/InspectorCSSAgent.cpp:691 >> + RenderFlowThread* flowThread = element->renderer()->enclosingRenderFlowThread(); > > I would ASSERT flowThread is not-null here. If the inRenderFlowThread bit is set, there should be an enclosingRenderFlowThread available. Done. >>> Source/WebCore/inspector/InspectorCSSAgent.cpp:699 >>> + RefPtr<CSSRuleList> matchedRules = styleResolver->styleRulesForElement(element, StyleResolver::AllCSSRules, regionList); >> >> So this basically means that we will show all the region style matching rules for the element alongside the rest of the matching rules? I wonder if this can be confusing for the users reading the matching rules list. There could be conflicting rules in the list that don't even apply because the element doesn't flow in the appropriate region of the chain. Another option would be to show only the matching rules for the regions in the region range for that element. The problem is we have this range computed only for blocks. > > Agree with Andrei - this will result in the users' confusion. Any further ideas about how to visually represent the data? Ideally, I believe, there should be some API extension - either a boolean flag to this method or an entirely new method. Yes, this new styleRulesForElement collects all the region style matching rules for the element alongside the rest of the matching rules. We will show all the region style matching rules. So I tried "a boolean flag to this method", i.e. added includeRegion to getMatchedStylesForNode.
WebKit Review Bot
Comment 8 2013-02-12 02:49:23 PST
Attachment 187818 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/inspector/styles/get-set-stylesheet-text.html', u'LayoutTests/inspector/styles/styles-new-API.html', u'Source/WebCore/ChangeLog', u'Source/WebCore/css/StyleResolver.cpp', u'Source/WebCore/css/StyleResolver.h', u'Source/WebCore/inspector/Inspector.json', u'Source/WebCore/inspector/InspectorCSSAgent.cpp', u'Source/WebCore/inspector/InspectorCSSAgent.h', u'Source/WebCore/inspector/front-end/CSSStyleModel.js']" exit_code: 1 Source/WebCore/inspector/InspectorCSSAgent.h:111: The parameter name "pseudoIdMatches" adds no information, so it should be removed. [readability/parameter_name] [5] Total errors found: 1 in 10 files If any of these errors are false positives, please file a bug against check-webkit-style.
Build Bot
Comment 9 2013-02-12 12:20:30 PST
Comment on attachment 187818 [details] Patch Attachment 187818 [details] did not pass mac-ews (mac): Output: http://queues.webkit.org/results/16513362 New failing tests: inspector/styles/region-style-crash.html
Build Bot
Comment 10 2013-02-13 01:08:40 PST
Comment on attachment 187818 [details] Patch Attachment 187818 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://queues.webkit.org/results/16537016 New failing tests: inspector/styles/region-style-crash.html
Andrey Adaikin
Comment 11 2013-02-14 05:01:25 PST
Comment on attachment 187818 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=187818&action=review > Source/WebCore/inspector/InspectorCSSAgent.cpp:698 > +#endif #else UNUSED_PARAM(includeRegion);
Takashi Sakamoto
Comment 12 2013-02-18 20:49:04 PST
WebKit Review Bot
Comment 13 2013-02-18 20:54:12 PST
Attachment 188979 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/inspector/styles/get-set-stylesheet-text.html', u'LayoutTests/inspector/styles/styles-new-API.html', u'Source/WebCore/ChangeLog', u'Source/WebCore/css/StyleResolver.cpp', u'Source/WebCore/css/StyleResolver.h', u'Source/WebCore/inspector/Inspector.json', u'Source/WebCore/inspector/InspectorCSSAgent.cpp', u'Source/WebCore/inspector/InspectorCSSAgent.h', u'Source/WebCore/inspector/front-end/CSSStyleModel.js']" exit_code: 1 Source/WebCore/inspector/InspectorCSSAgent.h:113: The parameter name "pseudoIdMatches" adds no information, so it should be removed. [readability/parameter_name] [5] Total errors found: 1 in 10 files If any of these errors are false positives, please file a bug against check-webkit-style.
Takashi Sakamoto
Comment 14 2013-02-18 20:55:11 PST
Comment on attachment 187818 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=187818&action=review Thank you for reviewing. I would like to ask how to test this change. Currently I disabled CSS region support in Source/WebCore/inspector/front-end/CSSStyleModel.js, i.e. needRegion is always false. So no layout test can check whether inspector can obtain matched region styles or not. Should I add one more parameter to getMatchedStylesAsync and change all js and html that use getMatchedStylesAsync? >> Source/WebCore/inspector/InspectorCSSAgent.cpp:698 >> +#endif > > #else > UNUSED_PARAM(includeRegion); Done.
Alexandru Chiculita
Comment 15 2013-05-17 10:04:07 PDT
Comment on attachment 188979 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=188979&action=review Thanks for working on this patch! > Source/WebCore/ChangeLog:12 > + getMatchedStyleForNode should provide a RenderRegionList, which is > + obtained from a given node's render flow thread, for StyleResolver. > + Without this, whether StyleResolver returns CSS region styles or not > + depends on its internal state: regionForStyling. This would probably > + make region-style-crash layout test fail or flaky. I think regionForStyling is reset in the clear() method. Do you have a crash for it? Maybe we should fix just that first. > Source/WebCore/ChangeLog:14 > + No new tests. CSSStyleMode.js always disables obtaining matched region Why not add a test to check the collected rules? > Source/WebCore/css/StyleResolver.cpp:2062 > + if (regionList) { Looks like this part changed recently. There's an ElementRuleCollector allocated on the stack now. > Source/WebCore/css/StyleResolver.h:237 > + PassRefPtr<CSSRuleList> pseudoStyleRulesForElement(Element*, PseudoId, unsigned rulesToInclude = AllButEmptyCSSRules, const RenderRegionList* regionListForStyling = 0); I think pseudo styles are not supported in the region styling @rules. For example, I don't think that :hover would work with region styling at the moment. > Source/WebCore/inspector/InspectorCSSAgent.cpp:729 > +#if ENABLE(CSS_REGIONS) You should not need the ENABLE(CSS_REGIONS) flag. It's only used when parsing CSS properties related to regions. > Source/WebCore/inspector/InspectorCSSAgent.cpp:731 > + if (element->renderer() && element->renderer()->inRenderFlowThread()) { In this case renderer()->inRenderFlowThread() changed to "renderer()->flowThreadState() == RenderObject::InsideOutOfFlowThread". > Source/WebCore/inspector/InspectorCSSAgent.cpp:732 > + RenderFlowThread* flowThread = element->renderer()->enclosingRenderFlowThread(); enclosingRenderFlowThread becomes locateFlowThreadContainingBlock > Source/WebCore/inspector/InspectorCSSAgent.cpp:751 > + nit: remove empty lines.
Timothy Hatcher
Comment 16 2013-05-17 11:17:35 PDT
Comment on attachment 188979 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=188979&action=review > Source/WebCore/inspector/Inspector.json:2412 > + { "name": "includeInherited", "type": "boolean", "optional": true, "description": "Whether to include inherited styles (default: true)." }, > + { "name": "includeRegion", "type": "boolean", "optional": true, "description": "Whether to include region styles (default: true)." } The other optional flags control different results that get passed to the callback. The includeRegion flag does not trigger another parameter in the callback, it just includes region rules in the existing matched lists (I think…) Why does this need to be an option? Why would you want to pass false?
Radar WebKit Bug Importer
Comment 17 2014-08-03 18:41:22 PDT
Brent Fulgham
Comment 18 2022-06-23 13:22:24 PDT
CSS Regions was removed from WebKit. No need for Web Inspector support.
Note You need to log in before you can comment on or make changes to this bug.