Skip to content

Commit 6430402

Browse files
committed
Merge pull request #148 from SWTI2014/rendering/css-text-attribute
Rendering/css text attribute
2 parents ac11e6c + a1615c9 commit 6430402

31 files changed

Lines changed: 175 additions & 10 deletions

packages/HTML.package/CSSStyleResolver.class/class/inheritableAttributes.st

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ constants
22
inheritableAttributes
33
"The following CSS Attributes are inheritable:"
44
"'azimuth', 'border-collapse', 'border-spacing', 'caption-side', 'color', 'cursor', 'direction', 'elevation', 'empty-cells', 'font-family', 'font-size', 'font-style', 'font-variant', 'font-weight', 'font', 'letter-spacing', 'line-height', 'list-style-image', 'list-style-position', 'list-style-type', 'list-style', 'orphans', 'pitch-range', 'pitch', 'quotes', 'richness', 'speak-header', 'speak-numeral', 'speak-punctuation', 'speak', 'speak-rate', 'stress', 'text-align', 'text-indent', 'text-transform', 'visibility', 'voice-family', 'volume', 'white-space', 'widows', 'word-spacing'"
5-
^ #( #italic. #bold. #size. #color. #family)
5+
^ #( #italic. #bold. #size. #color. #family. #align)

packages/HTML.package/CSSStyleResolver.class/instance/cssPrefixMap.st

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ cssPrefixMap
55
sizeFormatter := CSSSizeFormatter new.
66
cssPrefixMap := Dictionary newFrom: {
77
'font' -> CSSFontFormatter new.
8+
'text' -> CSSTextFormatter new.
89
'color' -> CSSColorFormatter new.
910
'display' -> CSSDisplayFormatter new.
1011
'list' -> CSSListFormatter new.

packages/HTML.package/CSSStyleResolver.class/methodProperties.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"class" : {
33
"for:" : "rs 6/7/2014 11:24:06.679",
4-
"inheritableAttributes" : "SN 6/15/2014 13:13" },
4+
"inheritableAttributes" : "SN 7/5/2014 16:04" },
55
"instance" : {
6-
"cssPrefixMap" : "rs 6/20/2014 20:17:24.757",
6+
"cssPrefixMap" : "SN 7/5/2014 11:57",
77
"domNode:" : "rs 6/7/2014 11:23:34.652",
88
"evaluateLocalStylesFor:" : "rs 6/7/2014 13:22:25.554",
99
"getFormatterFor:" : "rs 6/8/2014 14:03:12.648",

packages/HTML.package/CSSTextFormatter.class/README.md

Whitespace-only changes.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
accessing
2+
attributeMap
3+
4+
^ attributeMap ifNil:
5+
[ Dictionary newFrom: {
6+
'text-decoration' -> [ :prop :fontAttribs |
7+
self readTextDecorationAttribute: prop propertyString to: fontAttribs ].
8+
'text-align' -> [ :prop :fontAttribs |
9+
self readTextAlignAttribute: prop propertyString to: fontAttribs ]
10+
}]
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
parsing
2+
parseTextAttributesFrom: aCSSProperty into: aContext
3+
(self attributeMap at: aCSSProperty propertyName ifAbsent: [nil])
4+
ifNotNilDo: [:process | process value: aCSSProperty value: aContext ]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
parsing
2+
readTextAlignAttribute: aString to: aContext
3+
aString splitBy: ' ' do: [:attribute |
4+
(attribute = 'center') ifTrue: [aContext at: #align put: #centered].
5+
((attribute = 'left') or: [attribute = 'start']) ifTrue: [aContext at: #align put: #leftFlush].
6+
((attribute = 'right') or: [attribute = 'end']) ifTrue: [aContext at: #align put: #rightFlush].
7+
(attribute = 'justify') ifTrue: [aContext at: #align put: #justified].]
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
parsing
2+
readTextDecorationAttribute: aString to: aContext
3+
aString splitBy: ' ' do: [:attribute |
4+
(attribute = 'underline') ifTrue: [aContext at: #underlined put: true].
5+
(attribute = 'line-through') ifTrue: [aContext at: #struckOut put: true]]
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"class" : {
3+
},
4+
"instance" : {
5+
"attributeMap" : "SN 7/5/2014 12:30",
6+
"parseTextAttributesFrom:into:" : "SN 7/5/2014 12:12",
7+
"readTextAlignAttribute:to:" : "SN 7/5/2014 12:20",
8+
"readTextDecorationAttribute:to:" : "SN 7/5/2014 11:57" } }
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"category" : "HTML-Formatter",
3+
"classinstvars" : [
4+
],
5+
"classvars" : [
6+
],
7+
"commentStamp" : "",
8+
"instvars" : [
9+
"attributeMap" ],
10+
"name" : "CSSTextFormatter",
11+
"pools" : [
12+
],
13+
"super" : "CSSFormatter",
14+
"type" : "normal" }

0 commit comments

Comments
 (0)