Commit e7d02d40 authored by Eric Roman's avatar Eric Roman Committed by Commit Bot

Reland "Make use of new hex decoding function for extensions color string parser."

This reverts commit 11ec6a9b.

Reason for revert: The failed screenshot tests were not caused by this change

Original change's description:
> Revert "Make use of new hex decoding function for extensions color string parser."
> 
> This reverts commit 2de0ccb8.
> 
> Reason for revert: Suspecting cause for screenshot test failure. Seems unlikely but this is the only color related CL in regression range. crbug.com/1023255
> 
> Original change's description:
> > Make use of new hex decoding function for extensions color string parser.
> > 
> > Bug: 1021236
> > Change-Id: I1d1b5180048eb36fa78406a02fc3277cba0dcf63
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1904809
> > Commit-Queue: Eric Roman <eroman@chromium.org>
> > Commit-Queue: Reilly Grant <reillyg@chromium.org>
> > Auto-Submit: Eric Roman <eroman@chromium.org>
> > Reviewed-by: Reilly Grant <reillyg@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#713942}
> 
> TBR=eroman@chromium.org,reillyg@chromium.org
> 
> # Not skipping CQ checks because original CL landed > 1 day ago.
> 
> Bug: 1021236
> Change-Id: I474f4e07583f571722e4bacf28ae482c071276a8
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1909669
> Reviewed-by: Keishi Hattori <keishi@chromium.org>
> Commit-Queue: Keishi Hattori <keishi@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#714159}

TBR=eroman@chromium.org,reillyg@chromium.org,keishi@chromium.org

Change-Id: Ifff4b8df577ad13e2cbffcfe90044caac9b0a888
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1021236
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1909654Reviewed-by: default avatarEric Roman <eroman@chromium.org>
Commit-Queue: Eric Roman <eroman@chromium.org>
Auto-Submit: Eric Roman <eroman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#714282}
parent 4b014e13
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include <stdint.h> #include <stdint.h>
#include <algorithm> #include <algorithm>
#include <vector>
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/files/file_util.h" #include "base/files/file_util.h"
...@@ -65,9 +64,9 @@ bool ParseHexColorString(const std::string& color_string, SkColor* result) { ...@@ -65,9 +64,9 @@ bool ParseHexColorString(const std::string& color_string, SkColor* result) {
formatted_color += color_string[i]; formatted_color += color_string[i];
} }
} else if (color_string.length() == 7) { } else if (color_string.length() == 7) {
formatted_color = color_string.substr(1, 6); formatted_color.assign(color_string, 1, 6);
} else if (color_string.length() == 9) { } else if (color_string.length() == 9) {
formatted_color = color_string.substr(1, 8); formatted_color.assign(color_string, 1, 8);
} else { } else {
return false; return false;
} }
...@@ -77,10 +76,9 @@ bool ParseHexColorString(const std::string& color_string, SkColor* result) { ...@@ -77,10 +76,9 @@ bool ParseHexColorString(const std::string& color_string, SkColor* result) {
formatted_color += "FF"; formatted_color += "FF";
} }
// Convert the string to an integer and make sure it is in the correct value // Convert the hex string to an integer.
// range. std::array<uint8_t, 4> color_bytes;
std::vector<uint8_t> color_bytes; if (!base::HexStringToSpan(formatted_color, color_bytes))
if (!base::HexStringToBytes(formatted_color, &color_bytes))
return false; return false;
*result = SkColorSetARGB(color_bytes[3], color_bytes[0], color_bytes[1], *result = SkColorSetARGB(color_bytes[3], color_bytes[0], color_bytes[1],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment