mirror of
https://github.com/servo/servo.git
synced 2025-06-21 23:59:00 +01:00
Reorganise comments
This commit is contained in:
parent
16e2b131e7
commit
d3dfb78683
1 changed files with 44 additions and 41 deletions
|
@ -59,62 +59,65 @@ use sync::Arc;
|
||||||
/// left corner of the green zone is the same as that of the line, but
|
/// left corner of the green zone is the same as that of the line, but
|
||||||
/// the green zone can be taller and wider than the line itself.
|
/// the green zone can be taller and wider than the line itself.
|
||||||
pub struct LineBox {
|
pub struct LineBox {
|
||||||
/// Consider the following HTML and rendered element with linebreaks:
|
|
||||||
///
|
|
||||||
/// ~~~html
|
|
||||||
/// <span>I <span>like truffles,</span> yes I do.</span>
|
|
||||||
/// ~~~
|
|
||||||
///
|
|
||||||
/// ~~~
|
|
||||||
/// +-----------+
|
|
||||||
/// | I like |
|
|
||||||
/// | truffles, |
|
|
||||||
/// | yes I do. |
|
|
||||||
/// +-----------+
|
|
||||||
/// ~~~
|
|
||||||
///
|
|
||||||
/// The ranges that describe these lines would be:
|
|
||||||
///
|
|
||||||
/// ~~~
|
|
||||||
/// | [0.0, 1.4) | [1.5, 2.0) | [2.1, 3.0) |
|
|
||||||
/// |------------|-------------|-------------|
|
|
||||||
/// | 'I like' | 'truffles,' | 'yes I do.' |
|
|
||||||
/// ~~~
|
|
||||||
pub range: Range<LineIndices>,
|
pub range: Range<LineIndices>,
|
||||||
pub bounds: Rect<Au>,
|
pub bounds: Rect<Au>,
|
||||||
pub green_zone: Size2D<Au>
|
pub green_zone: Size2D<Au>
|
||||||
}
|
}
|
||||||
|
|
||||||
int_range_index! {
|
int_range_index! {
|
||||||
#[doc = "The index of a box fragment into the flattened vector of DOM"]
|
#[doc = "The index of a box fragment in a flattened vector of DOM elements."]
|
||||||
#[doc = "elements."]
|
|
||||||
#[doc = ""]
|
|
||||||
#[doc = "For example, given the HTML below:"]
|
|
||||||
#[doc = ""]
|
|
||||||
#[doc = "~~~"]
|
|
||||||
#[doc = "<span>I <span>like truffles,</span> yes I do.</span>"]
|
|
||||||
#[doc = "~~~"]
|
|
||||||
#[doc = ""]
|
|
||||||
#[doc = "The fragments would be indexed as follows:"]
|
|
||||||
#[doc = ""]
|
|
||||||
#[doc = "~~~"]
|
|
||||||
#[doc = "| 0 | 1 | 2 |"]
|
|
||||||
#[doc = "|------|------------------|--------------|"]
|
|
||||||
#[doc = "| 'I ' | 'like truffles,' | ' yes I do.' |"]
|
|
||||||
#[doc = "~~~"]
|
|
||||||
struct FragmentIndex(int)
|
struct FragmentIndex(int)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A line index consists of two indices: a fragment index that refers to the
|
/// A line index consists of two indices: a fragment index that refers to the
|
||||||
/// index of a DOM fragment within a flattened inline element; and a glyph index
|
/// index of a DOM fragment within a flattened inline element; and a glyph index
|
||||||
/// where the 0th glyph refers to the first glyph of that fragment.
|
/// where the 0th glyph refers to the first glyph of that fragment.
|
||||||
|
///
|
||||||
|
/// For example, consider the following HTML and rendered element with
|
||||||
|
/// linebreaks:
|
||||||
|
///
|
||||||
|
/// ~~~html
|
||||||
|
/// <span>I <span>like truffles,</span> yes I do.</span>
|
||||||
|
/// ~~~
|
||||||
|
///
|
||||||
|
/// ~~~
|
||||||
|
/// +-----------+
|
||||||
|
/// | I like |
|
||||||
|
/// | truffles, |
|
||||||
|
/// | yes I do. |
|
||||||
|
/// +-----------+
|
||||||
|
/// ~~~
|
||||||
|
///
|
||||||
|
/// The ranges that describe these lines would be:
|
||||||
|
///
|
||||||
|
/// ~~~
|
||||||
|
/// | [0.0, 1.4) | [1.5, 2.0) | [2.1, 3.0) |
|
||||||
|
/// |------------|-------------|-------------|
|
||||||
|
/// | 'I like' | 'truffles,' | 'yes I do.' |
|
||||||
|
/// ~~~
|
||||||
#[deriving(Clone, Eq, Ord, TotalEq, TotalOrd, Zero)]
|
#[deriving(Clone, Eq, Ord, TotalEq, TotalOrd, Zero)]
|
||||||
pub struct LineIndices {
|
pub struct LineIndices {
|
||||||
|
/// The index of a box fragment into the flattened vector of DOM
|
||||||
|
/// elements.
|
||||||
|
///
|
||||||
|
/// For example, given the HTML below:
|
||||||
|
///
|
||||||
|
/// ~~~
|
||||||
|
/// <span>I <span>like truffles,</span> yes I do.</span>
|
||||||
|
/// ~~~
|
||||||
|
///
|
||||||
|
/// The fragments would be indexed as follows:
|
||||||
|
///
|
||||||
|
/// ~~~
|
||||||
|
/// | 0 | 1 | 2 |
|
||||||
|
/// |------|------------------|--------------|
|
||||||
|
/// | 'I ' | 'like truffles,' | ' yes I do.' |
|
||||||
|
/// ~~~
|
||||||
pub fragment_index: FragmentIndex,
|
pub fragment_index: FragmentIndex,
|
||||||
/// The index of a character in a single DOM fragment. Ligatures and
|
|
||||||
/// continuous runs of whitespace are treated as single characters.
|
/// The index of a character in a DOM fragment. Ligatures and continuous
|
||||||
/// Non-breakable DOM fragments such as images are treated as
|
/// runs of whitespace are treated as single characters. Non-breakable DOM
|
||||||
/// having a range length of `1`.
|
/// fragments such as images are treated as having a range length of `1`.
|
||||||
///
|
///
|
||||||
/// For example, given the HTML below:
|
/// For example, given the HTML below:
|
||||||
///
|
///
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue