Repository: mozilla/pdf.js
File: src/core/annotation.js (JavaScript)

Code before:
    }

    // The vertices array is an array of numbers representing the alternating
    // horizontal and vertical coordinates, respectively, of each vertex.
    // Convert this to an array of objects with x and y coordinates.
    const rawVertices = dict.getArray("Vertices");
    if (!isNumberArray(rawVertices, null)) {
      return;
    }
    const vertices = (this.data.vertices = Float32Array.from(rawVertices));

    if (!this.appearance) {
      // The default stroke color is black.
      const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
      const strokeAlpha = dict.get("CA");

      let fillColor = getRgbColor(dict.getArray("IC"), null);
      if (fillColor) {
        fillColor = getPdfColorArray(fillColor);
      }

      let operator;
      if (fillColor) {
        if (this.color) {
          operator = fillColor.every((c, i) => c === strokeColor[i])
            ? "F"
            : "B";
        } else {
          operator = "F";
        }
      } else {
        operator = "S";
      }

      const borderWidth = this.borderStyle.width || 1,
        borderAdjust = 2 * borderWidth;

      // If the /Rect-entry is empty/wrong, create a fallback rectangle so that
      // we get similar rendering/highlighting behaviour as in Adobe Reader.
      const bbox = [Infinity, Infinity, -Infinity, -Infinity];
      for (let i = 0, ii = vertices.length; i < ii; i += 2) {
        Util.rectBoundingBox(
          vertices[i] - borderAdjust,
          vertices[i + 1] - borderAdjust,
          vertices[i] + borderAdjust,
          vertices[i + 1] + borderAdjust,
          bbox
        );
      }
      if (!Util.intersect(this.rectangle, bbox)) {
        this.rectangle = bbox;

Review comment (suggestion):
According to https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/PDF32000_2008.pdf#page=143&zoom=auto,-219,769 we should probably replace `F` here and three lines below with `f` given the following paragraph about `F`:

```
Equivalent to f; included only for compatibility. Although PDF reader applications shall be able to accept this operator, PDF writer applications should use f instead.
```

Code after:
    }

    // The vertices array is an array of numbers representing the alternating
    // horizontal and vertical coordinates, respectively, of each vertex.
    // Convert this to an array of objects with x and y coordinates.
    const rawVertices = dict.getArray("Vertices");
    if (!isNumberArray(rawVertices, null)) {
      return;
    }
    const vertices = (this.data.vertices = Float32Array.from(rawVertices));

    if (!this.appearance) {
      // The default stroke color is black.
      const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
      const strokeAlpha = dict.get("CA");

      let fillColor = getRgbColor(dict.getArray("IC"), null);
      if (fillColor) {
        fillColor = getPdfColorArray(fillColor);
      }

      let operator;
      if (fillColor) {
        if (this.color) {
          operator = fillColor.every((c, i) => c === strokeColor[i])
            ? "f"
            : "B";
        } else {
          operator = "f";
        }
      } else {
        operator = "S";
      }

      const borderWidth = this.borderStyle.width || 1,
        borderAdjust = 2 * borderWidth;

      // If the /Rect-entry is empty/wrong, create a fallback rectangle so that
      // we get similar rendering/highlighting behaviour as in Adobe Reader.
      const bbox = [Infinity, Infinity, -Infinity, -Infinity];
      for (let i = 0, ii = vertices.length; i < ii; i += 2) {
        Util.rectBoundingBox(
          vertices[i] - borderAdjust,
          vertices[i + 1] - borderAdjust,
          vertices[i] + borderAdjust,
          vertices[i + 1] + borderAdjust,
          bbox
        );
      }
      if (!Util.intersect(this.rectangle, bbox)) {
        this.rectangle = bbox;