Remove the $wgHandheldForIPhone config variable entirely
It only really made sense in pair with $wgHandheldStyle, and that has been removed in Ia8d79b4a. Remove irrelevant tests, adjust still relevant ones. Change-Id: I7c24128f7b148d0244538ad95bb60bf09ec4b5cb
This commit is contained in:
parent
070e11da65
commit
1965df8df3
4 changed files with 19 additions and 81 deletions
|
|
@ -24,6 +24,7 @@ production.
|
||||||
* $wgXhtmlDefaultNamespace is no longer used by core. Setting it will no longer change the
|
* $wgXhtmlDefaultNamespace is no longer used by core. Setting it will no longer change the
|
||||||
xmlns used by MediaWiki. Reliance on this variable by extensions is deprecated.
|
xmlns used by MediaWiki. Reliance on this variable by extensions is deprecated.
|
||||||
* $wgHandheldStyle was removed.
|
* $wgHandheldStyle was removed.
|
||||||
|
* $wgHandheldForIPhone was removed.
|
||||||
* $wgJsMimeType is no longer used by core. Most usage has been removed since
|
* $wgJsMimeType is no longer used by core. Most usage has been removed since
|
||||||
HTML output is now exclusively HTML5.
|
HTML output is now exclusively HTML5.
|
||||||
* $wgDBOracleDRCP added. True enables persistent connection with DRCP on Oracle.
|
* $wgDBOracleDRCP added. True enables persistent connection with DRCP on Oracle.
|
||||||
|
|
|
||||||
|
|
@ -2676,18 +2676,6 @@ $wgSkipSkin = '';
|
||||||
/** Array for more like $wgSkipSkin. */
|
/** Array for more like $wgSkipSkin. */
|
||||||
$wgSkipSkins = array();
|
$wgSkipSkins = array();
|
||||||
|
|
||||||
/**
|
|
||||||
* If set, 'screen' and 'handheld' media specifiers for stylesheets are
|
|
||||||
* transformed such that they apply to the iPhone/iPod Touch Mobile Safari,
|
|
||||||
* which doesn't recognize 'handheld' but does support media queries on its
|
|
||||||
* screen size.
|
|
||||||
*
|
|
||||||
* Consider only using this if you have a *really good* handheld stylesheet,
|
|
||||||
* as iPhone users won't have any way to disable it and use the "grown-up"
|
|
||||||
* styles instead.
|
|
||||||
*/
|
|
||||||
$wgHandheldForIPhone = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allow user Javascript page?
|
* Allow user Javascript page?
|
||||||
* This enables a lot of neat customizations, but may
|
* This enables a lot of neat customizations, but may
|
||||||
|
|
|
||||||
|
|
@ -3566,7 +3566,7 @@ $templates
|
||||||
* this stylesheet
|
* this stylesheet
|
||||||
*/
|
*/
|
||||||
public static function transformCssMedia( $media ) {
|
public static function transformCssMedia( $media ) {
|
||||||
global $wgRequest, $wgHandheldForIPhone;
|
global $wgRequest;
|
||||||
|
|
||||||
// http://www.w3.org/TR/css3-mediaqueries/#syntax
|
// http://www.w3.org/TR/css3-mediaqueries/#syntax
|
||||||
$screenMediaQueryRegex = '/^(?:only\s+)?screen\b/i';
|
$screenMediaQueryRegex = '/^(?:only\s+)?screen\b/i';
|
||||||
|
|
@ -3598,18 +3598,6 @@ $templates
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Expand longer media queries as iPhone doesn't grok 'handheld'
|
|
||||||
if ( $wgHandheldForIPhone ) {
|
|
||||||
$mediaAliases = array(
|
|
||||||
'screen' => 'screen and (min-device-width: 481px)',
|
|
||||||
'handheld' => 'handheld, only screen and (max-device-width: 480px)',
|
|
||||||
);
|
|
||||||
|
|
||||||
if ( isset( $mediaAliases[$media] ) ) {
|
|
||||||
$media = $mediaAliases[$media];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $media;
|
return $media;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ class OutputPageTest extends MediaWikiTestCase {
|
||||||
*
|
*
|
||||||
* options['printableQuery'] - value of query string for printable, or omitted for none
|
* options['printableQuery'] - value of query string for printable, or omitted for none
|
||||||
* options['handheldQuery'] - value of query string for handheld, or omitted for none
|
* options['handheldQuery'] - value of query string for handheld, or omitted for none
|
||||||
* options['handheldForIPhone'] - value of the $wgHandheldForIPhone global
|
|
||||||
* options['media'] - passed into the method under the same name
|
* options['media'] - passed into the method under the same name
|
||||||
* options['expectedReturn'] - expected return value
|
* options['expectedReturn'] - expected return value
|
||||||
* options['message'] - PHPUnit message for assertion
|
* options['message'] - PHPUnit message for assertion
|
||||||
|
|
@ -39,58 +38,38 @@ class OutputPageTest extends MediaWikiTestCase {
|
||||||
$fauxRequest = new FauxRequest( $queryData, false );
|
$fauxRequest = new FauxRequest( $queryData, false );
|
||||||
$this->setMWGlobals( array(
|
$this->setMWGlobals( array(
|
||||||
'wgRequest' => $fauxRequest,
|
'wgRequest' => $fauxRequest,
|
||||||
'wgHandheldForIPhone' => $args['handheldForIPhone']
|
|
||||||
) );
|
) );
|
||||||
|
|
||||||
$actualReturn = OutputPage::transformCssMedia( $args['media'] );
|
$actualReturn = OutputPage::transformCssMedia( $args['media'] );
|
||||||
$this->assertSame( $args['expectedReturn'], $actualReturn, $args['message'] );
|
$this->assertSame( $args['expectedReturn'], $actualReturn, $args['message'] );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Tests a case of transformCssMedia with both values of wgHandheldForIPhone.
|
|
||||||
* Used to verify that behavior is orthogonal to that option.
|
|
||||||
*
|
|
||||||
* If the value of wgHandheldForIPhone should matter, use assertTransformCssMediaCase.
|
|
||||||
*
|
|
||||||
* @param array $args key-value array of arguments as shown in assertTransformCssMediaCase.
|
|
||||||
* Will be mutated.
|
|
||||||
*/
|
|
||||||
protected function assertTransformCssMediaCaseWithBothHandheldForIPhone( $args ) {
|
|
||||||
$message = $args['message'];
|
|
||||||
foreach ( array( true, false ) as $handheldForIPhone ) {
|
|
||||||
$args['handheldForIPhone'] = $handheldForIPhone;
|
|
||||||
$stringHandheldForIPhone = var_export( $handheldForIPhone, true );
|
|
||||||
$args['message'] = "$message. \$wgHandheldForIPhone was $stringHandheldForIPhone";
|
|
||||||
$this->assertTransformCssMediaCase( $args );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests print requests
|
* Tests print requests
|
||||||
*/
|
*/
|
||||||
public function testPrintRequests() {
|
public function testPrintRequests() {
|
||||||
$this->assertTransformCssMediaCaseWithBothHandheldForIPhone( array(
|
$this->assertTransformCssMediaCase( array(
|
||||||
'printableQuery' => '1',
|
'printableQuery' => '1',
|
||||||
'media' => 'screen',
|
'media' => 'screen',
|
||||||
'expectedReturn' => null,
|
'expectedReturn' => null,
|
||||||
'message' => 'On printable request, screen returns null'
|
'message' => 'On printable request, screen returns null'
|
||||||
) );
|
) );
|
||||||
|
|
||||||
$this->assertTransformCssMediaCaseWithBothHandheldForIPhone( array(
|
$this->assertTransformCssMediaCase( array(
|
||||||
'printableQuery' => '1',
|
'printableQuery' => '1',
|
||||||
'media' => self::SCREEN_MEDIA_QUERY,
|
'media' => self::SCREEN_MEDIA_QUERY,
|
||||||
'expectedReturn' => null,
|
'expectedReturn' => null,
|
||||||
'message' => 'On printable request, screen media query returns null'
|
'message' => 'On printable request, screen media query returns null'
|
||||||
) );
|
) );
|
||||||
|
|
||||||
$this->assertTransformCssMediaCaseWithBothHandheldForIPhone( array(
|
$this->assertTransformCssMediaCase( array(
|
||||||
'printableQuery' => '1',
|
'printableQuery' => '1',
|
||||||
'media' => self::SCREEN_ONLY_MEDIA_QUERY,
|
'media' => self::SCREEN_ONLY_MEDIA_QUERY,
|
||||||
'expectedReturn' => null,
|
'expectedReturn' => null,
|
||||||
'message' => 'On printable request, screen media query with only returns null'
|
'message' => 'On printable request, screen media query with only returns null'
|
||||||
) );
|
) );
|
||||||
|
|
||||||
$this->assertTransformCssMediaCaseWithBothHandheldForIPhone( array(
|
$this->assertTransformCssMediaCase( array(
|
||||||
'printableQuery' => '1',
|
'printableQuery' => '1',
|
||||||
'media' => 'print',
|
'media' => 'print',
|
||||||
'expectedReturn' => '',
|
'expectedReturn' => '',
|
||||||
|
|
@ -103,25 +82,30 @@ class OutputPageTest extends MediaWikiTestCase {
|
||||||
*/
|
*/
|
||||||
public function testScreenRequests() {
|
public function testScreenRequests() {
|
||||||
$this->assertTransformCssMediaCase( array(
|
$this->assertTransformCssMediaCase( array(
|
||||||
'handheldForIPhone' => false,
|
|
||||||
'media' => 'screen',
|
'media' => 'screen',
|
||||||
'expectedReturn' => 'screen',
|
'expectedReturn' => 'screen',
|
||||||
'message' => 'On screen request, with handheldForIPhone false, screen media type is preserved'
|
'message' => 'On screen request, screen media type is preserved'
|
||||||
) );
|
) );
|
||||||
|
|
||||||
$this->assertTransformCssMediaCaseWithBothHandheldForIPhone( array(
|
$this->assertTransformCssMediaCase( array(
|
||||||
|
'media' => 'handheld',
|
||||||
|
'expectedReturn' => 'handheld',
|
||||||
|
'message' => 'On screen request, handheld media type is preserved'
|
||||||
|
) );
|
||||||
|
|
||||||
|
$this->assertTransformCssMediaCase( array(
|
||||||
'media' => self::SCREEN_MEDIA_QUERY,
|
'media' => self::SCREEN_MEDIA_QUERY,
|
||||||
'expectedReturn' => self::SCREEN_MEDIA_QUERY,
|
'expectedReturn' => self::SCREEN_MEDIA_QUERY,
|
||||||
'message' => 'On screen request, screen media query is preserved.'
|
'message' => 'On screen request, screen media query is preserved.'
|
||||||
) );
|
) );
|
||||||
|
|
||||||
$this->assertTransformCssMediaCaseWithBothHandheldForIPhone( array(
|
$this->assertTransformCssMediaCase( array(
|
||||||
'media' => self::SCREEN_ONLY_MEDIA_QUERY,
|
'media' => self::SCREEN_ONLY_MEDIA_QUERY,
|
||||||
'expectedReturn' => self::SCREEN_ONLY_MEDIA_QUERY,
|
'expectedReturn' => self::SCREEN_ONLY_MEDIA_QUERY,
|
||||||
'message' => 'On screen request, screen media query with only is preserved.'
|
'message' => 'On screen request, screen media query with only is preserved.'
|
||||||
) );
|
) );
|
||||||
|
|
||||||
$this->assertTransformCssMediaCaseWithBothHandheldForIPhone( array(
|
$this->assertTransformCssMediaCase( array(
|
||||||
'media' => 'print',
|
'media' => 'print',
|
||||||
'expectedReturn' => 'print',
|
'expectedReturn' => 'print',
|
||||||
'message' => 'On screen request, print media type is preserved'
|
'message' => 'On screen request, print media type is preserved'
|
||||||
|
|
@ -129,44 +113,21 @@ class OutputPageTest extends MediaWikiTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests handheld and wgHandheldForIPhone behavior
|
* Tests handheld behavior
|
||||||
*/
|
*/
|
||||||
public function testHandheld() {
|
public function testHandheld() {
|
||||||
$this->assertTransformCssMediaCaseWithBothHandheldForIPhone( array(
|
$this->assertTransformCssMediaCase( array(
|
||||||
'handheldQuery' => '1',
|
'handheldQuery' => '1',
|
||||||
'media' => 'handheld',
|
'media' => 'handheld',
|
||||||
'expectedReturn' => '',
|
'expectedReturn' => '',
|
||||||
'message' => 'On request with handheld querystring and media is handheld, returns empty string'
|
'message' => 'On request with handheld querystring and media is handheld, returns empty string'
|
||||||
) );
|
) );
|
||||||
|
|
||||||
$this->assertTransformCssMediaCaseWithBothHandheldForIPhone( array(
|
$this->assertTransformCssMediaCase( array(
|
||||||
'handheldQuery' => '1',
|
'handheldQuery' => '1',
|
||||||
'media' => 'screen',
|
'media' => 'screen',
|
||||||
'expectedReturn' => null,
|
'expectedReturn' => null,
|
||||||
'message' => 'On request with handheld querystring and media is screen, returns null'
|
'message' => 'On request with handheld querystring and media is screen, returns null'
|
||||||
) );
|
) );
|
||||||
|
|
||||||
// A bit counter-intuitively, $wgHandheldForIPhone should only matter if the query handheld is false or omitted
|
|
||||||
$this->assertTransformCssMediaCase( array(
|
|
||||||
'handheldQuery' => '0',
|
|
||||||
'media' => 'screen',
|
|
||||||
'handheldForIPhone' => true,
|
|
||||||
'expectedReturn' => 'screen and (min-device-width: 481px)',
|
|
||||||
'message' => 'With $wgHandheldForIPhone true, screen media type is transformed'
|
|
||||||
) );
|
|
||||||
|
|
||||||
$this->assertTransformCssMediaCase( array(
|
|
||||||
'media' => 'handheld',
|
|
||||||
'handheldForIPhone' => true,
|
|
||||||
'expectedReturn' => 'handheld, only screen and (max-device-width: 480px)',
|
|
||||||
'message' => 'With $wgHandheldForIPhone true, handheld media type is transformed'
|
|
||||||
) );
|
|
||||||
|
|
||||||
$this->assertTransformCssMediaCase( array(
|
|
||||||
'media' => 'handheld',
|
|
||||||
'handheldForIPhone' => false,
|
|
||||||
'expectedReturn' => 'handheld',
|
|
||||||
'message' => 'With $wgHandheldForIPhone false, handheld media type is preserved'
|
|
||||||
) );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue