issue parsing complex background expression

19 views
Skip to first unread message

bmc

unread,
Sep 17, 2010, 3:09:29 PM9/17/10
to ModelText
I am very interested in this project, I'm just playing with it right
now and am getting a NotImplementedException doing the following:

string css = @"
#somediv{
margin: 10px;
padding: 10px 20px;
border:5px solid red;
}

p {
background-color: blue;
}

.someClass
{
background:#ffffff url('img_tree.png') no-repeat right
top;
}";

ICssStylesheetData stylesheet =
CssDataFactory.parseStylesheet(css);
List<ICssRulesetData> rulesets =
stylesheet.getRulesets(CssDataFactory.defaultMedium);

I seem to be able to narrow it down to the background expression.
Does your parse not support these kinds of expressions yet?

Thanks.

Christopher Wells

unread,
Sep 21, 2010, 10:12:53 AM9/21/10
to ModelText, bmc
Hi Brendan,

Thank you for your interest in this project, and for your bug report.

I confirm that the NotImplementedException is from the function-like
expression "url('img_tree.png')".

I hope to fix that for you within the next few days, if that's
alright.

Regards,
Chris.

Tim

unread,
Sep 22, 2010, 1:22:53 AM9/22/10
to ModelText
Hi Chris,

I'd like to see url handling implemented! (asap ;-) )

Here's how I'm looking to utilise your library:
#1. Use Firefox Gecko engine to get page structure + computed styles
of each element - this is being done to get the calculated absolute
positions of each element as rendered, no simple task as you know.
#2. Have ModelText parse the styles of each element so I don't have to
build helper classes to do it. Since I already have the calculated
style of the element, I don't need ModelText to figure it out.

(btw, your obfuscation makes it painful to do step by step debugging,
please consider removing it from property/field names)

To do #2, I've built a string representing a ruleset, and then call
CssDataFactory.parseStylesheet.
I wanted to use CssDataFactory.parseDeclarations, but I don't seem to
get access to the use ICssDeclarationData.

parseStyleSheet fails with a token error if the ruleset is empty i.e.
h1 { }.

See any problems with my approach?

Nice library, looking at Css has shown how truly complex the model
is. Would be keen to assist in the ongoing development e.g. feedback,
ideas etc.
I'm developing a framework to generate other representations of html
e.g. html -> mockups

Cheers,
Tim

Christopher Wells

unread,
Sep 22, 2010, 12:48:54 PM9/22/10
to ModelText
Brendan, Tim,

I have uploaded a newer version of the component to the web site. This
version includes three fixes:

* Support for functions like url('filename')
* Support for functions like rgb(0,0,0) and/or rgb(50%,50%,50%)
* Support for an empty set of declarations in a ruleset

I also updated the sample program (which is included with the
download) to demonstrate accessing these kinds of value.

Regards,
Christopher.
> > Thanks.- Hide quoted text -
>
> - Show quoted text -

Tim

unread,
Sep 22, 2010, 4:52:11 PM9/22/10
to ModelText
Hi Christopher,

Awesome, works well for my scenario except for the need to handle
rgba(r,g,b,a) as per my email.

What I have started experiencing though is a random .net Fatal
Execution Engine Error in my test app since I started playing with
ModelText yesterday.
Never experienced it before. Can't replicate it when I want to. If I
can narrow it down and think it is caused by ModelText I'll provide
the info here. Most probably XULRunner.

Running .net 4.0 on Win7 x64 (but forcing assemblies as x86 to work
with Mozilla XULRunner). Interesting discussion on it here -
http://stackoverflow.com/questions/2823440/troubleshooting-net-fatal-execution-engine-error

I'm sure I'll have plenty of feedback once I've used it more
extensively and have a better idea of what I need.

Cheers,
Tim

Christopher Wells

unread,
Sep 23, 2010, 3:42:46 AM9/23/10
to ModelText, Tim
Tim,

That StackOverflow discussion says that that exception implies
corruption in the managed heap, which it says is probably caused by a
bug in unmanaged code, and not caused by managed code nor by a bug in
the CLR.

That suggests that the exception wouldn't be caused by the ModelText
CSS component: which is 100% managed code, with no PInvoke etc.

Regards,
Christopher.


On Sep 22, 10:52 pm, Tim <tshnai...@gmail.com> wrote:
> Hi Christopher,
>
> Awesome, works well for my scenario except for the need to handle
> rgba(r,g,b,a) as per my email.
>
> What I have started experiencing though is a random .net Fatal
> Execution Engine Error in my test app since I started playing with
> ModelText yesterday.
> Never experienced it before.  Can't replicate it when I want to.  If I
> can narrow it down and think it is caused by ModelText I'll provide
> the info here.   Most probably XULRunner.
>
> Running .net 4.0 on Win7 x64 (but forcing assemblies as x86 to work
> with Mozilla XULRunner).  Interesting discussion on it here -http://stackoverflow.com/questions/2823440/troubleshooting-net-fatal-...
> > > - Show quoted text -- Hide quoted text -
Reply all
Reply to author
Forward
0 new messages