Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(733)

Issue 1793933002: Don't trigger a link resource fetch on media change. (Closed)

Created:
4 years, 9 months ago by rune
Modified:
4 years, 8 months ago
Reviewers:
Yoav Weiss, kochi, horo
CC:
blink-reviews, blink-reviews-html_chromium.org, chromium-reviews, dglazkov+blink, gavinp+prerender_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Don't trigger a link resource fetch on media change. Changing the media attribute called process() which would clear the current stylesheet and re-fetch it. If a stylesheet is loaded, set the media queries on that stylesheet and trigger style changes it may cause. If loading is in progress, the media queries will be set on the stylesheet when it finishes loading. Note that setting the media attribute will not change the blocking state if changed while the sheet is loading. However, we do not change the blocking state if the mq evaluation change during loading. If the blocking state needs to happen we need to do pending stylesheet changes like we do for setDisabledState. R=horo@chromium.org,tkent@chromium.org BUG=591654

Patch Set 1 #

Patch Set 2 : Fixed test and made mediaChanged() virtual #

Total comments: 3

Messages

Total messages: 21 (8 generated)
rune
ptal
4 years, 9 months ago (2016-03-13 00:07:18 UTC) #2
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1793933002/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1793933002/1
4 years, 9 months ago (2016-03-13 00:07:22 UTC) #3
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: linux_chromium_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_rel_ng/builds/195987)
4 years, 9 months ago (2016-03-13 01:05:06 UTC) #5
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1793933002/20001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1793933002/20001
4 years, 9 months ago (2016-03-13 09:46:04 UTC) #7
rune
Since we don't process() on media changes anymore, and stylesheet links are the only rel ...
4 years, 9 months ago (2016-03-13 09:49:36 UTC) #8
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 9 months ago (2016-03-13 10:53:57 UTC) #10
tkent
I don't think I'm a right reviewer of this CL. kochi@, are you a right ...
4 years, 9 months ago (2016-03-13 23:54:49 UTC) #12
kochi
The change and tests lgtm but I may not be a good reviewer for link ...
4 years, 9 months ago (2016-03-14 05:59:34 UTC) #15
Yoav Weiss
Are you seeing spurious downloads when you change other attributes on `<link rel=stylesheet>`? (seems like ...
4 years, 9 months ago (2016-03-14 15:23:51 UTC) #16
horo
Looks good to me. But I'm not familiar enough with HTMLLinkElement's behavior details. Please follow ...
4 years, 9 months ago (2016-03-15 03:25:47 UTC) #17
rune
https://codereview.chromium.org/1793933002/diff/20001/third_party/WebKit/Source/core/html/HTMLLinkElement.cpp File third_party/WebKit/Source/core/html/HTMLLinkElement.cpp (right): https://codereview.chromium.org/1793933002/diff/20001/third_party/WebKit/Source/core/html/HTMLLinkElement.cpp#newcode196 third_party/WebKit/Source/core/html/HTMLLinkElement.cpp:196: m_link->mediaChanged(); On 2016/03/14 15:23:51, Yoav Weiss wrote: > Seems ...
4 years, 8 months ago (2016-04-07 07:56:07 UTC) #18
Yoav Weiss
On 2016/04/07 07:56:07, rune wrote: > https://codereview.chromium.org/1793933002/diff/20001/third_party/WebKit/Source/core/html/HTMLLinkElement.cpp > File third_party/WebKit/Source/core/html/HTMLLinkElement.cpp (right): > > https://codereview.chromium.org/1793933002/diff/20001/third_party/WebKit/Source/core/html/HTMLLinkElement.cpp#newcode196 > ...
4 years, 8 months ago (2016-04-07 09:51:10 UTC) #19
rune
4 years, 8 months ago (2016-04-07 10:21:18 UTC) #20
On 2016/04/07 09:51:10, Yoav Weiss wrote:
> On 2016/04/07 07:56:07, rune wrote:
> >
>
https://codereview.chromium.org/1793933002/diff/20001/third_party/WebKit/Sour...
> > File third_party/WebKit/Source/core/html/HTMLLinkElement.cpp (right):
> > 
> >
>
https://codereview.chromium.org/1793933002/diff/20001/third_party/WebKit/Sour...
> > third_party/WebKit/Source/core/html/HTMLLinkElement.cpp:196:
> > m_link->mediaChanged();
> > On 2016/03/14 15:23:51, Yoav Weiss wrote:
> > > Seems to me that we would want "process()" not to trigger a second
download
> if
> > > it's not necessary rather than (or on top of) handling this `media`
specific
> > > case.
> > > 
> > > Maybe "process()" can check current URL and see if it is changed since it
> was
> > > fetched? (and perhaps special-case media changes as to trigger
mediaChanged
> > > rather than a download? Not sure it's necessary)
> > 
> > Yes, mediaChanged() is necessary to trigger a style update. Having process()
> > checking attributes without given the knowledge of what changed sounds
> > cumbersome. Instead of using the process method, we could have an
> > attributeChanged() for each of the LinkResource types. If there is no
> > LinkResources, call process(). If the rel type changed in such a way that
the
> > LinkResource type should change, dispose the old one and create a new one
with
> > process().
> > 
> > This code seems broken in so many ways and needs an overhaul. 
> 
> I agree.
> 
> > A couple of
> > issues:
> > 
> > - If we create a LinkResource for one rel-type, it cannot be changed
> afterwards
> > (works in Gecko).
> > - If we set the any of the known attributes to the same value ten times, it
> will
> > trigger ten resource loads.
> > 
> > If my media specific fix is not acceptable, I'll defer this to loading-dev
> > people for now as I need to focus elsewhere.
> > 
> 
> Fair enough. I'll take over the issue (and probably reuse your tests)

Thanks. closing.

Powered by Google App Engine
This is Rietveld 408576698