History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: LPP-3356
Type: Bug Bug
Status: Verified Verified
Resolution: Fixed
Priority: P2 P2
Assignee: Frisco Del Rosario
Reporter: Sarah Allen
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
OpenLaszlo

can't make bgcolor transparent with css*

Created: 20/Dec/06 07:53 AM   Updated: 03/Jan/07 02:54 PM
Component/s: LFC - CSS
Affects Version/s: None
Fix Version/s: 3.4

Time Tracking:
Not Specified

File Attachments: 1. Zip Archive css-bgcolor.zip (0.9 kb)


Severity: Major
Fixed in Change#: 3,247
Runtime: N/A
Flags: Products
Fix in hand: False


 Description  « Hide
You can make the bgcolor of a view transparent by setting bgcolor="null" but this isn't possible with CSS

I tried this syntax with no luck:
<stylesheet>
    styledview {
        bgcolor: "null";
    }
</stylesheet>

 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Sarah Allen - 20/Dec/06 07:55 AM
attaching simple test case

css-bgcolor-fails.lzx shows the problem... the styledview is black, when I want it to be transparent
css-bgcolor.lzx shows that it works fine to override one color with another

Sarah Allen - 20/Dec/06 12:25 PM
* this is not a stop ship, but it is really awkward to work around and drives us crazy -> high P2

P T Withington - 03/Jan/07 02:23 PM
r3247 | ptw | 2007-01-03 17:21:09 -0500 (Wed, 03 Jan 2007) | 55 lines
Changed paths:
   M /openlaszlo/trunk/WEB-INF/lps/lfc/core/LzNode.as
   M /openlaszlo/trunk/WEB-INF/lps/lfc/services/LzCSSStyle.js
   M /openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloView.as
   M /openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/StyleSheetCompiler.java
   M /openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/css/CSSHandler.java
   M /openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/css/StyleProperty.java

Change 20070102-ptw-s by ptw@dueling-banjos.local on 2007-01-02 10:14:51 EST
    in /Users/ptw/OpenLaszlo/trunk

Summary: Better typing for styles

Bugs Fixed:
LPP-3356: 'can't make bgcolor transparent with css'
LPP-2954: 'Make hex color (#FFFFFF), named color (red), and rgb(x,x,x)
color specification work in CSS'

Technical Reviewer: ben (Message-Id: <C2614CE0-1B63-437B-B72B-442B26FFE11C@laszlosystems.com>)
QA Reviewer: adam (pending)
Doc Reviewer: jsundman (Message-Id: <65BC51A6-BFF2-4589-A18D-476E9CDB2DEE@laszlosystems.com>)

Documentation:

It seems that people want to write CSS colors as 0xFF00DD. But that
is not valid CSS. So they wrote them as "0xFF00DD" and then were
disappointed that the runtime did not recognize those strings as
numbers. So a kludge was added to the style applicator to convert
strings to numbers. But this kludge did not consider that the string
"null" would coerce nicely to the number 0, which for a color is
black. And thereby hangs a tale.

Release Notes:

You will get a warning if you use "OxXXXXXX" to specify a color in a
CSS style sheet. You should be using #XXXXXX instead.

Details:
    LzCSSStyle.js: Consider the case where the value of the property
    may be 0, or null, which coerce to false in a boolean context.

    LzNode.as: Only do the string->int conversion if the string is
    really parseable as a number. Warn the user that there is a
    better way.

    LaszloView.as: Fix the code that was trying to warn you when you
    set bgcolor to a non-number to actually detect and report that.

    StyleProperty.java: Add a toString method to support
    ScriptCompiler.writeObject

    CSSHandler.java: Use the LexicalUnitType information to store the
    value as an appropriate Javascript literal (i.e., encode the type
    information).

    StyleSheetCompiler: Use ScriptCompiler.writeObject to write the
    style map, so that type information encoded in the literals is
    preserved.

Tests:
    Bug test and failing cases both pass now. That is, once I
    corrected the failing test case to specify CSS bgcolor as the
    token `null`, rather than the string `"null"`.

Frisco Del Rosario - 03/Jan/07 02:54 PM
<canvas debug="true">
<include href="lzunit"/>
<simplelayout axis="x" spacing="10"/>

<stylesheet>

#poundView {
bgcolor : #0000FF;
}

#nullBGcolor {
bgcolor : null;
}

#zeroxView {
bgcolor : '0xFF0000';
}

</stylesheet>

<view id="poundView" height="150" width="150" bgcolor="$style{'bgcolor'}">
<text fgcolor="white" text="#0000FF"/>
</view>

<view id="nullBGcolor" height="150" width="150" bgcolor="$style{'bgcolor'}">
<text fgcolor="black" text="null"/>
</view>

<view id="zeroxView" height="150" width="150" bgcolor="$style{'bgcolor'}">
<text fgcolor="white" text="0xFF0000"/>
</view>

<TestSuite>
<TestCase>
<method name="testLPP3356">
assertEquals(0x0000FF, poundView.bgcolor);
assertEquals(null, nullBGcolor.bgcolor);
assertEquals(0xFF0000, zeroxView.bgcolor);
</method>
</TestCase>
</TestSuite>

</canvas>

<!-- Copyright 2001-2006 Laszlo Systems, Inc. -->