RESOLVED FIXED 169869
Teach TextIndicator to estimate the background color of the given Range
https://bugs.webkit.org/show_bug.cgi?id=169869
Summary Teach TextIndicator to estimate the background color of the given Range
Wenson Hsieh
Reported 2017-03-19 17:43:23 PDT
Teach TextIndicator to give a best guess at the background color of the Range being snapshotted, falling back to a default (e.g. the document color) if the background is an image.
Attachments
Patch (14.94 KB, patch)
2017-03-19 18:10 PDT, Wenson Hsieh
no flags
Rebased on master (14.92 KB, patch)
2017-03-20 13:49 PDT, Wenson Hsieh
andersca: review+
Wenson Hsieh
Comment 1 2017-03-19 17:44:32 PDT
Wenson Hsieh
Comment 2 2017-03-19 18:10:17 PDT
Created attachment 304909 [details] Patch `wekbit-patch upload` is failing for me; attempting to upload manually.
Wenson Hsieh
Comment 3 2017-03-20 13:49:46 PDT
Created attachment 304946 [details] Rebased on master Rebased on master
Simon Fraser (smfr)
Comment 4 2017-03-21 13:52:03 PDT
Comment on attachment 304946 [details] Rebased on master View in context: https://bugs.webkit.org/attachment.cgi?id=304946&action=review > Source/WebCore/page/TextIndicator.cpp:232 > + auto boundingRectForRange = IntRect(range.absoluteBoundingRect()); Maybe you want enclosingIntRect()? > Source/WebCore/page/TextIndicator.cpp:244 > + if (style.hasBackground() && style.backgroundColor() != Color::transparent) > + parentRendererBackgroundColors.append(style.backgroundColor()); Should this logic use visitedDependentColor to avoid leaking history state?
Wenson Hsieh
Comment 5 2017-03-21 14:02:17 PDT
Comment on attachment 304946 [details] Rebased on master View in context: https://bugs.webkit.org/attachment.cgi?id=304946&action=review >> Source/WebCore/page/TextIndicator.cpp:232 >> + auto boundingRectForRange = IntRect(range.absoluteBoundingRect()); > > Maybe you want enclosingIntRect()? Oh, yes, that's right. On closer inspection, simply flooring the values (by using the IntRect constructor) is wrong here. >> Source/WebCore/page/TextIndicator.cpp:244 >> + parentRendererBackgroundColors.append(style.backgroundColor()); > > Should this logic use visitedDependentColor to avoid leaking history state? Good catch! Fixed.
Wenson Hsieh
Comment 6 2017-03-21 15:04:57 PDT
Note You need to log in before you can comment on or make changes to this bug.