aboutsummaryrefslogtreecommitdiffstats
path: root/includes/content/Renderer
Commit message (Collapse)AuthorAgeFilesLines
* Remove 2-line PHPDocs that just repeat the types from the codethiemowmde2025-01-171-4/+0
| | | | | | | | | | | | | | | | Same as Ia294bf4 did for 1-line comments. This patch removes slightly more complex 2-line PHPDoc comments that don't add any new information to the code, but literally repeat what the code already says. They say "don't document the code, code the documentation", and we are doing this more and more. We just tend to forget to remove the obsolete comments. Note I'm also removing a line of text in a few cases when it's very short and literally says the same as the method name. Again, such comments add zero new information. Change-Id: I01535404bab458c6c47e48e5456403b7a64198ed
* Remove trivial 1-line PHPDocs that just repeat the codethiemowmde2025-01-161-20/+0
| | | | | | | | | | | | | I assume these are all either auto-generated by an IDE or the language-level type declarations have been added later. In any case the comments don't add any new information to what the code already says. This is just extra clutter that makes the code harder to read, I would argue. There are many, many more comments like this. In this patch I intentionally focus on the most trivial 1-line comments. Change-Id: Ia294bf4ce0d8a77036842fe25884bc175c2b0e7d
* Use explicit nullable type on parameter argumentsUmherirrender2024-10-161-1/+1
| | | | | | | | | | | Implicitly marking parameter $... as nullable is deprecated in php8.4, the explicit nullable type must be used instead Created with autofix from Ide15839e98a6229c22584d1c1c88c690982e1d7a Break one long line in SpecialPage.php Bug: T376276 Change-Id: I807257b2ba1ab2744ab74d9572c9c3d3ac2a968e
* Namespace all remaining classes in includes/parserJames D. Forrester2024-10-152-2/+2
| | | | | Bug: T353458 Change-Id: If02cc9b1ff78e26c1cf8c91ee4695845eb133829
* Provide previous parse results to parser when renderingC. Scott Ananian2024-08-232-5/+31
| | | | | | | | | | | | | | | | | | | | | | | | | This patch lays the groundwork for incremental/selective parsing in Parsoid by ensuring that we can pass previous cached parses through the parse pipeline to Parsoid. We do this by adding a new render hint type, `previous-output`, and ensuring it is passed along. Because revisions can contain a ParserOutput which is the combination of separate ParserOutput objects for each of their slots, RenderedRevision also contains a method to unsplit the combined ParserOutput to reconstruct an original ParserOutput for use in incremental parsing. Currently this is mostly a stub, but illustrates how slot combination and splitting can work, assuming those transformations are reversible. Extra calls to ParserCache::getDirty() are added to some code paths in order to ensure that any previously-cached ParserOutput is available for selective update. In order to mitigate any performance concerns, these are only done for the Parsoid parser at the moment. Future patches will add additional metrics to quantify the cost/benefit ratio of the additional cache lookups on these paths. Bug: T363421 Bug: T371713 Change-Id: I440884f1d7e09c1ff9806f848b7b53a636367690
* Move remaining four classes in includes/content into Content namespaceJames D. Forrester2024-08-101-1/+1
| | | | | Bug: T353458 Change-Id: Ia0f3e22078550be410c4b87faf6aa4eabe6e270d
* Tighten up phan type for ContentRenderer::getParserOutput()C. Scott Ananian2024-02-281-1/+1
| | | | | | | | | | Passing an `int` as the $revision was deprecated with a warning, but also tighten up the phan @param type to hopefully catch a few more cases of this in CI rather than the logs. Bug: T350538 Bug: T358243 Change-Id: I73a3b77d9982bcfaa9c235cde31fafff9a13e92e
* Revert "Do not hard deprecate passing an int to ↵C. Scott Ananian2024-02-091-0/+1
| | | | | | | | | | | ContentRenderer::getParserOutput" This reverts commit 7fa728d6eca6fb4504ef6b46ba7cded1d5d71f81. Reason for revert: The remaining use in FlaggedRevs has been fixed. Depends-On: I3ad410bbbe12cfbe0caf32507dadbe2ae72e764f Change-Id: I9128231ac4f3b49db616bd4ecf2f950c44d4b0d2
* Do not hard deprecate passing an int to ContentRenderer::getParserOutputTaavi Väänänen2024-02-081-1/+0
| | | | | | | Still used in Wikimedia deployed code. Bug: T357006 Change-Id: I107d6d830ef5b4bc7914a98945882a5e1b0d144c
* Rename ParserOutput::{get,set}Timestamp() to ::{get,set}RevisionTimestamp()C. Scott Ananian2024-02-071-2/+2
| | | | | | | | | | This avoids confusion with the "render timestamp" held by the cache, and is consistent with ::get*RevisionId() etc. The old ::getTimestamp() and ::setTimestamp() methods have been deprecated. Change-Id: Idb5e687709c98086c5d3075d31885c58a0723197
* Add ParserOutput::{get,set}RenderId() and set render id in ContentRendererC. Scott Ananian2024-02-071-4/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Set the render ID for each parse stored into cache so that we are able to identify a specific parse when there are dependencies (for example in an edit based on that parse). This is recorded as a property added to the ParserOutput, not the parent CacheTime interface. Even though the render ID is /related/ to the CacheTime interface, CacheTime is also used directly as a parser cache key, and the UUID should not be part of the lookup key. In general we are trying to move the location where these cache properties are set as early as possible, so we check at each location to ensure we don't overwrite a previously-set value. Eventually we can convert most of these checks into assertions that the cache properties have already been set (T350538). The primary location for setting cache properties is the ContentRenderer. Moved setting the revision timestamp into ContentRenderer as well, as it was set along the same code paths. An extra parameter was added to ContentRenderer::getParserOutput() to support this. Added merge code to ParserOutput::mergeInternalMetaDataFrom() which should ensure that cache time, revision, timestamp, and render id are all set properly when multiple slots are combined together in MCR. In order to ensure the render ID is set on all codepaths we needed to plumb the GlobalIdGenerator service into ContentRenderer, ParserCache, ParserCacheFactory, and RevisionOutputCache. Eventually (T350538) it should only be necessary in the ContentRenderer. Bug: T350538 Bug: T349868 Followup-To: Ic9b7cc0fcf365e772b7d080d76a065e3fd585f80 Change-Id: I72c5e6f86b7f081ab5ce7a56f5365d2f75067a78
* Namespace ParserOutputJames D. Forrester2023-12-141-1/+1
| | | | | | | Most used non-namespaced class! Bug: T353458 Change-Id: I4c2cbb0a808b3881a4d6ca489eee5d8c8ebf26cf
* Replace deprecated calls `ParserOptions::newCanonical( 'canonical' )`Derick Alangi2022-06-161-1/+1
| | | | | | | | This is a quick find & replace of calls to the deprecated method ParserOptions::newCanonical() when the context is the string literal 'canonical'. This can be safely replaced by called newFromAnon(). Change-Id: If7bb68459b11e0c5f5de188f10fdae85ad1a78bf
* Move Content::getParserOutput & AbstractContent::fillParserOutput to ↵Roman Stolar2021-09-292-0/+116
ContentHandler Update/Create override classes of ContentHandler. Soft-deprecate and remove method from Content and classes that override them. Bug: T287158 Change-Id: Idfcfbfe1a196cd69a04ca357281d08bb3d097ce2