Closed Bug 245715 Opened 20 years ago Closed 20 years ago

CSS setting float to left or right affects default display property

Categories

(Core :: CSS Parsing and Computation, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 237891
mozilla1.8alpha2

People

(Reporter: egs, Assigned: dbaron)

References

()

Details

(Whiteboard: [patch])

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040213 Firefox/0.8
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040213 Firefox/0.8

setting the float property for the img tag by default to left or right,
changes the display property wich is inherited to specific classes:

img {
    float:right;
}

img.nofloat {
    float:none;
}

images without a class are now floating to the left.
images with class 'nofloat' are no longer floating,
but the display property is no block and no longer inline.

I created a test website to demonstrate this bug.

Reproducible: Always
Steps to Reproduce:
nothin special to be done
Actual Results:  
text line is not displayed inline

Expected Results:  
text line shoud be drawn inline

I tried this with latest Firefox and with the Mozilla nightly.
Assignee: nobody → dbaron
Status: UNCONFIRMED → NEW
Component: Layout: Floats → Style System (CSS)
Ever confirmed: true
QA Contact: core.layout.floats → ian
Whiteboard: [patch]
Target Milestone: --- → mozilla1.8alpha2
Comment on attachment 150146 [details] [diff] [review]
patch

I can't think of any better solution...
Attachment #150146 - Flags: superreview?(bzbarsky)
Attachment #150146 - Flags: review?(bzbarsky)

*** This bug has been marked as a duplicate of 237891 ***
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
Comment on attachment 150146 [details] [diff] [review]
patch

>Index: nsRuleNode.cpp

>+    } else if (nsCSSPseudoElements::firstLetter == pseudoTag) {
>       // a non-floating first-letter must be inline
>       // XXX this fix can go away once bug 103189 is fixed correctly
>       display->mDisplay = NS_STYLE_DISPLAY_INLINE;
>+      
>+      // We can't cache the data in the rule tree since if a more specific
>+      // rule has 'float: none' we'll end up with the wrong 'display'
>+      // property.

This should be talking about "'float: right' or 'float: left'", since this _is_
the 'float: none' branch.

r+sr=bzbarsky with that comment change.
Attachment #150146 - Flags: superreview?(bzbarsky)
Attachment #150146 - Flags: superreview+
Attachment #150146 - Flags: review?(bzbarsky)
Attachment #150146 - Flags: review+
*** Bug 290319 has been marked as a duplicate of this bug. ***
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: