Commit 11ec6a9b authored by Keishi Hattori's avatar Keishi Hattori Committed by Commit Bot

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/+/1909669Reviewed-by: default avatarKeishi Hattori <keishi@chromium.org>
Commit-Queue: Keishi Hattori <keishi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#714159}
parent d3913419
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#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"
...@@ -64,9 +65,9 @@ bool ParseHexColorString(const std::string& color_string, SkColor* result) { ...@@ -64,9 +65,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.assign(color_string, 1, 6); formatted_color = color_string.substr(1, 6);
} else if (color_string.length() == 9) { } else if (color_string.length() == 9) {
formatted_color.assign(color_string, 1, 8); formatted_color = color_string.substr(1, 8);
} else { } else {
return false; return false;
} }
...@@ -76,9 +77,10 @@ bool ParseHexColorString(const std::string& color_string, SkColor* result) { ...@@ -76,9 +77,10 @@ bool ParseHexColorString(const std::string& color_string, SkColor* result) {
formatted_color += "FF"; formatted_color += "FF";
} }
// Convert the hex string to an integer. // Convert the string to an integer and make sure it is in the correct value
std::array<uint8_t, 4> color_bytes; // range.
if (!base::HexStringToSpan(formatted_color, color_bytes)) std::vector<uint8_t> 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