aboutsummaryrefslogtreecommitdiffstats
path: root/includes/diff/SlotDiffRenderer.php
Commit message (Collapse)AuthorAgeFilesLines
* Use namespaced classesUmherirrender2024-10-211-0/+1
| | | | | | | Changes to the use statements done automatically via script Addition of missing use statement done manually Change-Id: I73fb416573f5af600e529d224b5beb5d2e3d27d3
* Use explicit nullable type on parameter argumentsUmherirrender2024-10-161-2/+2
| | | | | | | | | | | 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 includes/contextJames D. Forrester2024-02-081-0/+1
| | | | | Bug: T353458 Change-Id: I4dbef138fd0110c14c70214282519189d70c94fb
* Reorg: Move three output related classes to includes/Output/Amir Sarabadani2023-09-051-0/+2
| | | | | | | | | | And namesapce them: - StreamFile - OutputHandler - OutputPage Bug: T321882 Change-Id: Iedf8d88c595e580f2d8f0734c92aa5c45618ba33
* Add SlotDiffRenderer::localizeDiff()Tim Starling2023-07-201-0/+14
| | | | | | | | | | | | | | | | | It makes sense for SlotDiffRenderer to localize the diffs that it returns. DifferenceEngine can't conveniently use this right now since it stores all slot diffs concatenated together in a cache entry. It can't break the string apart again to call the right SlotDiffRenderer on each slot diff. So it assumes there must be a text diff in there somewhere and calls TextDiffer over the whole thing. EntitySchema does not have this problem and can benefit from this method. Bug: T342209 Change-Id: Ie06e100bb0e945de5dbe3dade14b2e6b706e078d
* Merge "diff: Move SlotDiffRenderer::getTablePrefix() parts assembly up to ↵jenkins-bot2023-06-261-3/+5
|\ | | | | | | DifferenceEngine"
| * diff: Move SlotDiffRenderer::getTablePrefix() parts assembly up to ↵Tim Starling2023-06-261-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DifferenceEngine getTablePrefix() is used to show the inline legend and inline switcher. It is not yet part of a released stable interface. Theoretically there may be multiple text slots on a page, and we don't want multiple inline legends. There was already a fragment assembly system, for the benefit of hook handlers, so move that up to the page level, so that it can also deduplicate prefix fragments coming from each slot. Add tests. Bug: T324759 Change-Id: I9baa5c24128c63bc318ba13e83a024843f4ab15e
* | Merge "diff: Add inline format switch when Wikidiff2 is installed"jenkins-bot2023-06-261-1/+3
|\|
| * diff: Add inline format switch when Wikidiff2 is installedhmonroy2023-06-261-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a switch that allows toggling between inline and two-column format when Wikidiff2 is installed. Inline toggle should also support no-JS toggling The legend should toggle when switching from table to inline after the first load. Introduced a temporary feature flag to show this inline toggle so that we can merge and easily continue the improvements. It will be removed when ready for production. Bug: T336712 Bug: T330229 Change-Id: Ie6a48e495f2bb299d8b984e7c40363d534c7915b
* | Improve handling of diffs between incompatible content modelsGergő Tisza2023-06-231-4/+27
|/ | | | | | | | | When the old and new content object for a slot cannot be compared, show an error message for that slot only, instead of throwing an exception. Bug: T214217 Change-Id: I6e982df358f85ca78f0448b3a93ded3f40676310
* Do not generate diffs for slots with identical contentTim Starling2023-06-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | When the old and new revisions have identical content in a given slot, do not include the relevant SlotDiffRenderer in the return value of DifferenceEngine::getSlotDiffRenderers(), so that the relevant table prefixes and modules will be omitted. Also: * In TextSlotDiffRenderer::getTextDiff(), return an empty string when the inputs are equal, instead of invoking the diff engine. Previously, the inline format would produce a <tr> element in this case, causing the diff-empty message to be omitted. * Clarify the doc comment up the stack, indicating SlotDiffRenderer may return zero <tr> tags, it doesn't have to be one or more. * Fix the documented return type of getSlotContents() so that @var is not needed in the caller. * Don't convert the return value of SlotDiffRenderer::getDiff() to boolean. It's always a string so compare it to the empty string. Note that the cache key for inline empty diffs will change, because TextSlotDiffRenderer::getExtraCacheKeys() is not called anymore for empty diffs. Bug: T338670 Change-Id: I0774ba0b159ac43ec214403cf2d06740f6d067cd
* diff: Add legend and tooltips to inline diff displaySam Wilson2023-05-311-0/+10
| | | | | | | | | | | | | | | | | | | | Add a legend at the top of the inline diff display, showing the meanings of the colours of the inserted and deleted highlighting. Also add the same text as tooltips on the highlighted elements. The legend is added as part of a new area above the diff table that can be modified via a new TextSlotDiffRendererTablePrefix hook, so that extensions can add other buttons etc. there as required. This is a follow-up to the previous attempt, which added the legend in DifferenceEngine::showDiff() and was called from too many places. This patch moves it to be called in DifferenceEngine::showDiffPage(). Bug: T324759 Change-Id: I2a3c67bcfa47313dee597e602a62073e4e298cd2 Follow-up: I6de30bf79eb5ac262285951792782b870d075e00
* Pass array to Assert::parameterType when asserting multiple typesUmherirrender2022-06-181-4/+5
| | | | Change-Id: I6db78db18b2d8982ce5158f44c03bfdb8d48f97c
* Improve and add documentation to diff related classesUmherirrender2020-11-221-1/+1
| | | | Change-Id: Ic10c700e970018fa0b9a219d96d56908b0298d71
* Merge "Replace "@stable for subclassing" with "@stable to extend""jenkins-bot2020-07-131-1/+1
|\
| * Replace "@stable for subclassing" with "@stable to extend"daniel2020-07-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | For compliance with the new version of the table interface policy (T255803). This patch was created by an automated search & replace operation on the includes/ directory. Bug: T257789 Change-Id: Ie32c1b11b3d16ddfc0c83a757327d449ff80b2e4
* | Replace "@stable for overriding" with "@stable to override"daniel2020-07-131-2/+2
|/ | | | | | | | | | | For compliance with the new version of the table interface policy (T255803). This patch was created by an automated search & replace operation on the includes/ directory. Bug: T257789 Change-Id: I5ffbb91882ecce2019ab644839eab5e8fb8a1c5f
* Mark remaining eligible classes as stable for subclassingdaniel2020-07-101-0/+3
| | | | | | | | This classes were found by surveying concrete classes derved from base classes in core. Bug: T247862 Change-Id: I231752aaad26e2ab3f097301e449b31e723590f0
* Add UnknownContentHandler.daniel2019-08-291-1/+1
| | | | | | | | | | | | | | | | | UnknownContentHandler can be configued to handle models that belong to extensions that have been undeployed: $wgContentHandlers['xyzzy'] = 'UnknownContentHandler'; This way, no errors will be thrown when trying to access pages with the unsupported model. Instead, an error message is shown, and editing is prevented. This patch also improves handling of non-editable content in EditPage and in DifferenceEngine. Bug: T220608 Change-Id: Ia94521b786c0a5225a674e4dc3cb6761a723d75b
* Fix SlotDiffRenderer documentationLucas Werkmeister2019-02-141-2/+2
| | | | | | | | | | I cannot find any trace of the getSlotDiffRendererClass method mentioned in the old comment – even patch set 1 of I2f8a9dbebd, which introduced the whole SlotDiffRenderer class, already had getSlotDiffRenderer and getSlotDiffRendererInternal instead of getSlotDiffRendererClass in ContentHandler. Change-Id: I56595cedea3f82a328df64200dd9285d8526e67a
* SlotDiffRenderer: add utility method for parameter type checksGergő Tisza2018-09-241-0/+32
| | | | Change-Id: I0161070fd0330d4945cec2f76f4fd8128a9793b9
* [MCR] Render multi-slot diffsGergő Tisza2018-08-201-0/+65
Move logic for rendering a diff between two content objects out of DifferenceEngine, into a new SlotDiffRenderer class. Make DifferenceEngine use multiple SlotDiffRenderers, one per slot. This separates the class tree for changing high-level diff properties such as the header or the revision selection method (same as before: subclass DifferenceEngine and override ContentHandler::getDiffEngineClass or implement GetDifferenceEngine) and the one for changing the actual diff rendering for a given content type (subclass SlotDiffRenderer and override ContentHandler::getSlotDiffRenderer or implement GetSlotDiffRenderer). To keep B/C, when SlotDiffRenderer is not overridden for a given content type but DifferenceEngine is, that DifferenceEngine will be used instead. The weak point of the scheme is overriding the DifferenceEngine methods passing control to the SlotDiffRenderers (the ones calling getDifferenceEngines), without calling the parent. These are: showDiffStyle, getDiffBody, getDiffBodyCacheKeyParams. Extensions doing that will probably break in unpredictable ways (most likely, only showing the main slot diff). Nothing in gerrit does it, at least. A new GetSlotDiffRenderer hook is added to modify rendering for content models not owned by the extension, much like how GetDifferenceEngine works. Also deprecates public access to mNewRev/mOldRev and creates public getters instead. DifferenceEngine never supported external changes to those properties, this just acknowledges it. Bug: T194731 Change-Id: I2f8a9dbebd2290b7feafb20e2bb2a2693e18ba11 Depends-On: I04e885a33bfce5bccc807b9bcfe1eaa577a9fd47 Depends-On: I203d8895bf436b7fee53fe4718dede8a3b1768bc