diff options
author | Utsav Oza <utsavoza96@gmail.com> | 2020-06-03 15:47:44 +0530 |
---|---|---|
committer | Utsav Oza <utsavoza96@gmail.com> | 2020-06-10 22:10:44 +0530 |
commit | 15fd256302cc4401e0c4e2d154d473bfaa16223d (patch) | |
tree | d783cb77e558a34b9c67d06dc2def6a6341b501d /components/layout/query.rs | |
parent | 5493424d9aacbdf1066e2e2c48ccbc2a98752509 (diff) | |
download | servo-15fd256302cc4401e0c4e2d154d473bfaa16223d.tar.gz servo-15fd256302cc4401e0c4e2d154d473bfaa16223d.zip |
Store resolved font style in canvas context state
Diffstat (limited to 'components/layout/query.rs')
-rw-r--r-- | components/layout/query.rs | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/components/layout/query.rs b/components/layout/query.rs index fb73e8d1e41..56b1fc7d0f8 100644 --- a/components/layout/query.rs +++ b/components/layout/query.rs @@ -40,9 +40,10 @@ use style::computed_values::visibility::T as Visibility; use style::context::{QuirksMode, SharedStyleContext, StyleContext, ThreadLocalStyleContext}; use style::dom::TElement; use style::logical_geometry::{BlockFlowDirection, InlineBaseDirection, WritingMode}; +use style::properties::style_structs::{self, Font}; use style::properties::{ - parse_one_declaration_into, style_structs, ComputedValues, Importance, LonghandId, - PropertyDeclarationBlock, PropertyDeclarationId, PropertyId, SourcePropertyDeclaration, + parse_one_declaration_into, ComputedValues, Importance, LonghandId, PropertyDeclarationBlock, + PropertyDeclarationId, PropertyId, SourcePropertyDeclaration, }; use style::selector_parser::PseudoElement; use style::shared_lock::SharedRwLock; @@ -80,7 +81,7 @@ pub struct LayoutThreadData { pub resolved_style_response: String, /// A queued response for the resolved font style for canvas. - pub parse_font_response: Option<ServoArc<ComputedValues>>, + pub resolved_font_style_response: Option<ServoArc<Font>>, /// A queued response for the offset parent/rect of a node. pub offset_parent_response: OffsetParentResponse, @@ -179,10 +180,10 @@ impl LayoutRPC for LayoutRPCImpl { ResolvedStyleResponse(rw_data.resolved_style_response.clone()) } - fn parsed_font(&self) -> Option<ServoArc<ComputedValues>> { + fn resolved_font_style(&self) -> Option<ServoArc<Font>> { let &LayoutRPCImpl(ref rw_data) = self; let rw_data = rw_data.lock().unwrap(); - rw_data.parse_font_response.clone() + rw_data.resolved_font_style_response.clone() } fn offset_parent(&self) -> OffsetParentResponse { @@ -800,14 +801,14 @@ where ) } -pub fn process_parse_font_request<'dom, E>( +pub fn process_resolved_font_style_request<'dom, E>( context: &LayoutContext, node: E, value: &str, property: &PropertyId, url_data: ServoUrl, shared_lock: &SharedRwLock, -) -> Option<ServoArc<ComputedValues>> +) -> Option<ServoArc<Font>> where E: LayoutNode<'dom>, { @@ -846,12 +847,14 @@ where }; // 3. Resolve the parsed value with resolved styles of the parent element - Some(resolve_for_declarations::<E>( + let computed_values = resolve_for_declarations::<E>( &context.style_context, Some(&*parent_style), declarations, shared_lock, - )) + ); + + Some(computed_values.clone_font()) } /// Return the resolved value of property for a given (pseudo)element. |