auto merge of #4582 : pcwalton/servo/blend-modes, r=glennw

`background-blend-mode` is not yet supported because we don't support
multiple backgrounds yet.

r? @glennw
This commit is contained in:
bors-servo 2015-01-12 09:03:48 -07:00
commit e6fe9f1409
10 changed files with 181 additions and 23 deletions

View file

@ -371,7 +371,9 @@ impl FragmentDisplayListBuilding for Fragment {
// Create the image display item.
display_list.push(DisplayItem::ImageClass(box ImageDisplayItem {
base: BaseDisplayItem::new(bounds,
DisplayItemMetadata::new(self.node, style, Cursor::DefaultCursor),
DisplayItemMetadata::new(self.node,
style,
Cursor::DefaultCursor),
clip),
image: image.clone(),
stretch_size: Size2D(Au::from_px(image.width as int),
@ -481,7 +483,9 @@ impl FragmentDisplayListBuilding for Fragment {
let gradient_display_item = DisplayItem::GradientClass(box GradientDisplayItem {
base: BaseDisplayItem::new(*absolute_bounds,
DisplayItemMetadata::new(self.node, style, Cursor::DefaultCursor),
DisplayItemMetadata::new(self.node,
style,
Cursor::DefaultCursor),
clip),
start_point: center - delta,
end_point: center + delta,
@ -1194,6 +1198,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
&overflow,
self.fragment.style().get_box().z_index.number_or_zero(),
filters,
self.fragment.style().get_effects().mix_blend_mode,
layer))
}
}

View file

@ -44,9 +44,9 @@ use std::sync::{Arc, Mutex};
use string_cache::Atom;
use style::{ComputedValues, TElement, TNode, cascade_anonymous};
use style::computed_values::{LengthOrPercentage, LengthOrPercentageOrAuto};
use style::computed_values::{LengthOrPercentageOrNone};
use style::computed_values::{clear, overflow_wrap, position, text_align, text_decoration};
use style::computed_values::{vertical_align, white_space, word_break};
use style::computed_values::{LengthOrPercentageOrNone, clear, mix_blend_mode, overflow_wrap};
use style::computed_values::{position, text_align, text_decoration, vertical_align, white_space};
use style::computed_values::{word_break};
use url::Url;
/// Fragments (`struct Fragment`) are the leaves of the layout tree. They cannot position
@ -1747,6 +1747,9 @@ impl Fragment {
if !self.style().get_effects().filter.is_empty() {
return true
}
if self.style().get_effects().mix_blend_mode != mix_blend_mode::T::normal {
return true
}
match self.style().get_box().position {
position::T::absolute | position::T::fixed => {
// FIXME(pcwalton): This should only establish a new stacking context when

View file

@ -63,7 +63,7 @@ use std::cell::Cell;
use std::comm::{channel, Sender, Receiver, Select};
use std::mem;
use std::ptr;
use style::computed_values::filter;
use style::computed_values::{filter, mix_blend_mode};
use style::{StylesheetOrigin, Stylesheet, Stylist, TNode, iter_font_face_rules};
use style::{MediaType, Device};
use std::sync::{Arc, Mutex, MutexGuard};
@ -698,6 +698,7 @@ impl LayoutTask {
&origin,
0,
filter::T::new(Vec::new()),
mix_blend_mode::T::normal,
Some(paint_layer)));
rw_data.stacking_context = Some(stacking_context.clone());

View file

@ -116,7 +116,9 @@ impl TextRunScanner {
let inherited_text_style = in_fragment.style().get_inheritedtext();
fontgroup = font_context.get_layout_font_group_for_style(font_style);
compression = match in_fragment.white_space() {
white_space::T::normal | white_space::T::nowrap => CompressionMode::CompressWhitespaceNewline,
white_space::T::normal | white_space::T::nowrap => {
CompressionMode::CompressWhitespaceNewline
}
white_space::T::pre => CompressionMode::CompressNone,
};
text_transform = inherited_text_style.text_transform;
@ -129,7 +131,9 @@ impl TextRunScanner {
let mut run_text = String::new();
for in_fragment in self.clump.iter() {
let in_fragment = match in_fragment.specific {
SpecificFragmentInfo::UnscannedText(ref text_fragment_info) => &text_fragment_info.text,
SpecificFragmentInfo::UnscannedText(ref text_fragment_info) => {
&text_fragment_info.text
}
_ => panic!("Expected an unscanned text fragment!"),
};