This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 220925 - Rule editor (CSS Styles) is repopulated with different rule from Styles after modifications
Summary: Rule editor (CSS Styles) is repopulated with different rule from Styles after...
Status: VERIFIED FIXED
Alias: None
Product: web
Classification: Unclassified
Component: Inspection (show other bugs)
Version: 7.3
Hardware: All All
: P2 normal (vote)
Assignee: Jan Stola
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-26 13:49 UTC by Vladimir Riha
Modified: 2012-11-02 12:53 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Riha 2012-10-26 13:49:50 UTC
To reproduce:

CSS file (linked from HTML file):
h1{
    font-size: 23px;
}

h1, h2, h3, h4, h5, h6 {
    margin: 1em auto;
    color: mediumspringgreen;
    font-family: "Georgia", "Times New Roman", serif;
    font-weight: inherit;}
h1 a, h2 a, h3 a, h4 a, h5 a, h6 a { font-weight: inherit; }

HTML:
...
<h1>Some title</h1>
...


- now open the HTML file in editor and run it in Chrome
- select the title using Inspect Mode
- CSS Styles is populated, you can see 2 rules in "Styles" - h1 and the compound one
- select the 2nd one (should be the simple h1 rule)
- edit e.g. color - simply use mouse to select value from list and click on item to confirm it
- for a brief moment, the 1st rule is used to populated "Rule Editor part of the window"

=> selected property focus is lost (so e.g. up/down buttons to modify value does not work) and the flickering is a bit confusing


Product Version: NetBeans IDE Dev (Build 201210260001)
Java: 1.7.0_10-ea; Java HotSpot(TM) Client VM 23.6-b04
Runtime: Java(TM) SE Runtime Environment 1.7.0_10-ea-b11
System: Linux version 3.2.0-31-generic-pae running on i386; UTF-8; en_US (nb)
Comment 1 Vladimir Riha 2012-10-26 13:56:38 UTC
It happens also if I modify first rule in CSS Styles, then for a moment 2nd rule is displayed so I'm not sure what defines the order
Comment 2 Marek Fukala 2012-10-31 18:20:05 UTC
fixed by 

changeset:   237871:468d3c9ce8a5
summary:     fixing livecycle of the CssStylesPanelProviders' component; propagating the panel's lookups to the CssStyles TopComponent
Comment 3 Vladimir Riha 2012-11-01 08:06:18 UTC
I'm sorry, still reproducible (changeset should be already in 9062)


Product Version: NetBeans IDE Dev (Build web-main-9067-on-20121101)
Java: 1.7.0_10-ea; Java HotSpot(TM) Client VM 23.6-b04
Runtime: Java(TM) SE Runtime Environment 1.7.0_10-ea-b11
System: Linux version 3.2.0-31-generic-pae running on i386; UTF-8; en_US (nb)
Comment 4 Marek Fukala 2012-11-01 09:47:48 UTC
Honzo, I'm afraid you'll have to take over this issue as I cannot spot all the aspects of CSSStylesPanel's behavior - for example the updateContent(boolean) method already contains some non-obvious hacky code.

I believe I've fixed all the regressions of the css styles+RE merge yesterday so it is likely the issue belong to you anyway.

Here is a log from the RE: as you can see the CSSStylesPanel changes the active rule several times, first the correct one, the incorrect one and then the correct one again:

FINE [rule.editor]: updating property to medium
INFO [org.netbeans.modules.css.model.api.Model]: Model:15, snapshot=740269, file=style.css, saved=true: changes applied to document
INFO [rule.editor]: Model.CHANGES_APPLIED_TO_DOCUMENT event handler - setting new model Model:17, snapshot=17136865, file=style.css, saved=false
FINE [rule.editor]: set new model (Model:17, snapshot=17136865, file=style.css, saved=false)
FINE [rule.editor]: set new rule (Rule(model=Model:17, snapshot=17136865, file=style.css, saved=false,sihc=17515099,type=source[ofs=0-28;line=1-3]))
FINE [rule.editor]: setModel(Model:17, snapshot=17136865, file=style.css, saved=false) called by org.netbeans.modules.web.inspect.webkit.ui.CSSStylesPanel$RuleEditorTask$1.run(CSSStylesPanel.java:415)
FINE [rule.editor]: setRule(Rule(model=Model:17, snapshot=17136865, file=style.css, saved=false,sihc=23784522,type=source[ofs=30-187;line=5-9])) called by org.netbeans.modules.web.inspect.webkit.ui.CSSStylesPanel$RuleEditorTask$1.run(CSSStylesPanel.java:416)
FINE [rule.editor]: attempt to set the same model
FINE [rule.editor]: set new rule (Rule(model=Model:17, snapshot=17136865, file=style.css, saved=false,sihc=23784522,type=source[ofs=30-187;line=5-9]))
FINE [rule.editor]: setModel(Model:17, snapshot=17136865, file=style.css, saved=false) called by org.netbeans.modules.web.inspect.webkit.ui.CSSStylesPanel$RuleEditorTask$1.run(CSSStylesPanel.java:415)
FINE [rule.editor]: setRule(Rule(model=Model:17, snapshot=17136865, file=style.css, saved=false,sihc=17515099,type=source[ofs=0-28;line=1-3])) called by org.netbeans.modules.web.inspect.webkit.ui.CSSStylesPanel$RuleEditorTask$1.run(CSSStylesPanel.java:416)
FINE [rule.editor]: setModel(Model:17, snapshot=17136865, file=style.css, saved=false) called by org.netbeans.modules.web.inspect.webkit.ui.CSSStylesPanel$RuleEditorTask$1.run(CSSStylesPanel.java:415)
FINE [rule.editor]: setRule(Rule(model=Model:17, snapshot=17136865, file=style.css, saved=false,sihc=17515099,type=source[ofs=0-28;line=1-3])) called by org.netbeans.modules.web.inspect.webkit.ui.CSSStylesPanel$RuleEditorTask$1.run(CSSStylesPanel.java:416)
FINE [rule.editor]: attempt to set the same model
FINE [rule.editor]: set new rule (Rule(model=Model:17, snapshot=17136865, file=style.css, saved=false,sihc=17515099,type=source[ofs=0-28;line=1-3]))
FINE [rule.editor]: attempt to set the same model
FINE [rule.editor]: attempt to set the same rule
FINE [rule.editor]: not a css file and rule not found at 328 offset, exiting w/o change of the RuleEditor
FINE [rule.editor]: not a css file and rule not found at 328 offset, exiting w/o change of the RuleEditor
Comment 5 Jan Stola 2012-11-01 14:24:35 UTC
I was able to reproduce the flickering and I fixed its root (eager update of Styles section when a selection in Property Summary is restored after refresh of its content - triggered by reload of CSS file in the browser).

Modified file: http://hg.netbeans.org/web-main/rev/b8c908beba00
Comment 6 Vladimir Riha 2012-11-01 14:51:36 UTC
Thanks, I'll try it asap with webmain build
Comment 7 Vladimir Riha 2012-11-01 15:52:52 UTC
This issue is really fixed, but it seems that it may cause issue 219493 more often if you try to edit some css while the css file is not opened in IDE. If the css file is opened, it works fine.


I would be for transplanting to beta2 anyway, workaround for 219493 is to either open css file or not to edit css in editor and then in Rule Editor




Product Version: NetBeans IDE Dev (Build web-main-9074-on-20121101)
Java: 1.7.0_10-ea; Java HotSpot(TM) Client VM 23.6-b04
Runtime: Java(TM) SE Runtime Environment 1.7.0_10-ea-b11
System: Linux version 3.2.0-31-generic-pae running on i386; UTF-8; en_US (nb)
Comment 8 Jan Stola 2012-11-01 16:28:43 UTC
Transplanted into release73_beta2 branch:
http://hg.netbeans.org/releases/rev/b178e0ceebb3
Comment 9 Vladimir Riha 2012-11-02 12:29:17 UTC
verified in beta2

Product Version: NetBeans IDE 7.3 Beta 2 (Build 201211020750)
Java: 1.7.0_10-ea; Java HotSpot(TM) Client VM 23.6-b04
Runtime: Java(TM) SE Runtime Environment 1.7.0_10-ea-b11
System: Linux version 3.2.0-31-generic-pae running on i386; UTF-8; en_US (nb)