Browse files

Merge pull request #1 from meric/line-height

add line height property
  • Loading branch information...
2 parents 25d7010 + 15005ff commit 41ca551fa917165328aebec6a351612884942fb3 @rsms committed Sep 27, 2011
Showing with 17 additions and 2 deletions.
  1. +2 −1 cocoa-framework/CSSStyle.h
  2. +15 −1 cocoa-framework/CSSStyle.m
View
3 cocoa-framework/CSSStyle.h
@@ -39,7 +39,8 @@
borderLeftWidth,
borderTopWidth,
borderRightWidth,
- borderBottomWidth;
+ borderBottomWidth,
+ lineHeight;
// Block dimensions. Note: NaN is returned for e.g. "width:auto"
@property(readonly, nonatomic) CGFloat
View
16 cocoa-framework/CSSStyle.m
@@ -205,7 +205,6 @@ - (CGFloat)name { \
// Block dimensions
-
- (CGFloat)width {
css_unit unit;
css_fixed value;
@@ -232,6 +231,21 @@ - (CGFloat)height {
}
}
+// line dimensions
+
+- (CGFloat)lineHeight {
+ css_unit unit;
+ css_fixed value;
+ switch (css_computed_line_height(style_, &value, &unit)) {
+ case CSS_LINE_HEIGHT_NUMBER:
+ return FIXTOFLT(value);
+ case CSS_LINE_HEIGHT_DIMENSION:
+ // TODO - change according to unit
+ return FIXTOFLT(value);
+ default:
+ return 0.0;
+ }
+}
// Font

0 comments on commit 41ca551

Please sign in to comment.