| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv
ed. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv
ed. |
| 7 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 7 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
| 8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 9 * Copyright (C) 2012-2013 Intel Corporation. All rights reserved. | 9 * Copyright (C) 2012-2013 Intel Corporation. All rights reserved. |
| 10 * | 10 * |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 * | 25 * |
| 26 */ | 26 */ |
| 27 | 27 |
| 28 #include "core/dom/ViewportDescription.h" | 28 #include "core/dom/ViewportDescription.h" |
| 29 | 29 |
| 30 #include "core/dom/Document.h" | 30 #include "core/dom/Document.h" |
| 31 #include "core/frame/FrameHost.h" | 31 #include "core/frame/FrameHost.h" |
| 32 #include "core/frame/FrameView.h" | 32 #include "core/frame/FrameView.h" |
| 33 #include "core/frame/LocalFrame.h" | 33 #include "core/frame/LocalFrame.h" |
| 34 #include "core/frame/Settings.h" | 34 #include "core/frame/Settings.h" |
| 35 #include "platform/Histogram.h" |
| 35 #include "platform/weborigin/KURL.h" | 36 #include "platform/weborigin/KURL.h" |
| 36 #include "public/platform/Platform.h" | 37 #include "public/platform/Platform.h" |
| 37 | 38 |
| 38 namespace blink { | 39 namespace blink { |
| 39 | 40 |
| 40 static const float& compareIgnoringAuto(const float& value1, const float& value2
, const float& (*compare) (const float&, const float&)) | 41 static const float& compareIgnoringAuto(const float& value1, const float& value2
, const float& (*compare) (const float&, const float&)) |
| 41 { | 42 { |
| 42 if (value1 == ViewportDescription::ValueAuto) | 43 if (value1 == ViewportDescription::ValueAuto) |
| 43 return value2; | 44 return value2; |
| 44 | 45 |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 if (isMetaViewportType()) { | 233 if (isMetaViewportType()) { |
| 233 if (maxWidth.type() == blink::Fixed) { | 234 if (maxWidth.type() == blink::Fixed) { |
| 234 Platform::current()->histogramEnumeration("Viewport.MetaTagType", Co
nstantWidth, TypeCount); | 235 Platform::current()->histogramEnumeration("Viewport.MetaTagType", Co
nstantWidth, TypeCount); |
| 235 | 236 |
| 236 if (mainFrame->view()) { | 237 if (mainFrame->view()) { |
| 237 // To get an idea of how "far" the viewport is from the device's
ideal width, we | 238 // To get an idea of how "far" the viewport is from the device's
ideal width, we |
| 238 // report the zoom level that we'd need to be at for the entire
page to be visible. | 239 // report the zoom level that we'd need to be at for the entire
page to be visible. |
| 239 int viewportWidth = maxWidth.intValue(); | 240 int viewportWidth = maxWidth.intValue(); |
| 240 int windowWidth = mainFrame->host()->visualViewport().size().wid
th(); | 241 int windowWidth = mainFrame->host()->visualViewport().size().wid
th(); |
| 241 int overviewZoomPercent = 100 * windowWidth / static_cast<float>
(viewportWidth); | 242 int overviewZoomPercent = 100 * windowWidth / static_cast<float>
(viewportWidth); |
| 242 Platform::current()->histogramSparse("Viewport.OverviewZoom", ov
erviewZoomPercent); | 243 DEFINE_STATIC_LOCAL(SparseHistogram, overviewZoomHistogram, ("Vi
ewport.OverviewZoom")); |
| 244 overviewZoomHistogram.sample(overviewZoomPercent); |
| 243 } | 245 } |
| 244 | 246 |
| 245 } else if (maxWidth.type() == blink::DeviceWidth || maxWidth.type() == b
link::ExtendToZoom) { | 247 } else if (maxWidth.type() == blink::DeviceWidth || maxWidth.type() == b
link::ExtendToZoom) { |
| 246 Platform::current()->histogramEnumeration("Viewport.MetaTagType", De
viceWidth, TypeCount); | 248 Platform::current()->histogramEnumeration("Viewport.MetaTagType", De
viceWidth, TypeCount); |
| 247 } else { | 249 } else { |
| 248 // Overflow bucket for cases we may be unaware of. | 250 // Overflow bucket for cases we may be unaware of. |
| 249 Platform::current()->histogramEnumeration("Viewport.MetaTagType", Me
taWidthOther, TypeCount); | 251 Platform::current()->histogramEnumeration("Viewport.MetaTagType", Me
taWidthOther, TypeCount); |
| 250 } | 252 } |
| 251 } else if (type == ViewportDescription::HandheldFriendlyMeta) { | 253 } else if (type == ViewportDescription::HandheldFriendlyMeta) { |
| 252 Platform::current()->histogramEnumeration("Viewport.MetaTagType", MetaHa
ndheldFriendly, TypeCount); | 254 Platform::current()->histogramEnumeration("Viewport.MetaTagType", MetaHa
ndheldFriendly, TypeCount); |
| 253 } else if (type == ViewportDescription::MobileOptimizedMeta) { | 255 } else if (type == ViewportDescription::MobileOptimizedMeta) { |
| 254 Platform::current()->histogramEnumeration("Viewport.MetaTagType", Mobile
OptimizedMeta, TypeCount); | 256 Platform::current()->histogramEnumeration("Viewport.MetaTagType", Mobile
OptimizedMeta, TypeCount); |
| 255 } | 257 } |
| 256 #endif | 258 #endif |
| 257 } | 259 } |
| 258 | 260 |
| 259 bool ViewportDescription::matchesHeuristicsForGpuRasterization() const | 261 bool ViewportDescription::matchesHeuristicsForGpuRasterization() const |
| 260 { | 262 { |
| 261 return maxWidth == Length(DeviceWidth) | 263 return maxWidth == Length(DeviceWidth) |
| 262 && minZoom == 1.0 | 264 && minZoom == 1.0 |
| 263 && minZoomIsExplicit; | 265 && minZoomIsExplicit; |
| 264 } | 266 } |
| 265 | 267 |
| 266 } // namespace blink | 268 } // namespace blink |
| OLD | NEW |