File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -136,13 +136,18 @@ int ElementUtilities::GetFontSize(Element* element)
136136// Returns an element's line height, if it has a font defined.
137137int ElementUtilities::GetLineHeight (Element* element)
138138{
139- FontFaceHandle* font_face_handle = element->GetFontFaceHandle ();
139+ const Property* line_height_property = element->GetLineHeightProperty ();
140+
141+ Element* font_element = element;
142+ if (line_height_property->unit == Property::REM )
143+ font_element = element->GetOwnerDocument ();
144+
145+ FontFaceHandle* font_face_handle = font_element->GetFontFaceHandle ();
140146 if (font_face_handle == NULL )
141147 return 0 ;
142148
143149 int line_height = font_face_handle->GetLineHeight ();
144150 float inch = element->GetRenderInterface ()->GetPixelsPerInch ();
145- const Property* line_height_property = element->GetLineHeightProperty ();
146151
147152 switch (line_height_property->unit )
148153 {
@@ -155,6 +160,7 @@ int ElementUtilities::GetLineHeight(Element* element)
155160 ROCKET_UNUSED_SWITCH_ENUM (Property::RELATIVE_UNIT );
156161 case Property::NUMBER :
157162 case Property::EM :
163+ case Property::REM :
158164 // If the property is a straight number or an em measurement, then it scales the line height.
159165 return Math::Round (line_height_property->value .Get < float >() * line_height);
160166 case Property::PERCENT :
You can’t perform that action at this time.
0 commit comments