Commit graph

94 commits

Author SHA1 Message Date
Jon Robson
210b3b726c Remove the ResourceLoaderSkinModule legacy feature stylesheet
Bug: T304325
Change-Id: Ibd1edd2b50056a15e99576e3d42f7eba01f31fc4
2022-03-23 10:20:09 -07:00
Jon Robson
9bd3af32fc Update installer to reflect modern logos
There are now 4 types of logos, only one of which is needed.
Update documentation in installer to reflect this.
Also make it possible to drag and drop files into the installer
and see live previews of what the logos will look like to aid
setup.

The 1x is no longer required.

Bug: T255913
Change-Id: I58226ae8fb02c32d2eeea65a50aaabbc193cb51c
2022-03-10 16:48:39 +00:00
Jon Robson
57dcba01b2 resourceloader: Change SkinModule list mode to not add implicit features
If a skin e.g. Minerva is using an opt-in policy then it has already
decided what features to load. It should not be subjected to features
it hasn't requested.

This was leading to content-external-links being loaded in Minerva
since 8c1afd97a3.

Bug: T298433
Change-Id: I621621bc2d30ee9ce00decbdee0f55c4db65abc1
2022-01-26 21:51:19 +00:00
Siddharth VP
38295f9226 Fix typos in comments (N-R)
Change-Id: I2d1bdb7531ff5126114a391550c2615ea6e244b3
2022-01-09 23:14:44 +05:30
Arlo Breault
28062181f9 Add content-media print styles
* Magnify clip isn't present in print styling
* Print and screen thumbborder are different
* Print thumbinner and thumbimage borders are absent

Bug: T287965
Change-Id: Ie1dac57412da7da3e73eb39ef20a6077923860d6
2021-12-09 11:42:05 -05:00
Arlo Breault
d8b625013c Rename content.thumbnails.less with -screen
Follow up to I076fddda07dd734f76277376ba6361bff68b7c36

Also, adds a comment about -legacy being frozen.

Change-Id: Iced54fb31c967975248bfc9908d904fa41824307
2021-11-30 15:02:04 -05:00
Arlo Breault
7eb9972ba0 Pull out commonality between thumbnails and print styles
This helps highlight what's different between the two.

Change-Id: I076fddda07dd734f76277376ba6361bff68b7c36
2021-11-09 21:11:31 -05:00
Arlo Breault
8b5f95a963 Add a separate config for content.media.less
It's already shipped when $wgParserEnableLegacyMediaDOM is disabled, but
having separate config for it will allow us to leave it enabled should
we re-enable $wgParserEnableLegacyMediaDOM and still have content in
the cache that needs styling.

Bug: T292498
Bug: T51097
Change-Id: I027d3a718b0c1a3eebe4b55983540ad2f28d229a
2021-10-05 18:50:17 -04:00
Volker E
565b14c234 resourceloader: Remove -moz- vendor prefix from SkinModule css
Our basic support has been updated and Firefox supports replacement
`resolution` since version 8 or 16, depending which data source
one checks.
WebKit's support is a bit more complex and it seems like safest bet is
to leave its vendor prefix in for now.

Bug: T277803
Change-Id: I752f0b67672759824099b4b78892d143344e766f
2021-09-14 00:22:00 +00:00
Jdlrobson
4de7250830 Logos defined with pixels should be scaleable in browsers
This reverts commit bc200b6a1a reapplying
the patch. It has been modified slightly to temporarily work
with the beta cluster's unsupported configuration.

Bug: T207038
Change-Id: Ie86a5b59fbf93a400796a4cac3724207830092b5
2021-09-08 14:10:10 -07:00
Thcipriani
bc200b6a1a Revert "Logos defined with pixels should be scaleable in browsers"
This reverts commit 33ac451d3d.

Reason for revert: /wiki/Special:Version TypeError: Argument 1 passed to ResourceLoaderSkinModule::getRelativeSizedLogo() must be of the type array, boolean given, called in includes/resourceloader/ResourceLoaderSkinModule.php on line 600

Change-Id: Iddeb33d6165169dc106e9beb3e4a703a4b97eeb6
2021-09-08 20:13:32 +00:00
jdlrobson
33ac451d3d Logos defined with pixels should be scaleable in browsers
Bug: T207789
Change-Id: I358d2aa4b7e08a6507c87277dcfd29413efd0d6c
2021-09-08 18:32:37 +00:00
Umherirrender
a2e6ff11f3 resourceloader: Avoid same named variables in inner and outer foreach
Change-Id: I308ba9c607ba56b6d8ebf7d5f56d9e19d217d946
2021-09-04 00:28:20 +02:00
jdlrobson
4f856707be ResourceLoaderSkinModule: content, content-thumbnails and legacy features are deprecated
Frontend deprecation notices show up in the developer console
and are not logged in error logs, so it is okay to merge this
prior to the required changes to the Vector skin.

Bug: T89981
Change-Id: I6dfe9ad62ddc180bf47bdd2ec72973d82ec84418
2021-08-05 15:43:48 +00:00
libraryupgrader
5357695270 build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0
  The following sniffs now pass and were enabled:
  * Generic.ControlStructures.InlineControlStructure
  * MediaWiki.PHPUnit.AssertCount.NotUsed

npm:
* svgo: 2.3.0 → 2.3.1
  * https://npmjs.com/advisories/1754 (CVE-2021-33587)

Change-Id: I2a9bbee2fecbf7259876d335f565ece4b3622426
2021-07-22 03:36:05 +00:00
Arlo Breault
fdd8f864b8 Emit media structure as piloted in Parsoid
Gated behind the flag $wgParserEnableLegacyMediaDOM.  The scattershot
usage of it is a little unfortunate but isn't expected to live very long
so maybe that's acceptable.

Further details can be found at,
https://www.mediawiki.org/wiki/Parsing/Media_structure

Bug: T51097
Bug: T266148
Bug: T271129
Change-Id: I978187f9f6e9e0a105521ab3e26821e36a96b911
2021-06-24 23:32:40 +00:00
jdlrobson
53c0fa5f59 ResourceLoaderSkinModule: Deprecated feature keys should be mapped
`content` should be mapped to `content-thumbnails` when using list mode
rather than throwing a fatal.

Bug: T271441
Change-Id: Idb30a94803f1432e2c1f57d55eb8c8aef1368dfb
2021-06-02 17:37:49 +00:00
jdlrobson
d2ed0d1683 Merge content-media and content-thumbnails
The value of content-media now depends on configuration.
These modules can be merged, as the expectation is both should
apply when the UseNewMediaStructure configuration flag is enabled.

For backwards compatibility map any content-thumbnail requests to
content-media

Bug: T278560
Change-Id: I10ba53b1ee217eae9e05182e989d56f5dc107722
2021-05-27 00:26:54 +00:00
Timo Tijhof
0be2e83ef4 resourceloader: Restore feedback for SkinModule invalid argument
This was added in 381499a675 in response to the issue that when a skin
adopts a feature that was new in MW 1.36, it caused an exception when
that version of the skin is then installed on MW 1.35. That's expected,
and generally helpful because the default support policy requires
like-for-like (MW 1.35 with REL1_35, this applies to all skins and
extensions, except for a few like Translate and SemanticMediaWiki).

However, while supporting LTS within master is unusual, there are
indeed the Translate/SemanticMediaWiki projects, and this problem has
already been solved years ago there by using a conditional with
$wgVersion. The proposed approach on T271441 actually also involves
such a conditional, but late at runtime instead of in the module
definition. Anyway, the way it was fixed in Timeless already solves
the problem by not passing down the invalid feature in the first
place, thus making the 381499a675 patch obsolete. I'm not aware of
any skin in Gerrit having such a compat policy, but if they exist,
they can fix it the same way, by defining the module in code with
a condition, just as Translate/SemanticMediaWiki do.

Bug: T271441
Change-Id: If97b3d04ac1e3355ee4f229db11e524d24ebd27a
2021-05-14 20:30:15 +00:00
Timo Tijhof
ae1db0cff0 resourceloader: Fix reliance on global state in SkinModule
* Remove odd use of ResourceLoaderFileModule::extractBasePaths()
  SkinModule.php which was basically just returning $IP.

* Use getConfig()->get('ResourceBasePath') so that the test does
  not need to override global configuration variables.

Follows-up 6845912bcf and f1457312dc.

Bug: T277728
Change-Id: I64262b48bb5dc71c53b4114eddb2f080a6a076f5
2021-05-14 20:29:53 +00:00
Timo Tijhof
2c8a8122a4 resourceloader: Simplify 'features' processing in SkinModule constructor
* Remove confusing dead code for T271441, as a continue statement at
  the end of a loop body does not do anything. I'll reinstate the
  exception once we've looked at whatever skin caused the issue and
  have fixed those repos to not pass invalid options.

* Simplify list creation by avoiding the loops and duplicate logic.
  Assign the list directly when possible, and otherwise store the
  filtered keys.

* Remove unexpected access to `$this->getConfig()` in the constructor.
  Follows-up a6c769e976, which worked by accident due to it defaulting
  to global state. The injection from ResourceLoader::getModule happens
  after the constructor. I am working on a patch to enforce this, and
  thus this change needs to land first.

  I've moved the logic to getStyleFiles() and boldly changed it to be
  a simple skip rather than based on whether it was specified. If this
  is a problem we can find a more complex way, but I wanted to try this
  first. It seems there is no reason to load these, specified or not,
  when the parser feature is not enabled. (Ref T266148)

  The unit test was working around this violation in a similar way,
  which is now redundant and removed in this patch.

* Document that compatibility method only works on map-form.

* Make applyFeaturesCompatibility() an internal and protected
  method. I don't think we'd support extensions calling this
  directly.

* Limit applyFeaturesCompatibility() to just dealing with
  the features array instead of also handling other options
  and applying of the default value.

Bug: T277728
Change-Id: I24a2b783570c888cedee66885647b3ed765e0132
2021-05-14 19:58:36 +00:00
jdlrobson
7cda5b0bf8 Make mw-content-body universal to all skins
1) Rename content-parser-output to `content-body`

Widen the scope of this module to apply to anything that can be rendered
as the article body. Improve the documentation on what is allowed here.

For early-adopter skins already using content-parser-output,
map the feature to the new name and add tests.

2) Reclaim the `mw-body-content` class for result of
SkinTemplate::wrapHTML

The `mw-body-content` has been used in skins to wrap various elements.
Going forward we will use it to wrap any HTML content generated by
OutputPage.

See dependent patches, which we're not directly depending on to avoid
a CI gremlin:

 - I90d85c21f4a62e6697f24e3ce388445a0a53c2b0 (MonoBook)
 - I11242e243c9a529b72972089af9ac2a8c906331a (Modern)
 - I87942c60e62f6f14acdfeaa1836ace4eac9252ac (CologneBlue)
 - I4c1b15d90bacbc9b13782a1d8f52e838ce8ecd83 (Vector)

Bug: T279388
Change-Id: I3a91b294fcb3724cd46743e497dff723de0490a6
2021-05-13 16:53:52 -07:00
jdlrobson
ef951618d5 Create the content-links (and -external) ResourceLoaderSkinModule feature
After talking to Volker, the `elements` feature should not contain any
CSS classes. It should apply only on the tag level. I've updated documentation
to explain what's permitted here.

The link styling rules added in  b24bff67ed are instead added to a new
feature `content-links`. The existing `content-links` is renamed to
`content-links-external` and for backwards compatibility anyone enabling
`content-links` without `content-links-external` will get the new styles.

The existing legacy feature for backwards compatibility loads the `content-links`
feature which addresses the problem in Timeless with plainlinks styling being lost.

Bug: T279693
Bug: T255717
Bug: T278576
Change-Id: I6e55ed2880782533ea61df98cf16dbf36483d895
2021-04-22 18:32:23 +00:00
jdlrobson
6da17fd35d ResourceLoaderSkinModule: When toc is enabled messages are empty
Only the `toc` feature requires access to messages. When that feature
is not enabled, do not load unnecessary messages.

Note, this will not fix the installer right away,
but will be needed to fix the
installer in addition to the change in
I0e3ba3c2cfa64bba49e3944d93e0c802b553bac8.

Bug: T270027
Change-Id: I3905bc2c3244ae2308c641bbabb097f62c666041
2021-04-19 15:52:39 +00:00
mainframe98
5e7076f21e Move legacy commonPrint styles to appropriate skin features
Bug: T89981
Change-Id: I89acedce17bd167734da3b8b13d65aa94eb0845f
2021-03-31 21:50:05 +00:00
jdlrobson
c504f19f1f ResourceLoaderSkinModule: content => toc, content-thumbnails
The `content` feature is too ambigious in meaning.
Moving all the styles relating to the table of contents reduces
the content feature to a group of image styles.

CSS rules for Tidy are legacy, added to the new
content.parser-output.less feature which defaults to on for all skins.

Bug: T269877
Change-Id: Ica54358576ee59c4cb75ef941421e8c0329336d9
2021-03-30 21:04:17 +00:00
jdlrobson
188054a452 ResourceLoader: Correct documentation of skin module
The documentation names the feature as `category-interface` when
actually it is called `interface-category`.

Bug: T278373
Change-Id: I87ea9008c20ff846250a008b4f187439923b0f6c
2021-03-30 01:38:30 +00:00
Volker E
55f6137557 mediawiki.skinning: Change 'elements' file to LESS and remove obsolete property
Changing module file to LESS in order to use mediawiki.mixins to get
rid of obsolete `-webkit-box-sizing` property.

Bug: T277803
Change-Id: Ic292549e3cad616cb01e7a5eb8f8e039bc11d121
2021-03-26 07:49:18 -07:00
jenkins-bot
9334bb3428 Merge "Create a content-tables feature split from legacy" 2021-03-25 22:55:04 +00:00
mainframe98
59f0f389ab split legacy category styles into interface-category feature
The new stylesheet is imported in legacy for backwards-compatibility.

Bug: T278373
Change-Id: Ief4fafb8fcba23fb8cd5806404789261a20b0f18
2021-03-25 21:43:19 +00:00
mainframe98
c1306ade06 Create a content-tables feature split from legacy
The content-tables feature contains the styles for .wikitable, a
commonly used style of tables. The print styles for this table have
been included under the print media, split from commonPrint.css.
These styles are imported into commonPrint.css, which has changed
to use Less for this.
The .mw_metadata styles in commonPrint.css have been moved to the
resource loader module that already contains the other .mw_metadata
styles.

Bug: T278401

Change-Id: I37db62f466d8fdf8c9dc8adfdf497a0b7af9b6b2
2021-03-25 13:49:23 +01:00
jdlrobson
ef11e30e0c The new content-parser-output feature is documented and enabled by default
This is a reasonable default for all skins and is small enough
to not be a concern for existing skins.

Also: expand documentation so this is understood better.

Bug: T277218
Change-Id: Ia58037e2c32d76d5c7125772a3243b76ede45f3f
2021-03-25 00:44:42 +00:00
Ammarpad
5fa77dbe64 ResourceLoaderSkinModule: Add content-parser-output feature
Add rule to clear floated user contents.

Bug: T277218
Change-Id: I52f752aa782b09a51e2165300cc75d0e47fa3351
2021-03-23 20:41:18 +00:00
mainframe98
0f96eebe18 Split messageBoxes.less from the legacy skin feature
Bug: T257521
Change-Id: I86242c7fa32a32d5f98a2493abf8990412606b2e
2021-03-23 09:39:04 +01:00
Timo Tijhof
245bdafd9e resourceloader: Add wikimedia/minify package and remove local copies
- JavaScriptMinifier: The public interface for this internal class is
  ResourceLoader::filter which, except for one caller (minify.php)
  is indeed consistently used already, no other callers need replacing.

- CSSMin: Idem for minification, however, this class has some other
  method as well, which have a number of internal users, but none
  outside core. These have all been replaced in this commit.

- Remove pear/net_url2 as own dependency as this was only used by CSSMin
  and recently added there. This is now a dependency of wikimedia/minify
  instead. This was not part of the public API and no longer mentioned
  here in composer.json or RELEASE-NOTES. (It remains pinned in
  mediawiki-vendor, however.)

Bug: T273247
Depends-On: Iadff8c2112d5e53bd994ab4882006e8c644a2379
Depends-On: Id3c6dcc0b952a9efe34b3a9ed88b716101a51f87
Depends-On: I589be910f57289fd908b22db87241b0e52da60d4
Change-Id: I8d71fc64aeecdb31db218b02e361ae9bb0d19b48
2021-02-24 21:03:02 +00:00
Umherirrender
8de3b7d324 Use static closures where safe to use
This is micro-optimization of closure code to avoid binding the closure
to $this where it is not needed.

Created by I25a17fb22b6b669e817317a0f45051ae9c608208

Change-Id: I0ffc6200f6c6693d78a3151cb8cea7dce7c21653
2021-02-11 00:13:52 +00:00
jdlrobson
f1457312dc Feature file styles should precede module defined ones
In the case of Monobook, Monobook styles were overriding a
normalize rule and failing to work.

Bug: T269618
Change-Id: Ifa346f60e3a50d874e68043dc4dece3fd8b41aa3
2021-01-12 14:04:02 -08:00
jenkins-bot
fc86a363d1 Merge "Unknown features shouldn't break style output" 2021-01-08 20:59:15 +00:00
jdlrobson
0102f3affa Respect lessMessages option
Uncovered while working on a side project. If the option has been
set, it should be merged with the ResourceLoaderSkinModule property.
It should not replace it.

Change-Id: I413c862afe7e5266ab9f2635211fac635bcd786d
2021-01-08 01:07:55 +00:00
jdlrobson
381499a675 Unknown features shouldn't break style output
If a new feature is added, it should be safe for skins to use it
without breaking their backwards compatibility.

For example if the normalize feature in 1.36 is being used a skin
should be able to use it, and then using version_compare add additional
styles for older versions of mediawiki

Bug: T271441
Change-Id: I074415970455ef701b48d11ff97c01af24197eeb
2021-01-07 09:18:18 -08:00
jdlrobson
4a287f9217 ResourceLoaderSkinModule defines the order of feature styles
Previously, the order of styles outputted by this module was
arbitrary, based on the order of the feature files passed in.

This was not how it was intended to work - the ResourceLoaderSkinModule
should be aware of the correct ordering.

In the case of normalize for example - it should always be the first
file output.

The implementation is adapted to check for valid features once in
the constructor and to also consider a DEFAULT_FEATURES value has been
set.

We  use the FEATURE_FILES constant to determine
the order of CSS output.

This is all documented in the class.

Bug: T269618
Change-Id: Iecbf11b5f09882e55d694651210d6d132d3cd412
2020-12-15 02:11:22 +00:00
Arlo Breault
a6c769e976 Share Parsoid's media styling with content
Since the legacy parser will also be emitting the new media structure
that requires these styles.  For now, the feature is only shipped by
default when $wgUseNewMediaStructure is enabled.

Bug: T51097
Bug: T266148
Change-Id: Id20d716ce145e0bae37621fd6e218a793b5332ae
2020-12-11 11:47:00 -05:00
jdlrobson
977a9754b2 Convert mediawiki.skinning/content.css to a LESS file
Simple rename.
This is needed in preparation for
Id20d716ce145e0bae37621fd6e218a793b5332ae

Change-Id: Ic7ae922ae6529c1804178fbe8016736600115a0b
2020-12-09 10:12:15 -08:00
jenkins-bot
94790a79b9 Merge "The mediawiki.skinning.content.externallinks styles are moved into ResourceLoaderSkinModule" 2020-12-04 22:39:11 +00:00
jdlrobson
63c4125a29 The mediawiki.skinning.content.externallinks styles are moved into ResourceLoaderSkinModule
Going forward all skins will have a single ResourceLoader module
defining their styles.

This deprecates the module moving its functionality into ResourceLoaderSkinModule.
Skins can continue to get those styles by enabling the new feature in their
main module.

Bug: T267577
Change-Id: I27c9f2c6ed9e4014afb231f690190c67b03b5d02
2020-11-23 11:26:01 +00:00
DannyS712
a7e284a63c resourceloader: minor readability cleanup in ResourceLoaderSkinModule
Use early returns to reduce levels of indentation.
Simplify returning arrays in getLogoPreloadlinks.
Should be a no-op.

Change-Id: I8d6cbfe61de14ded56c09943c6cf4d7b96ea092c
2020-11-22 22:15:11 +00:00
jdlrobson
4e5427f520 ResourceLoaderSkinModule: Move edit link into interface feature
While working on the Example skin we noticed that the edit section
links and hiding of the print footer are important styles.

Rather than making the Example skin inherit the legacy feature, these
essential rules are added to the existing interface styles.

For backwards compatibility, legacy continues to ship the interface
edit links.

For skins loading both interface and legacy, the styles will be loaded
twice but we will lean on gzip to avoid an increase in CSS bytes

Bug: T89981
Change-Id: I7d35b44fc8c135320dfd1d99b16ba47ebaac876b
2020-11-17 13:00:44 -08:00
jdlrobson
db3c8ea16b Add new 'toc' feature to ResourceLoaderSkinModule
The table of content styles will now be loaded on all pages rather than
just pages which have it. This will lead to less stylesheet fragmentation
across page views.

Skins in WMF production were updated long ago to automatically opt
into new features so will automatically gain this module:
I98b7e49b8a3bcba31284385d2f45e0164df2fbb4
I50afd035360ff2eccd5a934a02a218d093f9583d
I5b3920ae6e98111582b93e60a2b9950c478bff7d
If9283742a83ecfbe8c4246e3624022a56be8f161
If9ae25c41b91a8b47c154f0fd98984eac526654f

Skins that are using ResourceLoaderSkinModule with opt-in approach or
the existing mediawiki.skinning.interface, will automatically get these
new styles. Skins that are use neither of these mechanisms will need to
be modified if they wish to retain the collapsing functionality of the
table of contents. As of now, I am not aware of any such skins.

Note in a follow-up, the mediawiki.toc.styles module will be marked as
deprecated in 1.35. This is done separately to allow WMF caches
some time to roll over to the new code first.

Bug: T252774
Change-Id: Ie28b7e732664eb332be795d7e33cd9a227c21370
2020-11-16 20:33:05 +00:00
Thiemo Kreuz
b0130ca649 Update a lot of unspecific "array" types in PHPDocs
This includes fixing some mistakes, as well as removing
redundant text that doesn't add new information, either because
it literally repeats what the code already says, or is actually
duplicated.

Change-Id: I3a8dd8ce57192deda8916cc444c87d7ab1a36515
2020-10-28 11:01:33 +01:00
Cindy Cicalese
3e818d30dc Only preload logo if the optional logo feature is enabled.
Bug: T265507
Change-Id: I5731dd3c5da73b6e6b45c4160f5a82fb399866d8
2020-10-21 13:50:25 -04:00