Skip to content

[3.0] Theme split (wave 8, part 4) — clear floats with inline-start and inline-end - #9571

Open
albertlast wants to merge 4 commits into
SimpleMachines:release-3.0from
albertlast:3.0/theme-rtl-clear
Open

[3.0] Theme split (wave 8, part 4) — clear floats with inline-start and inline-end#9571
albertlast wants to merge 4 commits into
SimpleMachines:release-3.0from
albertlast:3.0/theme-rtl-clear

Conversation

@albertlast

Copy link
Copy Markdown
Collaborator

Description

Part 4 of wave 8 of the #7933 split. Stacked on #9570, which is stacked on #9569 and
#9568.

clear: inline-start and clear: inline-end follow the writing direction, so the three
places where rtl.css did nothing but mirror the side no longer need an override.
clear: both is unaffected and untouched.

The one group left alone, and why

index.css clears five selectors together — .signature, .attachments,
.under_message, .custom_fields_above_signature and .custom_fields_below_signature
but rtl.css mirrors only three of them. Converting the group would also start mirroring
.under_message and .custom_fields_below_signature, which is a behaviour change, not
a no-op
, so the group keeps its physical value here.

Whether those two are missing from rtl.css by accident is worth deciding on its own.
It is not a question about dead code — all three of the classes involved are emitted by
the templates, so the asymmetry is real and visible in a right-to-left language.

How this was checked

Same method as parts 2 and 3, on 29 pages captured back to back across a stash.

One addition worth noting: a poll had to be posted and voted on first. The
#poll_options dl.options dt rule is one of the three being converted, and none of the
existing sweep pages reached it — the results list only renders once a vote has been cast,
so before that the check would have passed without ever exercising the rule. With the poll
in place the sweep covers all three.

elements differences
left-to-right 9735 5, all the clear keyword
right-to-left 9735 5, all the clear keyword

No geometry moved in either direction.

rtl.css goes from 453 lines to 442.

Issues References (Fixes|Related|Closes)

Related to #7933.

rtl.css exists to flip physical properties for right-to-left languages, so
every rule in it is an override of something another stylesheet draws. Sixteen
of them override markup the theme stopped emitting, and have been dead for
some time:

- the event editor was rewritten and now draws no ul at all, which takes out
  the whole "edit event section" block plus the two #event_main rules
- .bbc_standard_quote and .bbc_alternate_quote were checked and kept: those
  class names are built at runtime in BBCodeParser, so grepping for them finds
  nothing even though the markup does emit them
- the rest name ids and classes that appear nowhere in Themes/ or Sources/:
  #postbuttons_upper, .reportlinks, #personal_messages span#author and
  span#topic_title, h3.search_hd, #popularposts, #popularactivity,
  .topic .mod_icons, .stats_icon, .search_results_posts .buttons and
  #helpmain h3.section

Checked by loading 24 pages as an administrator with a right-to-left language
active, including the event editor, the statistics centre, help, search
results and the personal messages area: 7086 elements, and not one of the
removed selectors matches any of them.

.topic .mod_icons is the counterpart of the index.css rule removed in SimpleMachines#9547,
which left this copy behind.

Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
float: inline-start and float: inline-end follow the writing direction on
their own, so a rule that uses them needs no right-to-left counterpart. This
converts the 26 floats where rtl.css was doing nothing more than mirroring the
value, and drops those overrides.

The 26 are the ones where the override is an exact mirror: index.css and
profile.css say left and rtl.css says right, or the other way round. Floats
whose right-to-left value is not the mirror of the left-to-right one are left
alone, because a single logical declaration cannot reproduce two different
values; the same goes for the floats rtl.css adds where the base sheet has
none.

#post_header dt/dd shared a rule with #event_options dt/dd, and only the first
pair has a mirror in rtl.css. Converting the pair together would have started
mirroring the event editor, which is not mirrored today, so the rule is split
and #event_options keeps a physical float with a comment saying why.

Checked by recording float, clear, text-align, the inline margins and padding,
and the bounding rectangle of every element on 26 pages, before and after,
captured back to back so nothing else about the forum could move in between:

- left-to-right: 8018 elements, the only differences are the 82 float keywords
  themselves. No geometry changes at all.
- right-to-left: 8017 elements, 81 float keywords, and again nothing else.

The keyword is expected to differ: getComputedStyle reports inline-start
rather than resolving it to left or right. What matters is that every x, y,
width, height, margin and padding is identical in both directions.

rtl.css goes from 555 lines to 480.

Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
text-align: start and text-align: end follow the writing direction, so the
eleven places where rtl.css did nothing but mirror the alignment no longer
need an override.

As with the floats, only exact mirrors are converted: the base sheet says left
and rtl.css says right, or the reverse. Alignments that rtl.css sets where the
base sheet has none are left alone, and so are the deliberate ones - code
blocks and file contents stay left-aligned in a right-to-left language on
purpose, and that rule is untouched.

Two rules needed care rather than a substitution:

- #main_grid td.days shares its rule with #month_grid td.days, but the mini
  calendar re-declares text-align: center immediately below, so the shared
  value never reaches it and the group is safe to convert.
- rtl.css aligned #stats tr.windowbg th.lefttext and #stats tr.titlebg
  th.lefttext together, and only the windowbg half has a rule to mirror. The
  titlebg half is aligned by .lefttext instead, so it keeps its override, now
  with a comment saying why it is on its own.

Checked the same way as the floats, capturing every element on 28 pages before
and after, back to back, with text-align and direction recorded alongside the
geometry:

- left-to-right: 8996 elements, 119 differences, every one the text-align
  keyword
- right-to-left: 8995 elements, 119 differences, likewise

No geometry moved in either direction. The count is higher than the eleven
converted rules because text-align inherits, so the children report the new
keyword too.

rtl.css goes from 480 lines to 453.

Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
clear: inline-start and clear: inline-end follow the writing direction, so the
three places where rtl.css only mirrored the side no longer need an override.
clear: both is unaffected and untouched.

One group is deliberately left alone. index.css clears .signature,
.attachments, .under_message, .custom_fields_above_signature and
.custom_fields_below_signature together, but rtl.css mirrors only the first,
second and fourth of those. Converting the group would start mirroring
.under_message and .custom_fields_below_signature as well, which is a change in
behaviour rather than a no-op, so the group keeps its physical value. Whether
the two missing from rtl.css are an oversight is worth deciding separately -
all three appear in the markup, so it is not a question about dead code.

Checked as before, on 29 pages captured back to back. A poll was posted and
voted on first, because #poll_options dl.options only renders once results are
visible and none of the existing pages reached it:

- left-to-right: 9735 elements, 5 differences, all the clear keyword
- right-to-left: 9735 elements, 5 differences, all the clear keyword

No geometry moved in either direction.

rtl.css goes from 453 lines to 442.

Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants