rustdoc: Fix many rustdoc errors (#31147)

This fixes many rustdoc errors that occur due to raw URLs in rustdoc
comments as well as unescaped Rust code that should be in backticks.
This commit is contained in:
Martin Robinson 2024-01-22 14:13:48 +01:00 committed by GitHub
parent d7de206dbd
commit 5c1723c983
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
185 changed files with 939 additions and 942 deletions

View file

@ -55,7 +55,7 @@ pub(super) fn build(
}
}
/// https://drafts.csswg.org/css-images-3/#linear-gradients
/// <https://drafts.csswg.org/css-images-3/#linear-gradients>
pub(super) fn build_linear(
style: &ComputedValues,
items: &[GradientItem<Color, LengthPercentage>],
@ -155,7 +155,7 @@ pub(super) fn build_linear(
)
}
/// https://drafts.csswg.org/css-images-3/#radial-gradients
/// <https://drafts.csswg.org/css-images-3/#radial-gradients>
pub(super) fn build_radial(
style: &ComputedValues,
items: &[GradientItem<Color, LengthPercentage>],
@ -255,7 +255,7 @@ pub(super) fn build_radial(
)
}
/// https://drafts.csswg.org/css-images-4/#color-stop-fixup
/// <https://drafts.csswg.org/css-images-4/#color-stop-fixup>
fn fixup_stops(
style: &ComputedValues,
items: &[GradientItem<Color, LengthPercentage>],

View file

@ -118,7 +118,7 @@ pub(crate) struct DisplayListBuilder<'a> {
/// Contentful paint i.e. whether the display list contains items of type
/// text, image, non-white canvas or SVG). Used by metrics.
/// See https://w3c.github.io/paint-timing/#first-contentful-paint.
/// See <https://w3c.github.io/paint-timing/#first-contentful-paint>.
is_contentful: bool,
}

View file

@ -511,7 +511,7 @@ impl StackingContext {
true
}
/// https://drafts.csswg.org/css-backgrounds/#special-backgrounds
/// <https://drafts.csswg.org/css-backgrounds/#special-backgrounds>
///
/// This is only called for the root `StackingContext`
pub(crate) fn build_canvas_background_display_list(

View file

@ -327,7 +327,7 @@ where
})
}
/// https://www.w3.org/TR/CSS2/generate.html#propdef-content
/// <https://www.w3.org/TR/CSS2/generate.html#propdef-content>
fn generate_pseudo_element_content<'dom, Node>(
pseudo_element_style: &ComputedValues,
element: Node,

View file

@ -38,7 +38,7 @@ impl FlexContainer {
}
}
/// https://drafts.csswg.org/css-flexbox/#flex-items
/// <https://drafts.csswg.org/css-flexbox/#flex-items>
struct FlexContainerBuilder<'a, 'dom, Node> {
context: &'a LayoutContext<'a>,
info: &'a NodeAndStyleInfo<Node>,
@ -98,7 +98,7 @@ where
}
}
/// https://drafts.csswg.org/css-text/#white-space
/// <https://drafts.csswg.org/css-text/#white-space>
fn is_only_document_white_space<Node>(run: &TextRun<'_, Node>) -> bool {
// FIXME: is this the right definition? See
// https://github.com/w3c/csswg-drafts/issues/5146

View file

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
//! https://drafts.csswg.org/css-flexbox/#box-model
//! <https://drafts.csswg.org/css-flexbox/#box-model>
use style::properties::longhands::flex_direction::computed_value::T as FlexDirection;
@ -87,7 +87,7 @@ pub(super) enum FlexAxis {
}
/// Which flow-relative sides map to the main-start and cross-start sides, respectively.
/// See https://drafts.csswg.org/css-flexbox/#box-model
/// See <https://drafts.csswg.org/css-flexbox/#box-model>
#[derive(Clone, Copy)]
pub(super) enum MainStartCrossStart {
InlineStartBlockStart,

View file

@ -69,10 +69,10 @@ struct FlexItem<'a> {
/// This is the difference between an outer and inner size.
pbm_auto_is_zero: FlexRelativeVec2<Length>,
/// https://drafts.csswg.org/css-flexbox/#algo-main-item
/// <https://drafts.csswg.org/css-flexbox/#algo-main-item>
flex_base_size: Length,
/// https://drafts.csswg.org/css-flexbox/#algo-main-item
/// <https://drafts.csswg.org/css-flexbox/#algo-main-item>
hypothetical_main_size: Length,
/// This is `align-self`, defaulting to `align-items` if `auto`
align_self: AlignItems,
@ -153,7 +153,7 @@ impl FlexContainer {
ContentSizes::zero() // Return an incorrect result rather than panic
}
/// https://drafts.csswg.org/css-flexbox/#layout-algorithm
/// <https://drafts.csswg.org/css-flexbox/#layout-algorithm>
pub(crate) fn layout(
&self,
layout_context: &LayoutContext,
@ -552,7 +552,7 @@ impl<'a> FlexItem<'a> {
}
}
/// https://drafts.csswg.org/css-flexbox/#algo-main-item
/// <https://drafts.csswg.org/css-flexbox/#algo-main-item>
fn flex_base_size(
flex_context: &FlexContext,
flex_item: &mut IndependentFormattingContext,
@ -872,7 +872,7 @@ impl FlexLine<'_> {
}
/// Return the *main size* of each item, and the lines remainaing free space
/// https://drafts.csswg.org/css-flexbox/#resolve-flexible-lengths
/// <https://drafts.csswg.org/css-flexbox/#resolve-flexible-lengths>
fn resolve_flexible_lengths(&self, container_main_size: Length) -> (Vec<Length>, Length) {
let mut frozen = vec![false; self.items.len()];
let mut target_main_sizes_vec = self
@ -1135,7 +1135,7 @@ impl<'a> FlexItem<'a> {
}
impl<'items> FlexLine<'items> {
/// https://drafts.csswg.org/css-flexbox/#algo-cross-line
/// <https://drafts.csswg.org/css-flexbox/#algo-cross-line>
fn cross_size(
&self,
item_layout_results: &[FlexItemLayoutResult],
@ -1238,7 +1238,7 @@ impl<'items> FlexLine<'items> {
impl FlexItem<'_> {
/// Return the cross-start and cross-end margin, with `auto` values resolved.
/// https://drafts.csswg.org/css-flexbox/#algo-cross-margins
/// <https://drafts.csswg.org/css-flexbox/#algo-cross-margins>
fn resolve_auto_cross_margins(
&self,
flex_context: &FlexContext,

View file

@ -4,7 +4,7 @@
//! Float layout.
//!
//! See CSS 2.1 § 9.5.1: https://www.w3.org/TR/CSS2/visuren.html#float-position
//! See CSS 2.1 § 9.5.1: <https://www.w3.org/TR/CSS2/visuren.html#float-position>
use std::collections::VecDeque;
use std::fmt::{Debug, Formatter, Result as FmtResult};
@ -506,7 +506,7 @@ pub struct PlacementInfo {
/// Whether the float is left or right.
///
/// See CSS 2.1 § 9.5.1: https://www.w3.org/TR/CSS2/visuren.html#float-position
/// See CSS 2.1 § 9.5.1: <https://www.w3.org/TR/CSS2/visuren.html#float-position>
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum FloatSide {
Left,
@ -600,8 +600,8 @@ impl FloatBand {
///
/// AA trees were chosen for simplicity.
///
/// See: https://en.wikipedia.org/wiki/AA_tree
/// https://arxiv.org/pdf/1412.4882.pdf
/// See: <https://en.wikipedia.org/wiki/AA_tree>
/// <https://arxiv.org/pdf/1412.4882.pdf>
#[derive(Clone, Debug)]
pub struct FloatBandTree {
pub root: FloatBandLink,
@ -787,12 +787,13 @@ impl FloatBandLink {
}
/// Corrects tree balance:
///
///```text
/// T L
/// / \ / \
/// L R → A T if level(T) = level(L)
/// / \ / \
/// A B B R
/// ```
fn skew(&self) -> FloatBandLink {
if let Some(ref this) = self.0 {
if let Some(ref left) = this.left.0 {
@ -816,12 +817,13 @@ impl FloatBandLink {
}
/// Corrects tree balance:
///
///```text
/// T R
/// / \ / \
/// A R → T X if level(T) = level(X)
/// / \ / \
/// B X A B
/// ```
fn split(&self) -> FloatBandLink {
if let Some(ref this) = self.0 {
if let Some(ref right) = this.right.0 {

View file

@ -93,7 +93,7 @@ pub(crate) struct InlineBox {
pub children: Vec<ArcRefCell<InlineLevelBox>>,
}
/// https://www.w3.org/TR/css-display-3/#css-text-run
/// <https://www.w3.org/TR/css-display-3/#css-text-run>
#[derive(Debug, Serialize)]
pub(crate) struct TextRun {
pub base_fragment_info: BaseFragmentInfo,
@ -296,7 +296,7 @@ impl LineBlockSizes {
.adjust_for_nested_baseline_offset(baseline_offset);
}
/// From https://drafts.csswg.org/css2/visudet.html#line-height:
/// From <https://drafts.csswg.org/css2/visudet.html#line-height>:
/// > The inline-level boxes are aligned vertically according to their 'vertical-align'
/// > property. In case they are aligned 'top' or 'bottom', they must be aligned so as
/// > to minimize the line box height. If such boxes are tall enough, there are multiple
@ -475,7 +475,7 @@ struct InlineContainerState {
has_content: bool,
/// Indicates whether this nesting level have text decorations in effect.
/// From https://drafts.csswg.org/css-text-decor/#line-decoration
/// From <https://drafts.csswg.org/css-text-decor/#line-decoration>
// "When specified on or propagated to a block container that establishes
// an IFC..."
text_decoration_line: TextDecorationLine,
@ -483,7 +483,7 @@ struct InlineContainerState {
/// The block size contribution of this container's default font ie the size of the
/// "strut." Whether this is integrated into the [`Self::nested_strut_block_sizes`]
/// depends on the line-height quirk described in
/// https://quirks.spec.whatwg.org/#the-line-height-calculation-quirk.
/// <https://quirks.spec.whatwg.org/#the-line-height-calculation-quirk>.
strut_block_sizes: LineBlockSizes,
/// The strut block size of this inline container maxed with the strut block
@ -527,7 +527,7 @@ struct InlineFormattingContextState<'a, 'b> {
/// The [`InlineContainerState`] for the container formed by the root of the
/// [`InlineFormattingContext`]. This is effectively the "root inline box" described
/// by https://drafts.csswg.org/css-inline/#model:
/// by <https://drafts.csswg.org/css-inline/#model>:
///
/// > The block container also generates a root inline box, which is an anonymous
/// > inline box that holds all of its inline-level contents. (Thus, all text in an
@ -546,10 +546,10 @@ struct InlineFormattingContextState<'a, 'b> {
/// are currently laid out at the top-level of each [`InlineFormattingContext`].
fragments: Vec<Fragment>,
/// Information about the line currently being laid out into [`LineItems`]s.
/// Information about the line currently being laid out into [`LineItem`]s.
current_line: LineUnderConstruction,
/// Information about the unbreakable line segment currently being laid out into [`LineItems`]s.
/// Information about the unbreakable line segment currently being laid out into [`LineItem`]s.
current_line_segment: UnbreakableSegmentUnderConstruction,
/// The line breaking state for this inline formatting context.
@ -2183,7 +2183,7 @@ fn font_metrics_from_style(layout_context: &LayoutContext, style: &ComputedValue
/// comes before or after an atomic inline element.
///
/// From https://www.w3.org/TR/css-text-3/#line-break-details:
/// From <https://www.w3.org/TR/css-text-3/#line-break-details>:
///
/// > For Web-compatibility there is a soft wrap opportunity before and after each
/// > replaced element or other atomic inline, even when adjacent to a character that
@ -2213,7 +2213,7 @@ fn is_baseline_relative(vertical_align: GenericVerticalAlign<LengthPercentage>)
/// all inline containers get struts. In quirks mode this isn't always the case
/// though.
///
/// From https://quirks.spec.whatwg.org/#the-line-height-calculation-quirk
/// From <https://quirks.spec.whatwg.org/#the-line-height-calculation-quirk>
///
/// > ### § 3.3. The line height calculation quirk
/// > In quirks mode and limited-quirks mode, an inline box that matches the following

View file

@ -622,8 +622,8 @@ impl BlockLevelBox {
/// Lay out a normal flow non-replaced block that does not establish a new formatting
/// context.
///
/// - https://drafts.csswg.org/css2/visudet.html#blockwidth
/// - https://drafts.csswg.org/css2/visudet.html#normal-block
/// - <https://drafts.csswg.org/css2/visudet.html#blockwidth>
/// - <https://drafts.csswg.org/css2/visudet.html#normal-block>
fn layout_in_flow_non_replaced_block_level_same_formatting_context(
layout_context: &LayoutContext,
positioning_context: &mut PositioningContext,
@ -826,8 +826,8 @@ impl NonReplacedFormattingContext {
/// Lay out a normal in flow non-replaced block that establishes an independent
/// formatting context in its containing formatting context.
///
/// - https://drafts.csswg.org/css2/visudet.html#blockwidth
/// - https://drafts.csswg.org/css2/visudet.html#normal-block
/// - <https://drafts.csswg.org/css2/visudet.html#blockwidth>
/// - <https://drafts.csswg.org/css2/visudet.html#normal-block>
fn layout_in_flow_block_level(
&self,
layout_context: &LayoutContext,
@ -1119,9 +1119,9 @@ impl NonReplacedFormattingContext {
}
}
/// https://drafts.csswg.org/css2/visudet.html#block-replaced-width
/// https://drafts.csswg.org/css2/visudet.html#inline-replaced-width
/// https://drafts.csswg.org/css2/visudet.html#inline-replaced-height
/// <https://drafts.csswg.org/css2/visudet.html#block-replaced-width>
/// <https://drafts.csswg.org/css2/visudet.html#inline-replaced-width>
/// <https://drafts.csswg.org/css2/visudet.html#inline-replaced-height>
fn layout_in_flow_replaced_block_level<'a>(
containing_block: &ContainingBlock,
base_fragment_info: BaseFragmentInfo,

View file

@ -34,7 +34,7 @@ pub struct BoxTree {
/// There may be zero if that element has `display: none`.
root: BlockFormattingContext,
/// https://drafts.csswg.org/css-backgrounds/#special-backgrounds
/// <https://drafts.csswg.org/css-backgrounds/#special-backgrounds>
canvas_background: CanvasBackground,
}
@ -338,7 +338,7 @@ impl BoxTree {
}
}
/// https://drafts.csswg.org/css-backgrounds/#root-background
/// <https://drafts.csswg.org/css-backgrounds/#root-background>
#[derive(Clone, Serialize)]
pub struct CanvasBackground {
/// DOM node for the root element
@ -346,7 +346,7 @@ pub struct CanvasBackground {
/// The element whose style the canvas takes background properties from (see next field).
/// This can be the root element (same as the previous field), or the HTML `<body>` element.
/// See https://drafts.csswg.org/css-backgrounds/#body-background
/// See <https://drafts.csswg.org/css-backgrounds/#body-background>
pub from_element: OpaqueNode,
/// The computed styles to take background properties from.

View file

@ -24,7 +24,7 @@ use crate::style_ext::DisplayInside;
use crate::table::Table;
use crate::ContainingBlock;
/// https://drafts.csswg.org/css-display/#independent-formatting-context
/// <https://drafts.csswg.org/css-display/#independent-formatting-context>
#[derive(Debug, Serialize)]
pub(crate) enum IndependentFormattingContext {
NonReplaced(NonReplacedFormattingContext),
@ -62,7 +62,7 @@ pub(crate) enum NonReplacedFormattingContextContents {
pub(crate) struct IndependentLayout {
pub fragments: Vec<Fragment>,
/// https://drafts.csswg.org/css2/visudet.html#root-height
/// <https://drafts.csswg.org/css2/visudet.html#root-height>
pub content_block_size: Au,
/// The offset of the last inflow baseline of this layout in the content area, if

View file

@ -29,7 +29,7 @@ pub(crate) struct BoxFragment {
/// From the containing blocks start corner…?
/// This might be broken when the containing block is in a different writing mode:
/// https://drafts.csswg.org/css-writing-modes/#orthogonal-flows
/// <https://drafts.csswg.org/css-writing-modes/#orthogonal-flows>
pub content_rect: LogicalRect<Length>,
pub padding: LogicalSides<Length>,
@ -41,7 +41,7 @@ pub(crate) struct BoxFragment {
/// so that the element doesn't overlap earlier floats in the same BFC.
/// The presence of clearance prevents the top margin from collapsing with
/// earlier margins or with the bottom margin of the parent block.
/// https://drafts.csswg.org/css2/#clearance
/// <https://drafts.csswg.org/css2/#clearance>
pub clearance: Option<Length>,
/// When this box contains an inline formatting context, this tracks the baseline

View file

@ -15,7 +15,7 @@ pub(crate) struct ContainingBlockManager<'a, T> {
/// position is 'relative' or 'static', the containing block is formed by the
/// content edge of the nearest block container ancestor box." This is also
/// the case for 'position: sticky' elements.
/// https://www.w3.org/TR/CSS2/visudet.html#containing-block-details
/// <https://www.w3.org/TR/CSS2/visudet.html#containing-block-details>
pub for_non_absolute_descendants: &'a T,
/// The containing block for absolute descendants. "If the element has
@ -29,7 +29,7 @@ pub(crate) struct ContainingBlockManager<'a, T> {
/// undefined.
/// 2. Otherwise, the containing block is formed by the padding edge of the
/// ancestor."
/// https://www.w3.org/TR/CSS2/visudet.html#containing-block-details
/// <https://www.w3.org/TR/CSS2/visudet.html#containing-block-details>
/// If the ancestor forms a containing block for all descendants (see below),
/// this value will be None and absolute descendants will use the containing
/// block for fixed descendants.
@ -41,7 +41,7 @@ pub(crate) struct ContainingBlockManager<'a, T> {
/// establish a containing block for all descendants. Its padding box will be
/// used to layout for all of its absolute-position descendants,
/// fixed-position descendants, and descendant fixed background attachments."
/// https://w3c.github.io/csswg-drafts/css-transforms-1/#containing-block-for-all-descendants
/// <https://w3c.github.io/csswg-drafts/css-transforms-1/#containing-block-for-all-descendants>
/// See `ComputedValues::establishes_containing_block_for_all_descendants`
/// for a list of conditions where an element forms a containing block for
/// all descendants.

View file

@ -31,13 +31,13 @@ pub struct FragmentTree {
pub(crate) root_fragments: Vec<ArcRefCell<Fragment>>,
/// The scrollable overflow rectangle for the entire tree
/// https://drafts.csswg.org/css-overflow/#scrollable
/// <https://drafts.csswg.org/css-overflow/#scrollable>
pub(crate) scrollable_overflow: PhysicalRect<Length>,
/// The containing block used in the layout of this fragment tree.
pub(crate) initial_containing_block: PhysicalRect<Length>,
/// https://drafts.csswg.org/css-backgrounds/#special-backgrounds
/// <https://drafts.csswg.org/css-backgrounds/#special-backgrounds>
#[serde(skip)]
pub(crate) canvas_background: CanvasBackground,
}

View file

@ -11,7 +11,7 @@ use crate::dom::NodeExt;
use crate::dom_traversal::{NodeAndStyleInfo, PseudoElementContentItem};
use crate::replaced::ReplacedContent;
/// https://drafts.csswg.org/css-lists/#content-property
/// <https://drafts.csswg.org/css-lists/#content-property>
pub(crate) fn make_marker<'dom, Node>(
context: &LayoutContext,
info: &NodeAndStyleInfo<Node>,
@ -44,7 +44,7 @@ where
})
}
/// https://drafts.csswg.org/css-lists/#marker-string
/// <https://drafts.csswg.org/css-lists/#marker-string>
fn marker_string(style: &style_structs::List) -> Option<&'static str> {
match style.list_style_type {
ListStyleType::None => None,

View file

@ -755,13 +755,13 @@ struct AbsoluteAxisSolver<'a> {
impl<'a> AbsoluteAxisSolver<'a> {
/// This unifies some of the parts in common in:
///
/// * https://drafts.csswg.org/css2/visudet.html#abs-non-replaced-width
/// * https://drafts.csswg.org/css2/visudet.html#abs-non-replaced-height
/// * <https://drafts.csswg.org/css2/visudet.html#abs-non-replaced-width>
/// * <https://drafts.csswg.org/css2/visudet.html#abs-non-replaced-height>
///
/// … and:
///
/// * https://drafts.csswg.org/css2/visudet.html#abs-replaced-width
/// * https://drafts.csswg.org/css2/visudet.html#abs-replaced-height
/// * <https://drafts.csswg.org/css2/visudet.html#abs-replaced-width>
/// * <https://drafts.csswg.org/css2/visudet.html#abs-replaced-height>
///
/// In the replaced case, `size` is never `Auto`.
fn solve_for_size(&self, computed_size: LengthOrAuto) -> AxisResult {
@ -859,7 +859,7 @@ fn vec_append_owned<T>(a: &mut Vec<T>, mut b: Vec<T>) {
}
}
/// https://drafts.csswg.org/css2/visuren.html#relative-positioning
/// <https://drafts.csswg.org/css2/visuren.html#relative-positioning>
pub(crate) fn relative_adjustement(
style: &ComputedValues,
containing_block: &ContainingBlock,

View file

@ -199,7 +199,7 @@ pub fn process_node_scroll_id_request<'dom>(
layout_node.generate_scroll_id(id)
}
/// https://drafts.csswg.org/cssom-view/#scrolling-area
/// <https://drafts.csswg.org/cssom-view/#scrolling-area>
pub fn process_node_scroll_area_request(
requested_node: Option<OpaqueNode>,
fragment_tree: Option<Arc<FragmentTree>>,

View file

@ -38,18 +38,18 @@ pub(crate) struct ReplacedContent {
/// * Raster images always have an intrinsic width and height, with 1 image pixel = 1px.
/// The intrinsic ratio should be based on dividing those.
/// See https://github.com/w3c/csswg-drafts/issues/4572 for the case where either is zero.
/// See <https://github.com/w3c/csswg-drafts/issues/4572> for the case where either is zero.
/// PNG specifically disallows this but I (SimonSapin) am not sure about other formats.
///
/// * Form controls have both intrinsic width and height **but no intrinsic ratio**.
/// See https://github.com/w3c/csswg-drafts/issues/1044 and
/// https://drafts.csswg.org/css-images/#intrinsic-dimensions “In general, […]”
/// See <https://github.com/w3c/csswg-drafts/issues/1044> and
/// <https://drafts.csswg.org/css-images/#intrinsic-dimensions> “In general, […]”
///
/// * For SVG, see https://svgwg.org/svg2-draft/coords.html#SizingSVGInCSS
/// and again https://github.com/w3c/csswg-drafts/issues/4572.
/// * For SVG, see <https://svgwg.org/svg2-draft/coords.html#SizingSVGInCSS>
/// and again <https://github.com/w3c/csswg-drafts/issues/4572>.
///
/// * IFrames do not have intrinsic width and height or intrinsic ratio according
/// to https://drafts.csswg.org/css-images/#intrinsic-dimensions.
/// to <https://drafts.csswg.org/css-images/#intrinsic-dimensions>.
#[derive(Debug, Serialize)]
pub(crate) struct IntrinsicSizes {
pub width: Option<Au>,
@ -318,11 +318,11 @@ impl ReplacedContent {
}
}
/// https://drafts.csswg.org/css2/visudet.html#inline-replaced-width
/// https://drafts.csswg.org/css2/visudet.html#inline-replaced-height
/// <https://drafts.csswg.org/css2/visudet.html#inline-replaced-width>
/// <https://drafts.csswg.org/css2/visudet.html#inline-replaced-height>
///
/// Also used in other cases, for example
/// https://drafts.csswg.org/css2/visudet.html#block-replaced-width
/// <https://drafts.csswg.org/css2/visudet.html#block-replaced-width>
pub fn used_size_as_if_inline_element(
&self,
containing_block: &ContainingBlock,

View file

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
//! https://drafts.csswg.org/css-sizing/
//! <https://drafts.csswg.org/css-sizing/>
use serde::Serialize;
use style::logical_geometry::WritingMode;
@ -19,7 +19,7 @@ pub(crate) struct ContentSizes {
pub max_content: Length,
}
/// https://drafts.csswg.org/css-sizing/#intrinsic-sizes
/// <https://drafts.csswg.org/css-sizing/#intrinsic-sizes>
impl ContentSizes {
pub fn zero() -> Self {
Self {
@ -51,7 +51,7 @@ impl ContentSizes {
}
impl ContentSizes {
/// https://drafts.csswg.org/css2/visudet.html#shrink-to-fit-float
/// <https://drafts.csswg.org/css2/visudet.html#shrink-to-fit-float>
pub fn shrink_to_fit(&self, available_size: Length) -> Length {
available_size.max(self.min_content).min(self.max_content)
}

View file

@ -39,7 +39,7 @@ pub(crate) enum DisplayGeneratingBox {
outside: DisplayOutside,
inside: DisplayInside,
},
// https://drafts.csswg.org/css-display-3/#layout-specific-display
/// <https://drafts.csswg.org/css-display-3/#layout-specific-display>
LayoutInternal(DisplayLayoutInternal),
}
@ -63,7 +63,7 @@ pub(crate) enum DisplayOutside {
#[derive(Clone, Copy, Eq, PartialEq)]
pub(crate) enum DisplayInside {
// “list-items are limited to the Flow Layout display types”
// https://drafts.csswg.org/css-display/#list-items
// <https://drafts.csswg.org/css-display/#list-items>
Flow { is_list_item: bool },
FlowRoot { is_list_item: bool },
Flex,
@ -71,7 +71,7 @@ pub(crate) enum DisplayInside {
}
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
/// https://drafts.csswg.org/css-display-3/#layout-specific-display
/// <https://drafts.csswg.org/css-display-3/#layout-specific-display>
pub(crate) enum DisplayLayoutInternal {
TableCaption,
TableCell,
@ -84,7 +84,7 @@ pub(crate) enum DisplayLayoutInternal {
}
impl DisplayLayoutInternal {
/// https://drafts.csswg.org/css-display-3/#layout-specific-displa
/// <https://drafts.csswg.org/css-display-3/#layout-specific-displa>
pub(crate) fn display_inside(&self) -> DisplayInside {
// When we add ruby, the display_inside of ruby must be Flow.
// TODO: this should be unreachable for everything but
@ -407,7 +407,7 @@ impl ComputedValuesExt for ComputedValues {
}
/// Get the effective z-index of this fragment. Z-indices only apply to positioned elements
/// per CSS 2 9.9.1 (http://www.w3.org/TR/CSS2/visuren.html#z-index), so this value may differ
/// per CSS 2 9.9.1 (<http://www.w3.org/TR/CSS2/visuren.html#z-index>), so this value may differ
/// from the value specified in the style.
fn effective_z_index(&self) -> i32 {
match self.get_box().position {

View file

@ -303,7 +303,7 @@ impl TableBuilder {
}
}
/// https://html.spec.whatwg.org/multipage/#algorithm-for-processing-rows
/// <https://html.spec.whatwg.org/multipage/#algorithm-for-processing-rows>
/// Push a single cell onto the slot map, handling any colspans it may have, and
/// setting up the outgoing rowspans.
pub fn add_cell(&mut self, cell: TableSlotCell) {
@ -468,7 +468,7 @@ where
.push(AnonymousTableContent::Text(info.clone(), text));
}
/// https://html.spec.whatwg.org/multipage/#forming-a-table
/// <https://html.spec.whatwg.org/multipage/#forming-a-table>
fn handle_element(
&mut self,
info: &NodeAndStyleInfo<Node>,
@ -646,7 +646,7 @@ where
.push(AnonymousTableContent::Text(info.clone(), text));
}
/// https://html.spec.whatwg.org/multipage/#algorithm-for-processing-rows
/// <https://html.spec.whatwg.org/multipage/#algorithm-for-processing-rows>
fn handle_element(
&mut self,
info: &NodeAndStyleInfo<Node>,

View file

@ -139,7 +139,7 @@ pub enum TableSlot {
///
/// If there is more than one cell that spans a slot, this is a table model error, but
/// we still keep track of it. See
/// https://html.spec.whatwg.org/multipage/#table-model-error
/// <https://html.spec.whatwg.org/multipage/#table-model-error>
Spanned(Vec<TableSlotOffset>),
/// An empty spot in the table. This can happen when there is a gap in columns between