displaytitle: reject some CSS if $wgRestrictDisplayTitle set
authorMatmaRex <matma.rex@gmail.com>
Wed, 22 May 2013 08:48:14 +0000 (10:48 +0200)
committerMatmaRex <matma.rex@gmail.com>
Fri, 24 May 2013 13:05:37 +0000 (15:05 +0200)
commit267b582e1620db8d13684001389c4f2e541f9d39
tree0cda05af670be4ba5112a9497ea0a8bbcd93e762
parent3a7e36b2d6f7a77ee1fbc356f277ee4bf0aeb60c
displaytitle: reject some CSS if $wgRestrictDisplayTitle set

$wgRestrictDisplayTitle is intended to make it possible to simply
copy-and-paste the title text even if it requires some styling like
subscript or superscript. Using a <span style="display: none;" />
broke that expectation, as the text hidden in such way becomes
completely invisible and unselectable. This patch rejects such styles.

Also disallowed 'user-select' and 'visibility', since they both
prevent the user from selecting and/or copying the text as well.

Minor changes in Sanitizer:
* checkCss() was made to pass through values which consist of nothing
  but a single comment, to allow this rejection to display some sort
  of a notification to the user.
* encodeTagAttributes() was added as a counterpart to
  decodeTagAttributes(), pulling some code out of fixTagAttributes().

Bug: 26547
Change-Id: Ie162535b6bcbebce4ee69f6dcc1957ccccc3c672
includes/DefaultSettings.php
includes/Sanitizer.php
includes/parser/CoreParserFunctions.php
tests/parser/parserTests.txt
tests/phpunit/includes/SanitizerTest.php