Skip to content

Instantly share code, notes, and snippets.

@Manishearth
Last active January 27, 2017 00:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Manishearth/bd99bc71025e1623f5d18b6ea0a8d215 to your computer and use it in GitHub Desktop.
Save Manishearth/bd99bc71025e1623f5d18b6ea0a8d215 to your computer and use it in GitHub Desktop.
pres attr units
Consolidated list of properties and the units used:
float: enum(mozilla::StyleFloat)
vertical-align: enum(NS_STYLE_VERTICAL_ALIGN_*)
text-align: enum(NS_STYLE_TEXT_ALIGN_*)
margin-trbl: percent or float(px) or auto (or auto in one case only)
width/height: percent or float(px)
border-trbl-wh: float(px)
border-trbl-color: color(setcolorvalue) or int(eCSSUnit_EnumColor, http://searchfox.org/mozilla-central/source/layout/style/nsRuleNode.cpp#1041)
border-trbl-style: int(enum NS_STYLE_BORDER_STYLE_*)
background-image: image (http://searchfox.org/mozilla-central/source/dom/html/nsGenericHTMLElement.cpp#1533 already loaded?)
background-color: color(setcolorvalue)
lang: string
user-modify: enum(StyleUserModify)
display: enum(StyleDisplay::none only)
clear: enum(mozilla::StyleClear)
list-style-type: enum(NS_STYLE_LIST_STYLE_*)
white-space: enum(NS_STYLE_WHITESPACE_PRE_*)
color: color(setcolorvalue)
font-family: bespoke unit(eCSSUnit_FontFamilyList, ParseFontFamilyListString)
font-size: enum(font size from 1-7)
text-decoration-line: enum(NS_STYLE_TEXT_DECORATION_LINE_*, bitfield enum)
caption-side: NS_STYLE_CAPTION_SIDE_*
-x-span: int
border-spacing: float(px)
<body> additionally sets the vlink/alink colors on the nsHTMLStyleSheet
Sorted by elements
---------------------
generic html: Common pres attrs, some elements call some or more of these
http://searchfox.org/mozilla-central/source/dom/html/nsGenericHTMLElement.cpp#1337
float: enum(mozilla::StyleFloat)
vertical-align: enum(NS_STYLE_VERTICAL_ALIGN_*)
text-align: enum(NS_STYLE_TEXT_ALIGN_*)
margin-trbl: percent or float(px)
width/height: percent or float(px)
border-trbl-wh: float(px)
border-trbl-color: int(eCSSUnit_EnumColor, http://searchfox.org/mozilla-central/source/layout/style/nsRuleNode.cpp#1041)
border-trbl-style: int(enum NS_STYLE_BORDER_STYLE_*)
background-image: image (http://searchfox.org/mozilla-central/source/dom/html/nsGenericHTMLElement.cpp#1533 already loaded?)
background-color: color(setcolorvalue)
lang: string
user-modify: enum(StyleUserModify)
display: enum(StyleDisplay::none only)
<br> http://searchfox.org/mozilla-central/source/dom/html/HTMLBRElement.cpp#55
clear: enum(mozilla::StyleClear)
<div> http://searchfox.org/mozilla-central/source/dom/html/HTMLDivElement.cpp#
generic html only
<marquee> http://searchfox.org/mozilla-central/source/dom/html/HTMLDivElement.cpp#70
generic html only
<hr>
margin-trbl: percent or float(px) or auto
wh, border-trbl-*: see generic
<li>
list-style-type: enum(NS_STYLE_LIST_STYLE_*)
<pre>
whitespace: enum(NS_STYLE_WHITESPACE_PRE_WRAP only)
<body>
sets vlink/alink color on stylesheet
color: color(setcolorvalue)
generic html stuff
<font>
font-family: string? (ParseFontFamilyListString)
font-size: enum(font size enum)
text-decoration-line: enum(NS_STYLE_TEXT_DECORATION_LINE_*, bitfield enum)
generic html stuff
<heading>
only generic html
<iframe>
border-trbl-wh: float(px)
wh: float(px) or percent
generic stuff
<img>, <input>, <object>, <p>, <select>, HTMLSharedObjectElement, <video>
generic
<ol>, <ul>
list-style-type: enum(NS_STYLE_LIST_STYLE_*)
generic
<caption>
caption-side: NS_STYLE_CAPTION_SIDE_*
<td>/<th>
wh: float(px) or percent
text-align: enum(NS_STYLE_TEXT_ALIGN_*)
white-space: enum(NS_STYLE_WHITESPACE_NOWRAP only)
vertical-align: enum(NS_STYLE_VERTICAL_ALIGN_*)
generic
<col>
-x-span: int
width: float(px) or %
text-align: enum(NS_STYLE_TEXT_ALIGN_*)
vertical-align: enum(NS_STYLE_VERTICAL_ALIGN_*)
generic
<table>
border-spacing: float(px)
margin-trbl: float(px)
wh: float(px) or %
border-trbl-color: color(setcolorvalue)
border-trbl-width: float(px)
generic
<tr>, <section>
wh: float(px) or %
text-align: enum(NS_STYLE_TEXT_ALIGN_*)
vertical-align: enum(NS_STYLE_VERTICAL_ALIGN_*)
generic
<textarea>
whitespace: enum(NS_STYLE_WHITESPACE_PRE only)
common
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment