[pull] master from mozilla:master - #498
Merged
Merged
Conversation
The rule rewrites `Math.max(C, Math.min(A, B))` to `MathClamp(A, C, B)`, always taking the inner call's first operand as the value. `Math.min` is commutative, so the value is just as often the second one, and then the fixer swaps it with the upper bound: the result is `Math.min(C, v)`, which no longer applies the lower bound at all. Both call sites the fixer rewrote hit that case, so the max-outer patterns are now reported without a fix. Reporting them still needs its own message. `Math.max(C, Math.min(A, B))` is only `MathClamp(A, C, B)` when `C <= B`, and the rule can't know whether that holds, so telling the reader to "use MathClamp" is wrong advice. The message states the condition instead, and `useClamp` is left to the min-outer patterns, which are exact. In `PSStackBasedInterpreter.build` the outputs were therefore never clamped up to the Range minimum. The interpreter runs whenever `PSStackToTree` can't turn the program into a tree — a stack-shrinking `if`, or a `copy`/`index`/`roll` whose operand isn't a constant — and it then let a Type 4 function return e.g. -1.5 for a component declared as `/Range [0 1]`. In `SplitView.#clampFirstSize` the first pane's size was never clamped up to `#minSize`: dragging the resizer past it wrote a negative `flexGrow`. The existing range-clamping test only checked the upper bound, which is the one the wrong operand order preserves.
… Map Using a Map seems more appropriate given that there's a bunch of adding/removing of entries, and it's especially helpful at the end of the getter since it's easy/efficient to determine its size (whereas an Object requires iterating though it to do that).
Given that the relevant worker-thread message handler is conditionally defined, note [this code](https://github.com/mozilla/pdf.js/blob/5903d58d58e4dd9ce6ffa3834aea8480f06b4ada/src/core/worker.js#L987-L1005), it makes sense to do the same thing on the main-thread as well. This way we avoid bundling a small amount of unused code in e.g. the Firefox PDF Viewer.
…ices` There's no point in first checking if something is a number, when we *immediately* afterwards have a `Number.isInteger(...)` check.
Only define the `getRawData` API methods when building INTERNAL_VIEWER
…ypeof Remove unnecessary `typeof` check in `Field.prototype.currentValueIndices`
Avoid creating a couple of intermediate Arrays
Fix the two MathClamp calls the prefer-math-clamp fixer mis-ordered
…nt-simplify Simplify the `Stepper.prototype.getNextBreakPoint` method
…ttributes-Map Let the `StructElementNode.prototype.tableAttributes` getter return a Map
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )