aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/text.rs
diff options
context:
space:
mode:
authorMatt Brubeck <mbrubeck@limpet.net>2016-03-24 16:06:12 -0700
committerMatt Brubeck <mbrubeck@limpet.net>2016-03-24 18:33:27 -0700
commit08caf7412fc3e86a76c47876eb9bfab9804f2182 (patch)
tree47971fc181502750fdaa4c4dc057d951a7b472ec /components/layout/text.rs
parent61710008750f03f1f66ce0b24ea92c2b0286e0e0 (diff)
downloadservo-08caf7412fc3e86a76c47876eb9bfab9804f2182.tar.gz
servo-08caf7412fc3e86a76c47876eb9bfab9804f2182.zip
Convert ScannedTextFragment fields into bitflags
Diffstat (limited to 'components/layout/text.rs')
-rw-r--r--components/layout/text.rs14
1 files changed, 11 insertions, 3 deletions
diff --git a/components/layout/text.rs b/components/layout/text.rs
index 4e339c28a2c..6cc7adf7424 100644
--- a/components/layout/text.rs
+++ b/components/layout/text.rs
@@ -7,7 +7,8 @@
#![deny(unsafe_code)]
use app_units::Au;
-use fragment::{Fragment, ScannedTextFragmentInfo, SpecificFragmentInfo, UnscannedTextFragmentInfo};
+use fragment::{Fragment, REQUIRES_LINE_BREAK_AFTERWARD_IF_WRAPPING_ON_NEWLINES, ScannedTextFlags};
+use fragment::{ScannedTextFragmentInfo, SELECTED, SpecificFragmentInfo, UnscannedTextFragmentInfo};
use gfx::font::{DISABLE_KERNING_SHAPING_FLAG, FontMetrics, IGNORE_LIGATURES_SHAPING_FLAG};
use gfx::font::{RTL_FLAG, RunMetrics, ShapingFlags, ShapingOptions};
use gfx::font_context::FontContext;
@@ -344,13 +345,20 @@ impl TextRunScanner {
}
let text_size = old_fragment.border_box.size;
+
+ let mut flags = ScannedTextFlags::empty();
+ if mapping.selected {
+ flags.insert(SELECTED);
+ }
+ if requires_line_break_afterward_if_wrapping_on_newlines {
+ flags.insert(REQUIRES_LINE_BREAK_AFTERWARD_IF_WRAPPING_ON_NEWLINES);
+ }
let mut new_text_fragment_info = box ScannedTextFragmentInfo::new(
scanned_run.run,
mapping.char_range,
text_size,
scanned_run.insertion_point,
- mapping.selected,
- requires_line_break_afterward_if_wrapping_on_newlines);
+ flags);
let new_metrics = new_text_fragment_info.run.metrics_for_range(&mapping.char_range);
let writing_mode = old_fragment.style.writing_mode;