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

Unified Diff: Source/core/css/MediaValues.cpp

Issue 252683007: Protect MediaValuesCached creation when RenderView is missing (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/MediaValues.cpp
diff --git a/Source/core/css/MediaValues.cpp b/Source/core/css/MediaValues.cpp
index 57b7d9997a55edf6fe6e28573e867e3eafbcbfc6..f2572c755627dbbc8b6b7aec427f4abb3c9bdef1 100644
--- a/Source/core/css/MediaValues.cpp
+++ b/Source/core/css/MediaValues.cpp
@@ -30,18 +30,27 @@ PassRefPtr<MediaValues> MediaValues::createDynamicIfFrameExists(LocalFrame* fram
return MediaValuesCached::create();
}
+static float getEffectiveZoom(LocalFrame* frame)
+{
+ ASSERT(frame->document());
+ RenderStyle* style = (RenderStyle*)(frame->document()->renderView());
eseidel 2014/04/25 23:53:24 Huh!? That's not a style.
+ if (!style)
+ return 1.0;
+ return style->effectiveZoom();
+}
+
int MediaValues::calculateViewportWidth(LocalFrame* frame) const
{
- ASSERT(frame && frame->view() && frame->document());
+ ASSERT(frame && frame->view());
int viewportWidth = frame->view()->layoutSize(IncludeScrollbars).width();
- return adjustForAbsoluteZoom(viewportWidth, frame->document()->renderView());
+ return adjustForAbsoluteZoom(viewportWidth, getEffectiveZoom(frame));
}
int MediaValues::calculateViewportHeight(LocalFrame* frame) const
{
- ASSERT(frame && frame->view() && frame->document());
+ ASSERT(frame && frame->view());
int viewportHeight = frame->view()->layoutSize(IncludeScrollbars).height();
- return adjustForAbsoluteZoom(viewportHeight, frame->document()->renderView());
+ return adjustForAbsoluteZoom(viewportHeight, getEffectiveZoom(frame));
}
int MediaValues::calculateDeviceWidth(LocalFrame* frame) const
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698