Index: Source/core/loader/FrameFetchContext.cpp |
diff --git a/Source/core/loader/FrameFetchContext.cpp b/Source/core/loader/FrameFetchContext.cpp |
index acc8dd3ba79cb3ca7b9a6f4bbbb0de60ce5a1b12..88f471704bc110d0e554f0b33b1a2b293a185e28 100644 |
--- a/Source/core/loader/FrameFetchContext.cpp |
+++ b/Source/core/loader/FrameFetchContext.cpp |
@@ -672,9 +672,11 @@ void FrameFetchContext::addClientHintsIfNecessary(FetchRequest& fetchRequest) |
if (frame()->shouldSendDPRHint()) |
fetchRequest.mutableResourceRequest().addHTTPHeaderField("DPR", AtomicString(String::number(m_document->devicePixelRatio()))); |
- // FIXME: Send the RW hint based on the actual resource width, when we have it. |
- if (frame()->shouldSendRWHint() && frame()->view()) |
- fetchRequest.mutableResourceRequest().addHTTPHeaderField("RW", AtomicString(String::number(frame()->view()->viewportWidth()))); |
+ if (frame()->shouldSendRWHint() && frame()->view()) { |
+ FetchRequest::ResourceWidth resourceWidth = fetchRequest.resourceWidth(); |
+ float usedResourceWidth = resourceWidth.isSet ? resourceWidth.width : frame()->view()->viewportWidth(); |
+ fetchRequest.mutableResourceRequest().addHTTPHeaderField("RW", AtomicString(String::number(usedResourceWidth))); |
+ } |
} |
void FrameFetchContext::addCSPHeaderIfNecessary(Resource::Type type, FetchRequest& fetchRequest) |