Bug 60609 - Implement CSSPropertyMargin and CSSPropertyPadding in CSSStyleApplyProperty.
Summary: Implement CSSPropertyMargin and CSSPropertyPadding in CSSStyleApplyProperty.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-10 22:20 PDT by Luke Macpherson
Modified: 2011-05-11 23:59 PDT (History)
6 users (show)

See Also:


Attachments
Patch (5.02 KB, patch)
2011-05-10 22:22 PDT, Luke Macpherson
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Luke Macpherson 2011-05-10 22:20:21 PDT
Implement CSSPropertyMargin and CSSPropertyPadding in CSSStyleApplyProperty.
Comment 1 Luke Macpherson 2011-05-10 22:22:19 PDT
Created attachment 93072 [details]
Patch
Comment 2 Eric Seidel (no email) 2011-05-10 22:29:45 PDT
Comment on attachment 93072 [details]
Patch

OK.  How does this do the resetPadding stuff?  Or does it call each of the reset funtions individually (thus obsoleting the resetPadidng function?)
Comment 3 Luke Macpherson 2011-05-10 23:30:11 PDT
resetMargin is equivalent to setting the top, left, bottom and right margins to RenderStyle::initialMargin()

however,

resetPadding sets top, left, bottom, right to AUTO, while the individual cases are setting them to FIXED. This smells a lot like a bug in the existing code - in every case I've seen so far initializing the shorthand is exactly equivalent to initializing the individual values.
Comment 4 Eric Seidel (no email) 2011-05-10 23:39:10 PDT
Comment on attachment 93072 [details]
Patch

Since we're changing behavior, we'll need a test.  You can break out the non-behavior change from the behavior chagne if you like.  r=me on landing the non-behavior change w/o further review!
Comment 5 Luke Macpherson 2011-05-11 00:16:20 PDT
For reference, http://www.w3.org/TR/CSS21/box.html#propdef-padding says
"Initial:  	see individual properties"
Comment 6 Luke Macpherson 2011-05-11 18:49:25 PDT
(In reply to comment #5)
> For reference, http://www.w3.org/TR/CSS21/box.html#propdef-padding says
> "Initial:      see individual properties"

It appears that because of the way these values are used, Length(AUTO) and Length(FIXED) are treated equivalently.

for example:
int RenderBoxModelObject::paddingLeft(bool) const
{
    int w = 0;
    Length padding = style()->paddingLeft();
    if (padding.isPercent())
        w = containingBlock()->availableLogicalWidth();
    return padding.calcMinValue(w);
}

Will return 0 for both. Using AUTO in RenderStyle means that we are depending on the w=0 above for correct behavior. RenderStyle would better reflect the CSS spec by using RenderStyle::initialPadding() for its initial value.

FYI, this is passing DRT and pixel tests for me, and I count 949 uses of "padding:" under LayoutTests/fast, so we already have good coverage there.
Comment 7 Eric Seidel (no email) 2011-05-11 19:45:54 PDT
Can we detect this change with getComputedStyle?
Comment 8 Luke Macpherson 2011-05-11 20:46:21 PDT
(In reply to comment #7)
> Can we detect this change with getComputedStyle?

I just tested setting "padding: 0px;", "padding: auto;", "padding: 10%". In all cases getComputedStyle(e).getPropertyValue("padding-left") returns a px value; in the first two cases is 0px.
I think that means this change is not detectable from JS because it always returns the calculated pixel value.
Comment 9 Eric Seidel (no email) 2011-05-11 20:48:40 PDT
Comment on attachment 93072 [details]
Patch

Ok.  It's possible it might still be reachable from CSSStyleDeclaration. getPropertyCSSValue() somehow, but that's even more obscure.  Sounds fine.
Comment 10 WebKit Commit Bot 2011-05-11 22:13:39 PDT
Comment on attachment 93072 [details]
Patch

Clearing flags on attachment: 93072

Committed r86308: <http://trac.webkit.org/changeset/86308>
Comment 11 WebKit Commit Bot 2011-05-11 22:13:44 PDT
All reviewed patches have been landed.  Closing bug.
Comment 12 WebKit Review Bot 2011-05-11 23:59:59 PDT
http://trac.webkit.org/changeset/86308 might have broken Windows XP Debug (Tests)
The following tests are not passing:
editing/deleting/delete-ligature-001.html
editing/deleting/delete-ligature-002.html
editing/deleting/delete-ligature-003.html