flutter_flutter/engine/core/css/MediaValues.h
Eric Seidel e0fd75b5ab Make absolute and sort all Sky headers
This caused us to lose our gn check certification. :(

Turns out gn check was just ignoring all the header
paths it didn't understand and so gn check passing
for sky wasn't meaning much.  I tried to straighten
out some of the mess in this CL, but its going to take
several more rounds of massaging before gn check
passes again.  On the bright side (almost) all of
our headers are absolute now.  Turns out my script
(attached to the bug) didn't notice ../ includes
but I'll fix that in the next patch.

R=abarth@chromium.org
BUG=435361

Review URL: https://codereview.chromium.org/746023002
2014-11-20 17:42:05 -08:00

86 lines
3.2 KiB
C++

// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MediaValues_h
#define MediaValues_h
#include "sky/engine/core/css/CSSPrimitiveValue.h"
#include "sky/engine/core/css/PointerProperties.h"
#include "sky/engine/wtf/RefCounted.h"
#include "sky/engine/wtf/RefPtr.h"
namespace blink {
class Document;
class CSSPrimitiveValue;
class LocalFrame;
class MediaValues : public RefCounted<MediaValues> {
public:
enum MediaValuesMode {
CachingMode,
DynamicMode
};
virtual ~MediaValues() { }
static PassRefPtr<MediaValues> createDynamicIfFrameExists(LocalFrame*);
virtual PassRefPtr<MediaValues> copy() const = 0;
virtual bool isSafeToSendToAnotherThread() const = 0;
static bool computeLengthImpl(double value, CSSPrimitiveValue::UnitType, unsigned defaultFontSize, unsigned viewportWidth, unsigned viewportHeight, double& result);
template<typename T>
static bool computeLength(double value, CSSPrimitiveValue::UnitType type, unsigned defaultFontSize, unsigned viewportWidth, unsigned viewportHeight, T& result)
{
double tempResult;
if (!computeLengthImpl(value, type, defaultFontSize, viewportWidth, viewportHeight, tempResult))
return false;
result = roundForImpreciseConversion<T>(tempResult);
return true;
}
virtual bool computeLength(double value, CSSPrimitiveValue::UnitType, int& result) const = 0;
virtual bool computeLength(double value, CSSPrimitiveValue::UnitType, double& result) const = 0;
virtual int viewportWidth() const = 0;
virtual int viewportHeight() const = 0;
virtual int deviceWidth() const = 0;
virtual int deviceHeight() const = 0;
virtual float devicePixelRatio() const = 0;
virtual int colorBitsPerComponent() const = 0;
virtual int monochromeBitsPerComponent() const = 0;
virtual PointerType primaryPointerType() const = 0;
virtual int availablePointerTypes() const = 0;
virtual HoverType primaryHoverType() const = 0;
virtual int availableHoverTypes() const = 0;
virtual bool threeDEnabled() const = 0;
virtual const String mediaType() const = 0;
virtual bool strictMode() const = 0;
virtual Document* document() const = 0;
virtual bool hasValues() const = 0;
protected:
int calculateViewportWidth(LocalFrame*) const;
int calculateViewportHeight(LocalFrame*) const;
int calculateDeviceWidth(LocalFrame*) const;
int calculateDeviceHeight(LocalFrame*) const;
bool calculateStrictMode(LocalFrame*) const;
float calculateDevicePixelRatio(LocalFrame*) const;
int calculateColorBitsPerComponent(LocalFrame*) const;
int calculateMonochromeBitsPerComponent(LocalFrame*) const;
int calculateDefaultFontSize(LocalFrame*) const;
const String calculateMediaType(LocalFrame*) const;
bool calculateThreeDEnabled(LocalFrame*) const;
PointerType calculatePrimaryPointerType(LocalFrame*) const;
int calculateAvailablePointerTypes(LocalFrame*) const;
HoverType calculatePrimaryHoverType(LocalFrame*) const;
int calculateAvailableHoverTypes(LocalFrame*) const;
static LocalFrame* frameFrom(Document&);
};
} // namespace
#endif // MediaValues_h