RESOLVED FIXED 225038
Subdivide image overlay text into one or more elements per line
https://bugs.webkit.org/show_bug.cgi?id=225038
Summary Subdivide image overlay text into one or more elements per line
Wenson Hsieh
Reported 2021-04-25 16:38:10 PDT
Attachments
For EWS (48.91 KB, patch)
2021-04-25 17:50 PDT, Wenson Hsieh
ews-feeder: commit-queue-
Fix non-internal builds (48.98 KB, patch)
2021-04-25 18:09 PDT, Wenson Hsieh
no flags
For EWS (61.23 KB, patch)
2021-04-26 17:01 PDT, Wenson Hsieh
no flags
For EWS (53.83 KB, patch)
2021-04-26 17:02 PDT, Wenson Hsieh
no flags
Wenson Hsieh
Comment 1 2021-04-25 17:50:06 PDT Comment hidden (obsolete)
Wenson Hsieh
Comment 2 2021-04-25 18:09:15 PDT
Created attachment 427017 [details] Fix non-internal builds
Devin Rousso
Comment 3 2021-04-26 14:19:07 PDT
Comment on attachment 427017 [details] Fix non-internal builds View in context: https://bugs.webkit.org/attachment.cgi?id=427017&action=review r=me as well :) > Source/WebCore/html/HTMLElement.cpp:1348 > + if (lineQuad.isEmpty()) > continue; Should/Can we check this before `scale`? > Source/WebCore/html/HTMLElement.cpp:1354 > + auto lineBounds = rotatedBoundingRect(lineQuad, 0.01); NIT: Can we pull this into a `constexpr auto minRotationInRadians = 0.01;` or something? > Source/WebCore/html/HTMLElement.cpp:1360 > + std::round(lineBounds.center.x() - lineBounds.size.width() / 2), "px, "_s, > + std::round(lineBounds.center.y() - lineBounds.size.height() / 2), "px) "_s, NIT: I personally like to add parenthesis to avoid any chance of order-of-operations confusion (both from the compiler and from the reader): ``` std::round(lineBounds.center.x() - (lineBounds.size.width() / 2)), "px, "_s, std::round(lineBounds.center.y() - (lineBounds.size.height() / 2)), "px) "_s, ``` > Source/WebCore/html/HTMLElement.cpp:1361 > + lineBounds.angleInRadians ? makeString("rotate(", lineBounds.angleInRadians, "rad) "_s) : emptyString() `"rotate("_s` > Source/WebCore/html/HTMLElement.cpp:1419 > + adjustLayoutUnitForAbsoluteZoom(renderer->offsetHeight(), *renderer).toFloat() you could add a trailing comma here > Source/WebCore/html/shadow/imageOverlay.css:33 > + font-size: 1024px; o_0 this probably deserves a comment > Source/WebCore/platform/ImageExtractionResult.h:37 > + ImageExtractionTextData(const String& theText, const FloatQuad& quad) I wonder if we could make this `FloatQuad&&` instead. > Source/WebCore/platform/ImageExtractionResult.h:72 > + ImageExtractionLineData(const FloatQuad& quad, const Vector<ImageExtractionTextData>& theChildren) I wonder if we could make these `FloatQuad&&` and `Vector<ImageExtractionTextData>&&` instead.
Wenson Hsieh
Comment 4 2021-04-26 15:42:09 PDT
Comment on attachment 427017 [details] Fix non-internal builds View in context: https://bugs.webkit.org/attachment.cgi?id=427017&action=review Tim and I chatted >> Source/WebCore/html/HTMLElement.cpp:1348 >> continue; > > Should/Can we check this before `scale`? 👍🏻 >> Source/WebCore/html/HTMLElement.cpp:1354 >> + auto lineBounds = rotatedBoundingRect(lineQuad, 0.01); > > NIT: Can we pull this into a `constexpr auto minRotationInRadians = 0.01;` or something? Per Slack discussion with Tim, I'm renaming `rotatedBoundingRect` to `rotatedBoundingRectWithMinimumAngleOfRotation`, which should help clear the confusion. >> Source/WebCore/html/HTMLElement.cpp:1360 >> + std::round(lineBounds.center.y() - lineBounds.size.height() / 2), "px) "_s, > > NIT: I personally like to add parenthesis to avoid any chance of order-of-operations confusion (both from the compiler and from the reader): > ``` > std::round(lineBounds.center.x() - (lineBounds.size.width() / 2)), "px, "_s, > std::round(lineBounds.center.y() - (lineBounds.size.height() / 2)), "px) "_s, > ``` 👍🏻 >> Source/WebCore/html/HTMLElement.cpp:1361 >> + lineBounds.angleInRadians ? makeString("rotate(", lineBounds.angleInRadians, "rad) "_s) : emptyString() > > `"rotate("_s` Good catch. Fixed! >> Source/WebCore/html/HTMLElement.cpp:1419 >> + adjustLayoutUnitForAbsoluteZoom(renderer->offsetHeight(), *renderer).toFloat() > > you could add a trailing comma here 👍🏻 >> Source/WebCore/html/shadow/imageOverlay.css:33 >> + font-size: 1024px; > > o_0 this probably deserves a comment Yep, adding one. >> Source/WebCore/platform/ImageExtractionResult.h:37 >> + ImageExtractionTextData(const String& theText, const FloatQuad& quad) > > I wonder if we could make this `FloatQuad&&` instead. We could, though I don't think it'll make much of a difference. I'll change It to use && anyways. >> Source/WebCore/platform/ImageExtractionResult.h:72 >> + ImageExtractionLineData(const FloatQuad& quad, const Vector<ImageExtractionTextData>& theChildren) > > I wonder if we could make these `FloatQuad&&` and `Vector<ImageExtractionTextData>&&` instead. Ditto.
Wenson Hsieh
Comment 5 2021-04-26 15:44:00 PDT
(In reply to Wenson Hsieh from comment #4) > Comment on attachment 427017 [details] > Fix non-internal builds > > View in context: > https://bugs.webkit.org/attachment.cgi?id=427017&action=review > > Tim and I chatted (This unfinished sentence was supposed to be about the name of `WebCore::rotatedBoundingRect`, but I wrote what I was going to write here in an inline comment anyways)
Wenson Hsieh
Comment 6 2021-04-26 17:01:55 PDT Comment hidden (obsolete)
Wenson Hsieh
Comment 7 2021-04-26 17:02:24 PDT
EWS
Comment 8 2021-04-26 19:59:25 PDT
Committed r276626 (237054@main): <https://commits.webkit.org/237054@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 427109 [details].
Note You need to log in before you can comment on or make changes to this bug.