Skip to content

Commit

Permalink
style: Update comments to no longer point to nsRuleNode.
Browse files Browse the repository at this point in the history
There are a few mentions of nsRuleNode left but they are mostly
historical references so it makes sense to keep them.

Differential Revision: https://phabricator.services.mozilla.com/D5505
  • Loading branch information
heycam authored and emilio committed Sep 15, 2018
1 parent 6d57cbd commit 1f45fc0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
24 changes: 13 additions & 11 deletions components/style/properties/gecko.mako.rs
Expand Up @@ -2403,7 +2403,8 @@ fn static_assert() {
/// Calculates the constrained and unconstrained font sizes to be inherited
/// from the parent.
///
/// See ComputeScriptLevelSize in Gecko's nsRuleNode.cpp
/// This is a port of Gecko's old ComputeScriptLevelSize function:
/// https://dxr.mozilla.org/mozilla-central/rev/35fbf14b9/layout/style/nsRuleNode.cpp#3197-3254
///
/// scriptlevel is a property that affects how font-size is inherited. If scriptlevel is
/// +1, for example, it will inherit as the script size multiplier times
Expand Down Expand Up @@ -2511,17 +2512,18 @@ fn static_assert() {
= self.calculate_script_level_size(parent, device);
if adjusted_size.0 != parent.gecko.mSize ||
adjusted_unconstrained_size.0 != parent.gecko.mScriptUnconstrainedSize {
// This is incorrect. When there is both a keyword size being inherited
// and a scriptlevel change, we must handle the keyword size the same
// way we handle em units. This complicates things because we now have
// to keep track of the adjusted and unadjusted ratios in the kw font size.
// This only affects the use case of a generic font being used in MathML.
// FIXME(Manishearth): This is incorrect. When there is both a
// keyword size being inherited and a scriptlevel change, we must
// handle the keyword size the same way we handle em units. This
// complicates things because we now have to keep track of the
// adjusted and unadjusted ratios in the kw font size. This only
// affects the use case of a generic font being used in MathML.
//
// If we were to fix this I would prefer doing it by removing the
// ruletree walk on the Gecko side in nsRuleNode::SetGenericFont
// and instead using extra bookkeeping in the mSize and mScriptUnconstrainedSize
// values, and reusing those instead of font_size_keyword.

// If we were to fix this I would prefer doing it not doing
// something like the ruletree walk that Gecko used to do in
// nsRuleNode::SetGenericFont and instead using extra bookkeeping in
// the mSize and mScriptUnconstrainedSize values, and reusing those
// instead of font_size_keyword.

// In the case that MathML has given us an adjusted size, apply it.
// Keep track of the unconstrained adjusted size.
Expand Down
3 changes: 0 additions & 3 deletions components/style/rule_tree/mod.rs
Expand Up @@ -1200,9 +1200,6 @@ impl StrongRuleNode {
}
}

/// Implementation of `nsRuleNode::HasAuthorSpecifiedRules` for Servo rule
/// nodes.
///
/// Returns true if any properties specified by `rule_type_mask` was set by
/// an author rule.
#[cfg(feature = "gecko")]
Expand Down
10 changes: 6 additions & 4 deletions components/style/values/specified/font.rs
Expand Up @@ -746,7 +746,12 @@ impl ToComputedValue for KeywordSize {
fn to_computed_value(&self, cx: &Context) -> NonNegativeLength {
use context::QuirksMode;
use values::specified::length::au_to_int_px;
// Data from nsRuleNode.cpp in Gecko

// The tables in this function are originally from
// nsRuleNode::CalcFontPointSize in Gecko:
//
// https://dxr.mozilla.org/mozilla-central/rev/35fbf14b9/layout/style/nsRuleNode.cpp#3262-3336

// Mapping from base size and HTML size to pixels
// The first index is (base_size - 9), the second is the
// HTML size. "0" is CSS keyword xx-small, not HTML size 0,
Expand All @@ -765,9 +770,6 @@ impl ToComputedValue for KeywordSize {
[9, 10, 13, 16, 18, 24, 32, 48],
];

// Data from nsRuleNode.cpp in Gecko
// (https://dxr.mozilla.org/mozilla-central/rev/35fbf14b9/layout/style/nsRuleNode.cpp#3303)
//
// This table gives us compatibility with WinNav4 for the default fonts only.
// In WinNav4, the default fonts were:
//
Expand Down

0 comments on commit 1f45fc0

Please sign in to comment.