Bug 186614 - Make it possible to add a border around loading or failed-to-load images
Summary: Make it possible to add a border around loading or failed-to-load images
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tim Horton
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-06-13 18:22 PDT by Tim Horton
Modified: 2018-06-22 17:55 PDT (History)
9 users (show)

See Also:


Attachments
Patch (19.49 KB, patch)
2018-06-13 18:22 PDT, Tim Horton
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews101 for mac-sierra (805.41 KB, application/zip)
2018-06-13 18:59 PDT, EWS Watchlist
no flags Details
Archive of layout-test-results from ews116 for mac-sierra (544.25 KB, application/zip)
2018-06-13 19:35 PDT, EWS Watchlist
no flags Details
Archive of layout-test-results from ews201 for win-future (12.76 MB, application/zip)
2018-06-14 15:57 PDT, EWS Watchlist
no flags Details
Patch (20.31 KB, patch)
2018-06-21 00:01 PDT, Tim Horton
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews100 for mac-sierra (540.67 KB, application/zip)
2018-06-21 00:54 PDT, EWS Watchlist
no flags Details
Archive of layout-test-results from ews114 for mac-sierra (537.97 KB, application/zip)
2018-06-21 01:05 PDT, EWS Watchlist
no flags Details
Archive of layout-test-results from ews106 for mac-sierra-wk2 (2.83 MB, application/zip)
2018-06-21 05:14 PDT, EWS Watchlist
no flags Details
Patch (20.28 KB, patch)
2018-06-22 13:34 PDT, Tim Horton
no flags Details | Formatted Diff | Diff
Patch (23.05 KB, patch)
2018-06-22 16:24 PDT, Tim Horton
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Horton 2018-06-13 18:22:02 PDT
Make it possible to add a border around loading or failed-to-load images
Comment 1 Tim Horton 2018-06-13 18:22:48 PDT
Created attachment 342717 [details]
Patch
Comment 2 EWS Watchlist 2018-06-13 18:59:55 PDT
Comment on attachment 342717 [details]
Patch

Attachment 342717 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/8171818

Number of test failures exceeded the failure limit.
Comment 3 EWS Watchlist 2018-06-13 18:59:56 PDT
Created attachment 342718 [details]
Archive of layout-test-results from ews101 for mac-sierra

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews101  Port: mac-sierra  Platform: Mac OS X 10.12.6
Comment 4 zalan 2018-06-13 19:32:55 PDT
Comment on attachment 342717 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=342717&action=review

> Source/WebCore/rendering/RenderImage.cpp:381
> +void RenderImage::paintIncompleteImageOutline(PaintInfo& paintInfo, const LayoutPoint& paintOffset, const LayoutUnit& borderWidth)

void RenderImage::paintIncompleteImageOutline(PaintInfo& paintInfo, LayoutPoint paintOffset, LayoutUnit borderWidth)

> Source/WebCore/rendering/RenderImage.cpp:390
> +    LayoutUnit leftBorder = borderLeft();
> +    LayoutUnit topBorder = borderTop();
> +    LayoutUnit leftPad = paddingLeft();
> +    LayoutUnit topPad = paddingTop();

auto
and please don't abbrev.

> Source/WebCore/rendering/RenderImage.cpp:480
> +    LayoutUnit incompleteImageBorderWidth = LayoutUnit(2 / deviceScaleFactor);

This makes the image borders thicker. is it intentional?

> Source/WebCore/rendering/RenderImage.h:110
> +    void paintIncompleteImageOutline(PaintInfo&, const LayoutPoint&, const LayoutUnit&);

shouldn't this paint function be const?
Comment 5 EWS Watchlist 2018-06-13 19:35:30 PDT
Comment on attachment 342717 [details]
Patch

Attachment 342717 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/8171988

Number of test failures exceeded the failure limit.
Comment 6 EWS Watchlist 2018-06-13 19:35:31 PDT
Created attachment 342719 [details]
Archive of layout-test-results from ews116 for mac-sierra

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews116  Port: mac-sierra  Platform: Mac OS X 10.12.6
Comment 7 Tim Horton 2018-06-13 21:06:25 PDT
(In reply to zalan from comment #4)
> Comment on attachment 342717 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=342717&action=review
> 
> > Source/WebCore/rendering/RenderImage.cpp:381
> > +void RenderImage::paintIncompleteImageOutline(PaintInfo& paintInfo, const LayoutPoint& paintOffset, const LayoutUnit& borderWidth)
> 
> void RenderImage::paintIncompleteImageOutline(PaintInfo& paintInfo,
> LayoutPoint paintOffset, LayoutUnit borderWidth)
> 
> > Source/WebCore/rendering/RenderImage.cpp:390
> > +    LayoutUnit leftBorder = borderLeft();
> > +    LayoutUnit topBorder = borderTop();
> > +    LayoutUnit leftPad = paddingLeft();
> > +    LayoutUnit topPad = paddingTop();
> 
> auto
> and please don't abbrev.

Just moved, but fine :)

> > Source/WebCore/rendering/RenderImage.cpp:480
> > +    LayoutUnit incompleteImageBorderWidth = LayoutUnit(2 / deviceScaleFactor);
> 
> This makes the image borders thicker. is it intentional?

Technically intentional (see radar), but it /is/ kind of weird that the incomplete border is thicker than the failed-to-load border. Maybe we should change both. Or neither.

> > Source/WebCore/rendering/RenderImage.h:110
> > +    void paintIncompleteImageOutline(PaintInfo&, const LayoutPoint&, const LayoutUnit&);
> 
> shouldn't this paint function be const?

Almost certainly.
Comment 8 Tim Horton 2018-06-13 21:08:24 PDT
It sort of looks like the tests got off-by-one?
Comment 9 EWS Watchlist 2018-06-14 15:57:12 PDT
Comment on attachment 342717 [details]
Patch

Attachment 342717 [details] did not pass win-ews (win):
Output: http://webkit-queues.webkit.org/results/8185401

New failing tests:
http/tests/images/loading-image-border.html
Comment 10 EWS Watchlist 2018-06-14 15:57:23 PDT
Created attachment 342771 [details]
Archive of layout-test-results from ews201 for win-future

The attached test failures were seen while running run-webkit-tests on the win-ews.
Bot: ews201  Port: win-future  Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
Comment 11 Tim Horton 2018-06-21 00:01:08 PDT
Created attachment 343218 [details]
Patch
Comment 12 EWS Watchlist 2018-06-21 00:54:26 PDT
Comment on attachment 343218 [details]
Patch

Attachment 343218 [details] did not pass mac-ews (mac):
Output: https://webkit-queues.webkit.org/results/8274643

Number of test failures exceeded the failure limit.
Comment 13 EWS Watchlist 2018-06-21 00:54:28 PDT
Created attachment 343222 [details]
Archive of layout-test-results from ews100 for mac-sierra

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews100  Port: mac-sierra  Platform: Mac OS X 10.12.6
Comment 14 EWS Watchlist 2018-06-21 01:05:14 PDT
Comment on attachment 343218 [details]
Patch

Attachment 343218 [details] did not pass mac-debug-ews (mac):
Output: https://webkit-queues.webkit.org/results/8274630

Number of test failures exceeded the failure limit.
Comment 15 EWS Watchlist 2018-06-21 01:05:16 PDT
Created attachment 343223 [details]
Archive of layout-test-results from ews114 for mac-sierra

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews114  Port: mac-sierra  Platform: Mac OS X 10.12.6
Comment 16 EWS Watchlist 2018-06-21 05:13:58 PDT
Comment on attachment 343218 [details]
Patch

Attachment 343218 [details] did not pass mac-wk2-ews (mac-wk2):
Output: https://webkit-queues.webkit.org/results/8276262

New failing tests:
imported/w3c/web-platform-tests/streams/piping/error-propagation-forward.html
Comment 17 EWS Watchlist 2018-06-21 05:14:00 PDT
Created attachment 343237 [details]
Archive of layout-test-results from ews106 for mac-sierra-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews106  Port: mac-sierra-wk2  Platform: Mac OS X 10.12.6
Comment 18 Wenson Hsieh 2018-06-21 07:35:47 PDT
Comment on attachment 343218 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=343218&action=review

> Source/WebCore/page/Settings.yaml:755
> +  initial: false

Should we trigger a repaint here when the value changes? (Probably not that important though, since our client is only going to enable this from the get-go and not fiddle with it later.)
Comment 19 Anders Carlsson 2018-06-21 08:11:33 PDT
Comment on attachment 343218 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=343218&action=review

> Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm:1266
> +- (void)_setIncompleteImageBorderEnabled:(BOOL)incompleteImageBorderEnabled
> +{
> +    _preferences->setIncompleteImageBorderEnabled(incompleteImageBorderEnabled);
> +}
> +
> +- (BOOL)_incompleteImageBorderEnabled
> +{
> +    return _preferences->incompleteImageBorderEnabled();
> +}

Doesn't seem like this should be a preference.
Comment 20 zalan 2018-06-21 08:13:44 PDT
Comment on attachment 343218 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=343218&action=review

> Source/WebCore/rendering/RenderImage.cpp:382
> +void RenderImage::paintIncompleteImageOutline(PaintInfo& paintInfo, const LayoutPoint& paintOffset, const LayoutUnit& borderWidth) const

Apparently you missed it from my previous review.
const LayoutPoint& paintOffset -> LayoutPoint 
const LayoutUnit& borderWidth -> LayoutUnit

> Source/WebCore/rendering/RenderImage.cpp:384
> +    LayoutSize contentSize = this->contentSize();

auto
Comment 21 Tim Horton 2018-06-22 13:34:46 PDT
Created attachment 343361 [details]
Patch
Comment 22 Tim Horton 2018-06-22 16:24:41 PDT
Created attachment 343392 [details]
Patch
Comment 23 WebKit Commit Bot 2018-06-22 17:53:03 PDT
Comment on attachment 343392 [details]
Patch

Clearing flags on attachment: 343392

Committed r233115: <https://trac.webkit.org/changeset/233115>
Comment 24 WebKit Commit Bot 2018-06-22 17:53:04 PDT
All reviewed patches have been landed.  Closing bug.
Comment 25 Radar WebKit Bug Importer 2018-06-22 17:55:11 PDT
<rdar://problem/41388828>