Skip to content

Commit

Permalink
layout: instantiate SpecificFragmentInfo from node's media data
Browse files Browse the repository at this point in the history
  • Loading branch information
ceyusa committed Aug 30, 2018
1 parent 9142b11 commit 8003d10
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions components/layout/construct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ use floats::FloatKind;
use flow::{AbsoluteDescendants, Flow, FlowClass, GetBaseFlow, ImmutableFlowUtils};
use flow::{FlowFlags, MutableFlowUtils, MutableOwnedFlowUtils};
use flow_ref::FlowRef;
use fragment::{CanvasFragmentInfo, ImageFragmentInfo, InlineAbsoluteFragmentInfo, SvgFragmentInfo};
use fragment::{Fragment, GeneratedContentInfo, IframeFragmentInfo, FragmentFlags};
use fragment::{InlineAbsoluteHypotheticalFragmentInfo, TableColumnFragmentInfo};
use fragment::{InlineBlockFragmentInfo, SpecificFragmentInfo, UnscannedTextFragmentInfo};
use fragment::WhitespaceStrippingResult;
use fragment::{
CanvasFragmentInfo, Fragment, FragmentFlags, GeneratedContentInfo, IframeFragmentInfo,
ImageFragmentInfo, InlineAbsoluteFragmentInfo, InlineAbsoluteHypotheticalFragmentInfo,
InlineBlockFragmentInfo, MediaFragmentInfo, SpecificFragmentInfo, SvgFragmentInfo,
TableColumnFragmentInfo, UnscannedTextFragmentInfo, WhitespaceStrippingResult,
};
use inline::{InlineFlow, InlineFragmentNodeInfo, InlineFragmentNodeFlags};
use linked_list::prepend_from;
use list_item::{ListItemFlow, ListStyleTypeContent};
Expand Down Expand Up @@ -379,6 +380,10 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
));
SpecificFragmentInfo::Image(image_info)
}
Some(LayoutNodeType::Element(LayoutElementType::HTMLMediaElement)) => {
let data = node.media_data().unwrap();
SpecificFragmentInfo::Media(Box::new(MediaFragmentInfo::new(data)))
}
Some(LayoutNodeType::Element(LayoutElementType::HTMLObjectElement)) => {
let image_info = Box::new(ImageFragmentInfo::new(
node.object_data(), node, &self.layout_context
Expand Down Expand Up @@ -1703,6 +1708,7 @@ impl<ConcreteThreadSafeLayoutNode> NodeUtils for ConcreteThreadSafeLayoutNode
match self.type_id() {
Some(LayoutNodeType::Text) |
Some(LayoutNodeType::Element(LayoutElementType::HTMLImageElement)) |
Some(LayoutNodeType::Element(LayoutElementType::HTMLMediaElement)) |
Some(LayoutNodeType::Element(LayoutElementType::HTMLIFrameElement)) |
Some(LayoutNodeType::Element(LayoutElementType::HTMLCanvasElement)) |
Some(LayoutNodeType::Element(LayoutElementType::SVGSVGElement)) => true,
Expand Down

0 comments on commit 8003d10

Please sign in to comment.