Tim Starling has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/401416 )
Change subject: Update wikimedia/remex-html to 1.0.2
......................................................................
Update wikimedia/remex-html to 1.0.2
Bug: T183379
Change-Id: I9fb9978c69f37bafc0049cd7ed343c033dd50ef8
---
M composer.json
M composer.lock
M composer/installed.json
M wikimedia/remex-html/RemexHtml/Serializer/Formatter.php
M wikimedia/remex-html/RemexHtml/Serializer/Serializer.php
M wikimedia/remex-html/RemexHtml/Tokenizer/PlainAttributes.php
M wikimedia/remex-html/RemexHtml/Tokenizer/TokenHandler.php
M wikimedia/remex-html/RemexHtml/Tokenizer/Tokenizer.php
M wikimedia/remex-html/RemexHtml/TreeBuilder/ActiveFormattingElements.php
M wikimedia/remex-html/RemexHtml/TreeBuilder/CachingStack.php
M wikimedia/remex-html/RemexHtml/TreeBuilder/Dispatcher.php
M wikimedia/remex-html/RemexHtml/TreeBuilder/Element.php
M wikimedia/remex-html/RemexHtml/TreeBuilder/InsertionMode.php
M wikimedia/remex-html/RemexHtml/TreeBuilder/Marker.php
M wikimedia/remex-html/RemexHtml/TreeBuilder/Stack.php
M wikimedia/remex-html/RemexHtml/TreeBuilder/TemplateModeStack.php
M wikimedia/remex-html/RemexHtml/TreeBuilder/TreeBuilder.php
M wikimedia/remex-html/RemexHtml/TreeBuilder/TreeHandler.php
M wikimedia/remex-html/RemexHtml/TreeBuilder/TreeMutationTracer.php
19 files changed, 166 insertions(+), 168 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/vendor
refs/changes/16/401416/1
diff --git a/composer.json b/composer.json
index d50d4f7..4795bf7 100644
--- a/composer.json
+++ b/composer.json
@@ -121,7 +121,7 @@
"wikimedia/php-session-serializer": "1.0.4",
"wikimedia/purtle": "1.0.6",
"wikimedia/relpath": "2.0.0",
- "wikimedia/remex-html": "1.0.1",
+ "wikimedia/remex-html": "1.0.2",
"wikimedia/running-stat": "1.1.0",
"wikimedia/scoped-callback": "1.0.0",
"wikimedia/testing-access-wrapper": "1.0.0",
diff --git a/composer.lock b/composer.lock
index b52e20e..8e12d0d 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at
https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
- "content-hash": "6f68bf26abea37e7212cc0afe9cb9341",
+ "content-hash": "0f3436b07eacbc4f02831120f725d111",
"packages": [
{
"name": "composer/semver",
@@ -3208,16 +3208,16 @@
},
{
"name": "wikimedia/remex-html",
- "version": "1.0.1",
+ "version": "1.0.2",
"source": {
"type": "git",
"url":
"https://github.com/wikimedia/mediawiki-libs-RemexHtml.git",
- "reference": "3c596e5c66557ed7f37d8a543bc233d7fa80a52f"
+ "reference": "c7e8267eabaf1d7e89d65a35571f86ce5bbbc16a"
},
"dist": {
"type": "zip",
- "url":
"https://api.github.com/repos/wikimedia/mediawiki-libs-RemexHtml/zipball/3c596e5c66557ed7f37d8a543bc233d7fa80a52f",
- "reference": "3c596e5c66557ed7f37d8a543bc233d7fa80a52f",
+ "url":
"https://api.github.com/repos/wikimedia/mediawiki-libs-RemexHtml/zipball/c7e8267eabaf1d7e89d65a35571f86ce5bbbc16a",
+ "reference": "c7e8267eabaf1d7e89d65a35571f86ce5bbbc16a",
"shasum": ""
},
"require": {
@@ -3225,7 +3225,7 @@
"wikimedia/utfnormal": "1.1.0"
},
"require-dev": {
- "mediawiki/mediawiki-codesniffer": "0.7.2",
+ "mediawiki/mediawiki-codesniffer": "0.12.0",
"phpunit/phpunit": "4.*"
},
"type": "library",
@@ -3245,7 +3245,7 @@
}
],
"description": "Fast HTML 5 parser",
- "time": "2017-03-14T05:28:14+00:00"
+ "time": "2018-01-02T00:35:06+00:00"
},
{
"name": "wikimedia/running-stat",
diff --git a/composer/installed.json b/composer/installed.json
index e1d6e49..2c61895 100644
--- a/composer/installed.json
+++ b/composer/installed.json
@@ -1365,49 +1365,6 @@
"homepage": "https://www.mediawiki.org/wiki/Timestamp"
},
{
- "name": "wikimedia/remex-html",
- "version": "1.0.1",
- "version_normalized": "1.0.1.0",
- "source": {
- "type": "git",
- "url": "https://github.com/wikimedia/mediawiki-libs-RemexHtml.git",
- "reference": "3c596e5c66557ed7f37d8a543bc233d7fa80a52f"
- },
- "dist": {
- "type": "zip",
- "url":
"https://api.github.com/repos/wikimedia/mediawiki-libs-RemexHtml/zipball/3c596e5c66557ed7f37d8a543bc233d7fa80a52f",
- "reference": "3c596e5c66557ed7f37d8a543bc233d7fa80a52f",
- "shasum": ""
- },
- "require": {
- "ext-mbstring": "*",
- "wikimedia/utfnormal": "1.1.0"
- },
- "require-dev": {
- "mediawiki/mediawiki-codesniffer": "0.7.2",
- "phpunit/phpunit": "4.*"
- },
- "time": "2017-03-14T05:28:14+00:00",
- "type": "library",
- "installation-source": "dist",
- "autoload": {
- "psr-4": {
- "RemexHtml\\": "RemexHtml/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Tim Starling",
- "email": "[email protected]"
- }
- ],
- "description": "Fast HTML 5 parser"
- },
- {
"name": "pear/pear-core-minimal",
"version": "v1.10.3",
"version_normalized": "1.10.3.0",
@@ -3779,5 +3736,48 @@
],
"description": "Mail_Mime provides classes to create MIME messages",
"homepage": "http://pear.php.net/package/Mail_Mime"
+ },
+ {
+ "name": "wikimedia/remex-html",
+ "version": "1.0.2",
+ "version_normalized": "1.0.2.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/wikimedia/mediawiki-libs-RemexHtml.git",
+ "reference": "c7e8267eabaf1d7e89d65a35571f86ce5bbbc16a"
+ },
+ "dist": {
+ "type": "zip",
+ "url":
"https://api.github.com/repos/wikimedia/mediawiki-libs-RemexHtml/zipball/c7e8267eabaf1d7e89d65a35571f86ce5bbbc16a",
+ "reference": "c7e8267eabaf1d7e89d65a35571f86ce5bbbc16a",
+ "shasum": ""
+ },
+ "require": {
+ "ext-mbstring": "*",
+ "wikimedia/utfnormal": "1.1.0"
+ },
+ "require-dev": {
+ "mediawiki/mediawiki-codesniffer": "0.12.0",
+ "phpunit/phpunit": "4.*"
+ },
+ "time": "2018-01-02T00:35:06+00:00",
+ "type": "library",
+ "installation-source": "dist",
+ "autoload": {
+ "psr-4": {
+ "RemexHtml\\": "RemexHtml/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Tim Starling",
+ "email": "[email protected]"
+ }
+ ],
+ "description": "Fast HTML 5 parser"
}
]
diff --git a/wikimedia/remex-html/RemexHtml/Serializer/Formatter.php
b/wikimedia/remex-html/RemexHtml/Serializer/Formatter.php
index 9a2f4fb..24987fa 100644
--- a/wikimedia/remex-html/RemexHtml/Serializer/Formatter.php
+++ b/wikimedia/remex-html/RemexHtml/Serializer/Formatter.php
@@ -27,8 +27,8 @@
*
* @param SerializerNode $parent The parent of the text node (at
creation time)
* @param string $text
- * @param integer $start The offset within $text
- * @param integer $length The number of bytes within $text
+ * @param int $start The offset within $text
+ * @param int $length The number of bytes within $text
* @return string
*/
function characters( SerializerNode $parent, $text, $start, $length );
diff --git a/wikimedia/remex-html/RemexHtml/Serializer/Serializer.php
b/wikimedia/remex-html/RemexHtml/Serializer/Serializer.php
index ad7ec8d..786c969 100644
--- a/wikimedia/remex-html/RemexHtml/Serializer/Serializer.php
+++ b/wikimedia/remex-html/RemexHtml/Serializer/Serializer.php
@@ -187,12 +187,12 @@
/**
* Insert an element
*
- * @param integer $preposition
+ * @param int $preposition
* @param Element|SerializerNode|null $refElement
* @param Element $element
* @param bool $void
- * @param integer $sourceStart
- * @param integer $sourceLength
+ * @param int $sourceStart
+ * @param int $sourceLength
*/
public function insertElement( $preposition, $refElement, Element
$element, $void,
$sourceStart, $sourceLength
diff --git a/wikimedia/remex-html/RemexHtml/Tokenizer/PlainAttributes.php
b/wikimedia/remex-html/RemexHtml/Tokenizer/PlainAttributes.php
index b0079a1..544539b 100644
--- a/wikimedia/remex-html/RemexHtml/Tokenizer/PlainAttributes.php
+++ b/wikimedia/remex-html/RemexHtml/Tokenizer/PlainAttributes.php
@@ -5,7 +5,7 @@
/**
* An Attributes implementation which is a simple array proxy.
*/
-class PlainAttributes implements Attributes {
+class PlainAttributes implements Attributes {
protected $data;
protected $attrObjects;
diff --git a/wikimedia/remex-html/RemexHtml/Tokenizer/TokenHandler.php
b/wikimedia/remex-html/RemexHtml/Tokenizer/TokenHandler.php
index 06f98c0..df75e5f 100644
--- a/wikimedia/remex-html/RemexHtml/Tokenizer/TokenHandler.php
+++ b/wikimedia/remex-html/RemexHtml/Tokenizer/TokenHandler.php
@@ -22,7 +22,7 @@
/**
* Called when the end of the input string is consumed
- * @param integer $pos The input position (past the end)
+ * @param int $pos The input position (past the end)
*/
function endDocument( $pos );
@@ -33,7 +33,7 @@
* output.
*
* @param string $text The error message
- * @param integer $pos The input position
+ * @param int $pos The input position
*/
function error( $text, $pos );
@@ -44,10 +44,10 @@
* some copying, at least if ignoreCharRefs and ignoreNulls are enabled.
*
* @param string $text The string which contains the emitted characters
- * @param integer $start The start of the range within $text to use
- * @param integer $length The length of the range within $text to use
- * @param integer $sourceStart The input position
- * @param integer $sourceLength The input length
+ * @param int $start The start of the range within $text to use
+ * @param int $length The length of the range within $text to use
+ * @param int $sourceStart The input position
+ * @param int $sourceLength The input length
*/
function characters( $text, $start, $length, $sourceStart,
$sourceLength );
@@ -60,8 +60,8 @@
* @param string $name The tag name
* @param Attributes $attrs The tag attributes
* @param bool $selfClose Whether there is a self-closing slash
- * @param integer $sourceStart The input position
- * @param integer $sourceLength The input length
+ * @param int $sourceStart The input position
+ * @param int $sourceLength The input length
*/
function startTag( $name, Attributes $attrs, $selfClose, $sourceStart,
$sourceLength );
@@ -69,8 +69,8 @@
* An end tag event.
*
* @param string $name The tag name
- * @param integer $sourceStart The input position
- * @param integer $sourceLength The input length
+ * @param int $sourceStart The input position
+ * @param int $sourceLength The input length
*/
function endTag( $name, $sourceStart, $sourceLength );
@@ -81,8 +81,8 @@
* @param string|null $public The public identifier, or null if none
was found
* @param string|null $system The system identifier, or null if none
was found
* @param bool $quirks What the spec calls the "force-quirks flag"
- * @param integer $sourceStart The input position
- * @param integer $sourceLength The input length
+ * @param int $sourceStart The input position
+ * @param int $sourceLength The input length
*/
function doctype( $name, $public, $system, $quirks, $sourceStart,
$sourceLength );
@@ -90,8 +90,8 @@
* A comment.
*
* @param string $text The inner text of the comment
- * @param integer $sourceStart The input position
- * @param integer $sourceLength The input length
+ * @param int $sourceStart The input position
+ * @param int $sourceLength The input length
*/
function comment( $text, $sourceStart, $sourceLength );
}
diff --git a/wikimedia/remex-html/RemexHtml/Tokenizer/Tokenizer.php
b/wikimedia/remex-html/RemexHtml/Tokenizer/Tokenizer.php
index 3cf3540..3567dab 100644
--- a/wikimedia/remex-html/RemexHtml/Tokenizer/Tokenizer.php
+++ b/wikimedia/remex-html/RemexHtml/Tokenizer/Tokenizer.php
@@ -166,7 +166,7 @@
* Change the state of the tokenizer during parsing. This for use by the
* tree builder to switch the tokenizer into one of the raw text states.
*
- * @param integer $state One of the STATE_* constants
+ * @param int $state One of the STATE_* constants
* @param string $appropriateEndTag The appropriate end tag
*/
public function switchState( $state, $appropriateEndTag ) {
@@ -191,7 +191,7 @@
switch ( $tagName ) {
case 'title':
case 'textarea':
- $this->state = Tokenizer::STATE_RCDATA;
+ $this->state = self::STATE_RCDATA;
break;
case 'style':
@@ -199,21 +199,21 @@
case 'iframe':
case 'noembed':
case 'noframes':
- $this->state = Tokenizer::STATE_RAWTEXT;
+ $this->state = self::STATE_RAWTEXT;
break;
case 'script':
- $this->state = Tokenizer::STATE_SCRIPT_DATA;
+ $this->state = self::STATE_SCRIPT_DATA;
break;
case 'noscript':
if ( $this->scriptingFlag ) {
- $this->state = Tokenizer::STATE_RAWTEXT;
+ $this->state = self::STATE_RAWTEXT;
}
break;
case 'plaintext':
- $this->state = Tokenizer::STATE_PLAINTEXT;
+ $this->state = self::STATE_PLAINTEXT;
break;
}
}
@@ -348,7 +348,7 @@
*
* @param bool $loop True to loop while still in the data state, false
to
* process a single less-than sign.
- * @return integer The next state index
+ * @return int The next state index
*/
protected function dataState( $loop ) {
$re = "~ <
@@ -534,7 +534,7 @@
$contents = $this->handleNulls(
$contents, $bogusPos );
$this->listener->comment( $contents,
$this->pos, $endPos - $this->pos );
}
- } elseif ( isset ( $m[self::MD_BOGUS_COMMENT] ) &&
$m[self::MD_BOGUS_COMMENT][1] >= 0 ) {
+ } elseif ( isset( $m[self::MD_BOGUS_COMMENT] ) &&
$m[self::MD_BOGUS_COMMENT][1] >= 0 ) {
// Bogus comment
$contents = $m[self::MD_BOGUS_COMMENT][0];
$bogusPos = $m[self::MD_BOGUS_COMMENT][1];
@@ -742,7 +742,7 @@
* replaced with U+FFFD with a parse error issued.
*
* @param string $text The text to be converted
- * @param integer $sourcePos The input byte offset from which $text was
+ * @param int $sourcePos The input byte offset from which $text was
* extracted, for error position reporting.
* @return string The converted text
*/
@@ -775,9 +775,9 @@
*
* @param string $mask Mask for strcspn
* @param string $text The input text
- * @param integer $offset The start of the range within $text to search
- * @param integer $length The length of the range within $text to search
- * @param integer $sourcePos The offset within the input text
corresponding
+ * @param int $offset The start of the range within $text to search
+ * @param int $length The length of the range within $text to search
+ * @param int $sourcePos The offset within the input text corresponding
* to $text, for error position reporting.
*/
protected function handleAsciiErrors( $mask, $text, $offset, $length,
$sourcePos ) {
@@ -803,7 +803,7 @@
/**
* Expand character references in some text, and emit errors as
appropriate.
* @param string $text The text to expand
- * @param integer $sourcePos The input position of $text
+ * @param int $sourcePos The input position of $text
* @param bool $inAttr True if the text is within an attribute value
* @param string $additionalAllowedChar An unused string which the spec
* inexplicably spends a lot of space telling you how to derive. It
@@ -986,8 +986,8 @@
* Emit a range of the input text as a character token, and emit related
* errors, with validity rules as per the data state.
*
- * @param integer $pos Offset within the input text
- * @param integer $length The length of the range
+ * @param int $pos Offset within the input text
+ * @param int $length The length of the range
*/
protected function emitDataRange( $pos, $length ) {
if ( $length === 0 ) {
@@ -1030,8 +1030,8 @@
* that as a parameter.
*
* @param bool $ignoreCharRefs
- * @param integer $pos The input position
- * @param integer $length The length of the range to be emitted
+ * @param int $pos The input position
+ * @param int $length The length of the range to be emitted
*/
protected function emitRawTextRange( $ignoreCharRefs, $pos, $length ) {
if ( $length === 0 ) {
@@ -1054,7 +1054,7 @@
* The entry point for the RCDATA and RAWTEXT states.
* @param bool $ignoreCharRefs True to ignore character references
regardless
* of configuration, false to respect the configuration.
- * @return integer The next state index
+ * @return int The next state index
*/
protected function textElementState( $ignoreCharRefs ) {
if ( $this->appropriateEndTag === null ) {
@@ -1253,11 +1253,11 @@
* Emit the appropriate tag event, or in the case of broken attributes
in
* text states, emit characters.
*
- * @param integer $state The current state
+ * @param int $state The current state
* @param string $tagName The normalized tag name
* @param bool $isEndTag True if this is an end tag, false if it is a
start tag
- * @param integer $startPos The input position of the start of the
current tag.
- * @return integer The next state
+ * @param int $startPos The input position of the start of the current
tag.
+ * @return int The next state
*/
protected function handleAttribsAndClose( $state, $tagName, $isEndTag,
$startPos ) {
$attribStartPos = $this->pos;
@@ -1312,7 +1312,7 @@
/**
* Process input text in the PLAINTEXT state
- * @return integer The next state index
+ * @return int The next state index
*/
protected function plaintextState() {
$this->emitRawTextRange( true, $this->pos, $this->length -
$this->pos );
@@ -1321,7 +1321,7 @@
/**
* Process input text in the script data state
- * @return integer The next state index
+ * @return int The next state index
*/
protected function scriptDataState() {
if ( $this->appropriateEndTag === null ) {
@@ -1413,7 +1413,7 @@
/**
* Emit a parse error event.
* @param string $text The error message
- * @param integer|null $pos The error position, or null to use the
current position
+ * @param int|null $pos The error position, or null to use the current
position
*/
protected function error( $text, $pos = null ) {
if ( !$this->ignoreErrors ) {
@@ -1482,4 +1482,3 @@
throw new TokenizerError( __CLASS__.": $msg" );
}
}
-
diff --git
a/wikimedia/remex-html/RemexHtml/TreeBuilder/ActiveFormattingElements.php
b/wikimedia/remex-html/RemexHtml/TreeBuilder/ActiveFormattingElements.php
index 1647e8b..8b3bc30 100644
--- a/wikimedia/remex-html/RemexHtml/TreeBuilder/ActiveFormattingElements.php
+++ b/wikimedia/remex-html/RemexHtml/TreeBuilder/ActiveFormattingElements.php
@@ -154,7 +154,7 @@
/**
* Determine whether an element is in the list of formatting elements.
* @param Element $elt
- * @return boolean
+ * @return bool
*/
public function isInList( Element $elt ) {
return $this->head === $elt || $elt->prevAFE;
diff --git a/wikimedia/remex-html/RemexHtml/TreeBuilder/CachingStack.php
b/wikimedia/remex-html/RemexHtml/TreeBuilder/CachingStack.php
index 74112e1..a67cfdc 100644
--- a/wikimedia/remex-html/RemexHtml/TreeBuilder/CachingStack.php
+++ b/wikimedia/remex-html/RemexHtml/TreeBuilder/CachingStack.php
@@ -16,9 +16,9 @@
const SCOPE_TABLE = 3;
const SCOPE_SELECT = 4;
- private static $tableScopes = [ self::SCOPE_DEFAULT, self::SCOPE_LIST,
self::SCOPE_BUTTON,
+ private static $allScopes = [ self::SCOPE_DEFAULT, self::SCOPE_LIST,
self::SCOPE_BUTTON,
self::SCOPE_TABLE, self::SCOPE_SELECT ];
- private static $regularScopes = [ self::SCOPE_DEFAULT,
self::SCOPE_LIST, self::SCOPE_BUTTON,
+ private static $nonTableScopes = [ self::SCOPE_DEFAULT,
self::SCOPE_LIST, self::SCOPE_BUTTON,
self::SCOPE_SELECT ];
private static $listScopes = [ self::SCOPE_LIST, self::SCOPE_SELECT ];
private static $buttonScopes = [ self::SCOPE_BUTTON, self::SCOPE_SELECT
];
@@ -127,7 +127,7 @@
* A cache of the elements which are currently in a given scope.
* The first key is the scope ID, the second key is the element name,
and the
* value is the first Element in a singly-linked list of Element
objects,
- * linked by $element->nextScope.
+ * linked by $element->nextEltInScope.
*
* @todo Benchmark time and memory compared to an array stack instead
of an
* SLL. The SLL here is maybe not quite so well justified as some other
@@ -165,16 +165,17 @@
private $templateCount;
/**
- * Get the list of scopes that are broken for a given namespace and
- * element name.
+ * For a given namespace and element name, get the list of scopes
+ * for which a new scope should be created and the old one needs to
+ * be pushed onto the scope stack.
*/
- private function getBrokenScopes( $ns, $name ) {
+ private function getScopeTypesToStack( $ns, $name ) {
if ( $ns === HTMLData::NS_HTML ) {
switch ( $name ) {
case 'html':
case 'table':
case 'template':
- return self::$tableScopes;
+ return self::$allScopes;
case 'applet':
case 'caption':
@@ -182,7 +183,7 @@
case 'th':
case 'marquee':
case 'object':
- return self::$regularScopes;
+ return self::$nonTableScopes;
case 'ol':
case 'ul':
@@ -200,13 +201,13 @@
}
} elseif ( $ns === HTMLData::NS_MATHML ) {
if ( isset( self::$mathBreakers[$name] ) ) {
- return self::$regularScopes;
+ return self::$nonTableScopes;
} else {
return self::$selectOnly;
}
} elseif ( $ns === HTMLData::NS_SVG ) {
if ( isset( self::$svgBreakers[$name] ) ) {
- return self::$regularScopes;
+ return self::$nonTableScopes;
} else {
return self::$selectOnly;
}
@@ -225,14 +226,14 @@
// Update the scope cache
$ns = $elt->namespace;
$name = $elt->name;
- foreach ( $this->getBrokenScopes( $ns, $name ) as $scope ) {
- $this->scopeStacks[$scope][] = $this->scopes[$scope];
- $this->scopes[$scope] = [];
+ foreach ( $this->getScopeTypesToStack( $ns, $name ) as $type ) {
+ $this->scopeStacks[$type][] = $this->scopes[$type];
+ $this->scopes[$type] = [];
}
if ( $ns === HTMLData::NS_HTML && isset(
self::$predicateMap[$name] ) ) {
- $scopeId = self::$predicateMap[$name];
- $scope =& $this->scopes[$scopeId];
- $elt->nextScope = isset( $scope[$name] ) ?
$scope[$name] : null;
+ $type = self::$predicateMap[$name];
+ $scope =& $this->scopes[$type];
+ $elt->nextEltInScope = isset( $scope[$name] ) ?
$scope[$name] : null;
$scope[$name] = $elt;
unset( $scope );
}
@@ -257,10 +258,10 @@
// Update the scope cache
if ( $ns === HTMLData::NS_HTML && isset(
self::$predicateMap[$name] ) ) {
$scope = self::$predicateMap[$name];
- $this->scopes[$scope][$name] = $elt->nextScope;
- $elt->nextScope = null;
+ $this->scopes[$scope][$name] = $elt->nextEltInScope;
+ $elt->nextEltInScope = null;
}
- foreach ( $this->getBrokenScopes( $ns, $name ) as $scope ) {
+ foreach ( $this->getScopeTypesToStack( $ns, $name ) as $scope )
{
$this->scopes[$scope] = array_pop(
$this->scopeStacks[$scope] );
}
// Update the template count
@@ -282,23 +283,23 @@
$name = $elt->name;
// Find the old element in its scope list and replace it
if ( $ns === HTMLData::NS_HTML && isset(
self::$predicateMap[$name] ) ) {
- $scopeId = self::$predicateMap[$name];
- $scopeElt = $this->scopes[$scopeId][$name];
+ $type = self::$predicateMap[$name];
+ $scopeElt = $this->scopes[$type][$name];
if ( $scopeElt === $oldElt ) {
- $this->scopes[$scopeId][$name] = $elt;
- $elt->nextScope = $scopeElt->nextScope;
- $scopeElt->nextScope = null;
+ $this->scopes[$type][$name] = $elt;
+ $elt->nextEltInScope =
$scopeElt->nextEltInScope;
+ $scopeElt->nextEltInScope = null;
} else {
- $nextElt = $scopeElt->nextScope;
+ $nextElt = $scopeElt->nextEltInScope;
while ( $nextElt ) {
if ( $nextElt === $oldElt ) {
- $scopeElt->nextScope = $elt;
- $elt->nextScope =
$nextElt->nextScope;
- $scopeElt->nextScope = null;
+ $scopeElt->nextEltInScope =
$elt;
+ $elt->nextEltInScope =
$nextElt->nextEltInScope;
+ $nextElt->nextEltInScope = null;
break;
}
- $scopeElt = $scopeElt->nextScope;
- $nextElt = $scopeElt->nextScope;
+ $scopeElt = $scopeElt->nextEltInScope;
+ $nextElt = $scopeElt->nextEltInScope;
}
if ( !$nextElt ) {
throw new TreeBuilderError(
__METHOD__.': cannot find old element in scope cache' );
@@ -348,7 +349,7 @@
if ( $scopeMember === $elt ) {
return true;
}
- $scopeMember = $scopeMember->nextScope;
+ $scopeMember = $scopeMember->nextEltInScope;
}
}
return false;
@@ -412,9 +413,9 @@
$this->scopeDump( self::SCOPE_SELECT, 'In select scope'
) . "\n";
}
- private function scopeDump( $scopeId, $scopeName ) {
- if ( count( $this->scopes[$scopeId] ) ) {
- return "$scopeName: " . implode( ', ', array_keys(
$this->scopes[$scopeId] ) ) . "\n";
+ private function scopeDump( $type, $scopeName ) {
+ if ( count( $this->scopes[$type] ) ) {
+ return "$scopeName: " . implode( ', ', array_keys(
$this->scopes[$type] ) ) . "\n";
}
}
}
diff --git a/wikimedia/remex-html/RemexHtml/TreeBuilder/Dispatcher.php
b/wikimedia/remex-html/RemexHtml/TreeBuilder/Dispatcher.php
index e6ecf1b..657ac7e 100644
--- a/wikimedia/remex-html/RemexHtml/TreeBuilder/Dispatcher.php
+++ b/wikimedia/remex-html/RemexHtml/TreeBuilder/Dispatcher.php
@@ -132,7 +132,7 @@
/**
* Switch the insertion mode, and return the new handler
*
- * @param integer $mode
+ * @param int $mode
* @return InsertionMode
*/
public function switchMode( $mode ) {
@@ -144,7 +144,7 @@
* Let the original insertion mode be the current insertion mode, and
* switch the insertion mode to some new value. Return the new handler.
*
- * @param integer $mode
+ * @param int $mode
* @return InsertionMode
*/
public function switchAndSave( $mode ) {
@@ -209,7 +209,7 @@
* Get the insertion mode index which is switched to when we reset the
* insertion mode appropriately.
*
- * @return integer
+ * @return int
*/
protected function getAppropriateMode() {
$builder = $this->builder;
diff --git a/wikimedia/remex-html/RemexHtml/TreeBuilder/Element.php
b/wikimedia/remex-html/RemexHtml/TreeBuilder/Element.php
index 56d0ff5..18e2166 100644
--- a/wikimedia/remex-html/RemexHtml/TreeBuilder/Element.php
+++ b/wikimedia/remex-html/RemexHtml/TreeBuilder/Element.php
@@ -54,7 +54,7 @@
/**
* Internal to CachingStack. A link in the scope list.
*/
- public $nextScope;
+ public $nextEltInScope;
/**
* Internal to CachingStack and SimpleStack. The current stack index, or
diff --git a/wikimedia/remex-html/RemexHtml/TreeBuilder/InsertionMode.php
b/wikimedia/remex-html/RemexHtml/TreeBuilder/InsertionMode.php
index 5d4cd08..0029cab 100644
--- a/wikimedia/remex-html/RemexHtml/TreeBuilder/InsertionMode.php
+++ b/wikimedia/remex-html/RemexHtml/TreeBuilder/InsertionMode.php
@@ -119,4 +119,3 @@
abstract public function endTag( $name, $sourceStart, $sourceLength );
abstract public function endDocument( $pos );
}
-
diff --git a/wikimedia/remex-html/RemexHtml/TreeBuilder/Marker.php
b/wikimedia/remex-html/RemexHtml/TreeBuilder/Marker.php
index 80029e5..3e39c7d 100644
--- a/wikimedia/remex-html/RemexHtml/TreeBuilder/Marker.php
+++ b/wikimedia/remex-html/RemexHtml/TreeBuilder/Marker.php
@@ -20,4 +20,3 @@
PropGuard::set( $this, $name, $value );
}
}
-
diff --git a/wikimedia/remex-html/RemexHtml/TreeBuilder/Stack.php
b/wikimedia/remex-html/RemexHtml/TreeBuilder/Stack.php
index b0a976b..b36a3d4 100644
--- a/wikimedia/remex-html/RemexHtml/TreeBuilder/Stack.php
+++ b/wikimedia/remex-html/RemexHtml/TreeBuilder/Stack.php
@@ -109,7 +109,7 @@
* and $this->length() - 1 is the most recently inserted element. This
will
* raise a PHP notice if the index is out of range.
*
- * @param integer $idx
+ * @param int $idx
* @return Element|null
*/
abstract public function item( $idx );
diff --git a/wikimedia/remex-html/RemexHtml/TreeBuilder/TemplateModeStack.php
b/wikimedia/remex-html/RemexHtml/TreeBuilder/TemplateModeStack.php
index fb5be9e..3416f76 100644
--- a/wikimedia/remex-html/RemexHtml/TreeBuilder/TemplateModeStack.php
+++ b/wikimedia/remex-html/RemexHtml/TreeBuilder/TemplateModeStack.php
@@ -22,7 +22,7 @@
/**
* Push a mode on to the stack
- * @param integer $mode
+ * @param int $mode
*/
public function push( $mode ) {
$this->nonCurrentModes[] = $this->current;
diff --git a/wikimedia/remex-html/RemexHtml/TreeBuilder/TreeBuilder.php
b/wikimedia/remex-html/RemexHtml/TreeBuilder/TreeBuilder.php
index fe2a212..fb490c8 100644
--- a/wikimedia/remex-html/RemexHtml/TreeBuilder/TreeBuilder.php
+++ b/wikimedia/remex-html/RemexHtml/TreeBuilder/TreeBuilder.php
@@ -326,8 +326,8 @@
* @author C. Scott Ananian, Tim Starling
*
* @param string $subject The subject tag name.
- * @param integer $sourceStart
- * @param integer $sourceLength
+ * @param int $sourceStart
+ * @param int $sourceLength
*/
public function adoptionAgency( $subject, $sourceStart, $sourceLength )
{
$afe = $this->afe;
@@ -403,7 +403,7 @@
$furthestBlockIndex = -1;
$stackLength = $stack->length();
- for ( $i = $fmtEltIndex+1; $i < $stackLength; $i++ ) {
+ for ( $i = $fmtEltIndex + 1; $i < $stackLength; $i++ ) {
$item = $stack->item( $i );
if ( isset(
HTMLData::$special[$item->namespace][$item->name] ) ) {
$furthestBlock = $item;
@@ -612,7 +612,7 @@
* Generate implied end tags, optionally with an element to exclude.
*
* @param string|null $name The name to exclude
- * @param integer $pos The source position
+ * @param int $pos The source position
*/
public function generateImpliedEndTags( $name, $pos ) {
$stack = $this->stack;
@@ -648,8 +648,8 @@
* the list.
*
* @param string $name The name to exclude
- * @param integer $sourceStart
- * @param integer $sourceLength
+ * @param int $sourceStart
+ * @param int $sourceLength
*/
public function generateImpliedEndTagsAndPop( $name, $sourceStart,
$sourceLength ) {
$this->generateImpliedEndTags( $name, $sourceStart );
@@ -708,7 +708,7 @@
* not popped, and a set of names is used instead of a single name.
*
* @param array $names
- * @param integer $pos
+ * @param int $pos
*/
public function clearStackBack( $names, $pos ) {
$stack = $this->stack;
diff --git a/wikimedia/remex-html/RemexHtml/TreeBuilder/TreeHandler.php
b/wikimedia/remex-html/RemexHtml/TreeBuilder/TreeHandler.php
index 8ad34dc..e8f209f 100644
--- a/wikimedia/remex-html/RemexHtml/TreeBuilder/TreeHandler.php
+++ b/wikimedia/remex-html/RemexHtml/TreeBuilder/TreeHandler.php
@@ -17,14 +17,14 @@
/**
* Called when parsing stops.
*
- * @param integer $pos The input string length, i.e. the past-the-end
position.
+ * @param int $pos The input string length, i.e. the past-the-end
position.
*/
function endDocument( $pos );
/**
* Insert characters.
*
- * @param integer $preposition The placement of the new node with
respect
+ * @param int $preposition The placement of the new node with respect
* to $ref. May be TreeBuilder::
* - BEFORE: insert as a sibling before the reference element
* - UNDER: append as the last child of the reference element
@@ -34,12 +34,12 @@
* @param string $text The text to insert is a substring of this string,
* with the start and length of the substring given by $start and
* $length. We do it this way to avoid unnecessary copying.
- * @param integer $start The start of the substring
- * @param integer $length The length of the substring
- * @param integer $sourceStart The input position. This is not
necessarily
+ * @param int $start The start of the substring
+ * @param int $length The length of the substring
+ * @param int $sourceStart The input position. This is not necessarily
* accurate, particularly when the tokenizer is run without
ignoreEntities,
* or in CDATA sections.
- * @param integer $sourceLength The length of the input which is
consumed.
+ * @param int $sourceLength The length of the input which is consumed.
* The same caveats apply as for $sourceStart.
*/
function characters( $preposition, $ref, $text, $start, $length,
$sourceStart, $sourceLength );
@@ -50,7 +50,7 @@
* identifier to the userData property of the Element object, to
identify
* the element when it is used again in subsequent tree mutations.
*
- * @param integer $preposition The placement of the new node with
respect
+ * @param int $preposition The placement of the new node with respect
* to $ref. May be TreeBuilder::
* - BEFORE: insert as a sibling before the reference element
* - UNDER: append as the last child of the reference element
@@ -68,8 +68,8 @@
* sent for such an element. This is only true if self-closing tags
are
* acknowledged for this tag name, so it is a hint to the serializer
that
* a self-closing tag is acceptable.
- * @param integer $sourceStart The input position
- * @param integer $sourceLength The length of the input which is
consumed
+ * @param int $sourceStart The input position
+ * @param int $sourceLength The length of the input which is consumed
*/
function insertElement( $preposition, $ref, Element $element, $void,
$sourceStart, $sourceLength );
@@ -79,8 +79,8 @@
* of open elements. It probably won't be mutated again.
*
* @param Element $element The element being ended
- * @param integer $sourceStart The input position
- * @param integer $sourceLength The length of the input which is
consumed
+ * @param int $sourceStart The input position
+ * @param int $sourceLength The length of the input which is consumed
*/
function endTag( Element $element, $sourceStart, $sourceLength );
@@ -90,19 +90,19 @@
* @param string $name The doctype name, usually "html"
* @param string $public The PUBLIC identifier
* @param string $system The SYSTEM identifier
- * @param integer $quirks The quirks mode implied from the doctype. One
of:
+ * @param int $quirks The quirks mode implied from the doctype. One of:
* - TreeBuilder::NO_QUIRKS : no quirks
* - TreeBuilder::LIMITED_QUIRKS : limited quirks
* - TreeBuilder::QUIRKS : full quirks
- * @param integer $sourceStart The input position
- * @param integer $sourceLength The length of the input which is
consumed
+ * @param int $sourceStart The input position
+ * @param int $sourceLength The length of the input which is consumed
*/
function doctype( $name, $public, $system, $quirks, $sourceStart,
$sourceLength );
/**
* Insert a comment
*
- * @param integer $preposition The placement of the new node with
respect
+ * @param int $preposition The placement of the new node with respect
* to $ref. May be TreeBuilder::
* - BEFORE: insert as a sibling before the reference element
* - UNDER: append as the last child of the reference element
@@ -110,8 +110,8 @@
* @param Element|null $ref Insert before/below this element, or null if
* $preposition is ROOT.
* @param string $text The text of the comment
- * @param integer $sourceStart The input position
- * @param integer $sourceLength The length of the input which is
consumed
+ * @param int $sourceStart The input position
+ * @param int $sourceLength The length of the input which is consumed
*/
function comment( $preposition, $ref, $text, $sourceStart,
$sourceLength );
@@ -121,7 +121,7 @@
* @param string $text An error message explaining in English what the
* author did wrong, and what the parser intends to do about the
* situation.
- * @param integer $pos The input position at which the error occurred
+ * @param int $pos The input position at which the error occurred
*/
function error( $text, $pos );
@@ -133,7 +133,7 @@
*
* @param Element $element The element to update
* @param Attributes $attrs The new attributes to add
- * @param integer $sourceStart The input position
+ * @param int $sourceStart The input position
*/
function mergeAttributes( Element $element, Attributes $attrs,
$sourceStart );
@@ -143,7 +143,7 @@
* partially-constructed body element.
*
* @param Element $element The element to remove
- * @param integer $sourceStart The location in the source at which this
+ * @param int $sourceStart The location in the source at which this
* action was triggered.
*/
function removeNode( Element $element, $sourceStart );
@@ -155,7 +155,7 @@
*
* @param Element $element The old parent element
* @param Element $newParent The new parent element
- * @param integer $sourceStart The location in the source at which this
+ * @param int $sourceStart The location in the source at which this
* action was triggered.
*/
function reparentChildren( Element $element, Element $newParent,
$sourceStart );
diff --git a/wikimedia/remex-html/RemexHtml/TreeBuilder/TreeMutationTracer.php
b/wikimedia/remex-html/RemexHtml/TreeBuilder/TreeMutationTracer.php
index a34394d..a9244f6 100644
--- a/wikimedia/remex-html/RemexHtml/TreeBuilder/TreeMutationTracer.php
+++ b/wikimedia/remex-html/RemexHtml/TreeBuilder/TreeMutationTracer.php
@@ -15,7 +15,7 @@
*
* @param TreeHandler $handler The next pipeline stage
* @param callable $callback The message output function
- * @param integer $verbosity Set to non-zero to call dump() on the
handler
+ * @param int $verbosity Set to non-zero to call dump() on the handler
* before and after each event.
*/
public function __construct( TreeHandler $handler, callable $callback,
$verbosity = 0 ) {
--
To view, visit https://gerrit.wikimedia.org/r/401416
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9fb9978c69f37bafc0049cd7ed343c033dd50ef8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/vendor
Gerrit-Branch: master
Gerrit-Owner: Tim Starling <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits