mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Merge m-c to inbound, a=merge
This commit is contained in:
commit
1989131fea
@ -91,19 +91,6 @@
|
||||
"description": "The $(topic:transition-types)[transition type] for this visit from its referrer."
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "HistoryTime",
|
||||
"description": "A time specified as a Date object, a number or string representing milliseconds since the epoch, or an ISO 8601 string",
|
||||
"choices": [
|
||||
{
|
||||
"type": "string",
|
||||
"pattern": "^[1-9]\\d*$"
|
||||
},
|
||||
{
|
||||
"$ref": "extensionTypes.Date"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"functions": [
|
||||
@ -122,12 +109,12 @@
|
||||
"description": "A free-text query to the history service. Leave empty to retrieve all pages."
|
||||
},
|
||||
"startTime": {
|
||||
"$ref": "HistoryTime",
|
||||
"$ref": "extensionTypes.Date",
|
||||
"optional": true,
|
||||
"description": "Limit results to those visited after this date. If not specified, this defaults to 24 hours in the past."
|
||||
},
|
||||
"endTime": {
|
||||
"$ref": "HistoryTime",
|
||||
"$ref": "extensionTypes.Date",
|
||||
"optional": true,
|
||||
"description": "Limit results to those visited before this date."
|
||||
},
|
||||
@ -210,7 +197,7 @@
|
||||
"description": "The $(topic:transition-types)[transition type] for this visit from its referrer."
|
||||
},
|
||||
"visitTime": {
|
||||
"$ref": "HistoryTime",
|
||||
"$ref": "extensionTypes.Date",
|
||||
"optional": true,
|
||||
"description": "The date when this visit occurred."
|
||||
}
|
||||
@ -259,11 +246,11 @@
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"startTime": {
|
||||
"$ref": "HistoryTime",
|
||||
"$ref": "extensionTypes.Date",
|
||||
"description": "Items added to history after this date."
|
||||
},
|
||||
"endTime": {
|
||||
"$ref": "HistoryTime",
|
||||
"$ref": "extensionTypes.Date",
|
||||
"description": "Items added to history before this date."
|
||||
}
|
||||
}
|
||||
|
@ -289,7 +289,6 @@ add_task(function* test_add_url() {
|
||||
[{}, "default"],
|
||||
[{visitTime: new Date()}, "with_date"],
|
||||
[{visitTime: Date.now()}, "with_ms_number"],
|
||||
[{visitTime: Date.now().toString()}, "with_ms_string"],
|
||||
[{visitTime: new Date().toISOString()}, "with_iso_string"],
|
||||
[{transition: "typed"}, "valid_transition"],
|
||||
];
|
||||
|
@ -6,6 +6,8 @@
|
||||
|
||||
XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini']
|
||||
|
||||
MARIONETTE_UNIT_MANIFESTS += ['tests/marionette/manifest.ini']
|
||||
|
||||
JAR_MANIFESTS += ['jar.mn']
|
||||
|
||||
XPIDL_SOURCES += [
|
||||
|
@ -167,7 +167,7 @@ static const nsAttrValue::EnumTable kMozAudioChannelAttributeTable[] = {
|
||||
{ "ringer", (int16_t)AudioChannel::Ringer },
|
||||
{ "publicnotification", (int16_t)AudioChannel::Publicnotification },
|
||||
{ "system", (int16_t)AudioChannel::System },
|
||||
{ nullptr }
|
||||
{ nullptr, 0 }
|
||||
};
|
||||
|
||||
/* static */ void
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
enum CORSMode {
|
||||
enum CORSMode : uint8_t {
|
||||
/**
|
||||
* The default of not using CORS to validate cross-origin loads.
|
||||
*/
|
||||
|
@ -22,7 +22,7 @@ class Element;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
enum Directionality {
|
||||
enum Directionality : uint8_t {
|
||||
eDir_NotSet,
|
||||
eDir_RTL,
|
||||
eDir_LTR,
|
||||
|
@ -3269,7 +3269,7 @@ static const nsAttrValue::EnumTable kCORSAttributeTable[] = {
|
||||
// See ParseCORSValue
|
||||
{ "anonymous", CORS_ANONYMOUS },
|
||||
{ "use-credentials", CORS_USE_CREDENTIALS },
|
||||
{ 0 }
|
||||
{ nullptr, 0 }
|
||||
};
|
||||
|
||||
/* static */ void
|
||||
|
@ -12,6 +12,8 @@
|
||||
#ifndef nsAttrValue_h___
|
||||
#define nsAttrValue_h___
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsStringGlue.h"
|
||||
#include "nsStringBuffer.h"
|
||||
@ -24,6 +26,7 @@
|
||||
#include "nsIAtom.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/EnumTypeTraits.h"
|
||||
|
||||
// Undefine LoadImage to prevent naming conflict with Windows.
|
||||
#undef LoadImage
|
||||
@ -261,10 +264,29 @@ public:
|
||||
* EnumTable myTable[] = {
|
||||
* { "string1", 1 },
|
||||
* { "string2", 2 },
|
||||
* { 0 }
|
||||
* { nullptr, 0 }
|
||||
* }
|
||||
*/
|
||||
struct EnumTable {
|
||||
// EnumTable can be initialized either with an int16_t value
|
||||
// or a value of an enumeration type that can fit within an int16_t.
|
||||
|
||||
constexpr EnumTable(const char* aTag, int16_t aValue)
|
||||
: tag(aTag)
|
||||
, value(aValue)
|
||||
{
|
||||
}
|
||||
|
||||
template<typename T,
|
||||
typename = typename std::enable_if<std::is_enum<T>::value>::type>
|
||||
constexpr EnumTable(const char* aTag, T aValue)
|
||||
: tag(aTag)
|
||||
, value(static_cast<int16_t>(aValue))
|
||||
{
|
||||
static_assert(mozilla::EnumTypeFitsWithin<T, int16_t>::value,
|
||||
"aValue must be an enum that fits within int16_t");
|
||||
}
|
||||
|
||||
/** The string the value maps to */
|
||||
const char* tag;
|
||||
/** The enum value that maps to this string */
|
||||
|
@ -304,7 +304,7 @@ bool nsContentUtils::sDoNotTrackEnabled = false;
|
||||
mozilla::LazyLogModule nsContentUtils::sDOMDumpLog("Dump");
|
||||
|
||||
// Subset of http://www.whatwg.org/specs/web-apps/current-work/#autofill-field-name
|
||||
enum AutocompleteFieldName
|
||||
enum AutocompleteFieldName : uint8_t
|
||||
{
|
||||
#define AUTOCOMPLETE_FIELD_NAME(name_, value_) \
|
||||
eAutocompleteFieldName_##name_,
|
||||
@ -315,7 +315,7 @@ enum AutocompleteFieldName
|
||||
#undef AUTOCOMPLETE_CONTACT_FIELD_NAME
|
||||
};
|
||||
|
||||
enum AutocompleteFieldHint
|
||||
enum AutocompleteFieldHint : uint8_t
|
||||
{
|
||||
#define AUTOCOMPLETE_FIELD_HINT(name_, value_) \
|
||||
eAutocompleteFieldHint_##name_,
|
||||
@ -323,7 +323,7 @@ enum AutocompleteFieldHint
|
||||
#undef AUTOCOMPLETE_FIELD_HINT
|
||||
};
|
||||
|
||||
enum AutocompleteFieldContactHint
|
||||
enum AutocompleteFieldContactHint : uint8_t
|
||||
{
|
||||
#define AUTOCOMPLETE_FIELD_CONTACT_HINT(name_, value_) \
|
||||
eAutocompleteFieldContactHint_##name_,
|
||||
@ -343,7 +343,7 @@ static const nsAttrValue::EnumTable kAutocompleteFieldNameTable[] = {
|
||||
{ value_, eAutocompleteFieldName_##name_ },
|
||||
#include "AutocompleteFieldList.h"
|
||||
#undef AUTOCOMPLETE_FIELD_NAME
|
||||
{ 0 }
|
||||
{ nullptr, 0 }
|
||||
};
|
||||
|
||||
static const nsAttrValue::EnumTable kAutocompleteContactFieldNameTable[] = {
|
||||
@ -351,7 +351,7 @@ static const nsAttrValue::EnumTable kAutocompleteContactFieldNameTable[] = {
|
||||
{ value_, eAutocompleteFieldName_##name_ },
|
||||
#include "AutocompleteFieldList.h"
|
||||
#undef AUTOCOMPLETE_CONTACT_FIELD_NAME
|
||||
{ 0 }
|
||||
{ nullptr, 0 }
|
||||
};
|
||||
|
||||
static const nsAttrValue::EnumTable kAutocompleteFieldHintTable[] = {
|
||||
@ -359,7 +359,7 @@ static const nsAttrValue::EnumTable kAutocompleteFieldHintTable[] = {
|
||||
{ value_, eAutocompleteFieldHint_##name_ },
|
||||
#include "AutocompleteFieldList.h"
|
||||
#undef AUTOCOMPLETE_FIELD_HINT
|
||||
{ 0 }
|
||||
{ nullptr, 0 }
|
||||
};
|
||||
|
||||
static const nsAttrValue::EnumTable kAutocompleteContactFieldHintTable[] = {
|
||||
@ -367,7 +367,7 @@ static const nsAttrValue::EnumTable kAutocompleteContactFieldHintTable[] = {
|
||||
{ value_, eAutocompleteFieldContactHint_##name_ },
|
||||
#include "AutocompleteFieldList.h"
|
||||
#undef AUTOCOMPLETE_FIELD_CONTACT_HINT
|
||||
{ 0 }
|
||||
{ nullptr, 0 }
|
||||
};
|
||||
|
||||
namespace {
|
||||
|
@ -12321,6 +12321,7 @@ class CGDictionary(CGThing):
|
||||
Maybe<JS::Rooted<JSObject *> > object;
|
||||
Maybe<JS::Rooted<JS::Value> > temp;
|
||||
if (!isNull) {
|
||||
MOZ_ASSERT(cx);
|
||||
object.emplace(cx, &val.toObject());
|
||||
temp.emplace(cx);
|
||||
}
|
||||
|
@ -30,11 +30,11 @@ HTMLBRElement::~HTMLBRElement()
|
||||
NS_IMPL_ELEMENT_CLONE(HTMLBRElement)
|
||||
|
||||
static const nsAttrValue::EnumTable kClearTable[] = {
|
||||
{ "left", NS_STYLE_CLEAR_LEFT },
|
||||
{ "right", NS_STYLE_CLEAR_RIGHT },
|
||||
{ "all", NS_STYLE_CLEAR_BOTH },
|
||||
{ "both", NS_STYLE_CLEAR_BOTH },
|
||||
{ 0 }
|
||||
{ "left", StyleClear::Left },
|
||||
{ "right", StyleClear::Right },
|
||||
{ "all", StyleClear::Both },
|
||||
{ "both", StyleClear::Both },
|
||||
{ nullptr, 0 }
|
||||
};
|
||||
|
||||
bool
|
||||
|
@ -47,7 +47,7 @@ static const nsAttrValue::EnumTable kButtonTypeTable[] = {
|
||||
{ "button", NS_FORM_BUTTON_BUTTON },
|
||||
{ "reset", NS_FORM_BUTTON_RESET },
|
||||
{ "submit", NS_FORM_BUTTON_SUBMIT },
|
||||
{ 0 }
|
||||
{ nullptr, 0 }
|
||||
};
|
||||
|
||||
// Default type is 'submit'.
|
||||
|
@ -87,7 +87,7 @@ static const uint8_t NS_FORM_AUTOCOMPLETE_OFF = 0;
|
||||
static const nsAttrValue::EnumTable kFormAutocompleteTable[] = {
|
||||
{ "on", NS_FORM_AUTOCOMPLETE_ON },
|
||||
{ "off", NS_FORM_AUTOCOMPLETE_OFF },
|
||||
{ 0 }
|
||||
{ nullptr, 0 }
|
||||
};
|
||||
// Default autocomplete value is 'on'.
|
||||
static const nsAttrValue::EnumTable* kFormDefaultAutocomplete = &kFormAutocompleteTable[0];
|
||||
|
@ -12,7 +12,7 @@
|
||||
static const nsAttrValue::EnumTable kFormMethodTable[] = {
|
||||
{ "get", NS_FORM_METHOD_GET },
|
||||
{ "post", NS_FORM_METHOD_POST },
|
||||
{ 0 }
|
||||
{ nullptr, 0 }
|
||||
};
|
||||
|
||||
// Default method is 'get'.
|
||||
@ -22,7 +22,7 @@ static const nsAttrValue::EnumTable kFormEnctypeTable[] = {
|
||||
{ "multipart/form-data", NS_FORM_ENCTYPE_MULTIPART },
|
||||
{ "application/x-www-form-urlencoded", NS_FORM_ENCTYPE_URLENCODED },
|
||||
{ "text/plain", NS_FORM_ENCTYPE_TEXTPLAIN },
|
||||
{ 0 }
|
||||
{ nullptr, 0 }
|
||||
};
|
||||
|
||||
// Default method is 'application/x-www-form-urlencoded'.
|
||||
|
@ -43,7 +43,7 @@ HTMLHRElement::ParseAttribute(int32_t aNamespaceID,
|
||||
{ "left", NS_STYLE_TEXT_ALIGN_LEFT },
|
||||
{ "right", NS_STYLE_TEXT_ALIGN_RIGHT },
|
||||
{ "center", NS_STYLE_TEXT_ALIGN_CENTER },
|
||||
{ 0 }
|
||||
{ nullptr, 0 }
|
||||
};
|
||||
|
||||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
|
@ -178,7 +178,7 @@ static const nsAttrValue::EnumTable kInputTypeTable[] = {
|
||||
{ "time", NS_FORM_INPUT_TIME },
|
||||
{ "url", NS_FORM_INPUT_URL },
|
||||
{ "week", NS_FORM_INPUT_WEEK },
|
||||
{ 0 }
|
||||
{ nullptr, 0 }
|
||||
};
|
||||
|
||||
// Default type is 'text'.
|
||||
@ -200,7 +200,7 @@ static const nsAttrValue::EnumTable kInputInputmodeTable[] = {
|
||||
{ "lowercase", NS_INPUT_INPUTMODE_LOWERCASE },
|
||||
{ "titlecase", NS_INPUT_INPUTMODE_TITLECASE },
|
||||
{ "autocapitalized", NS_INPUT_INPUTMODE_AUTOCAPITALIZED },
|
||||
{ 0 }
|
||||
{ nullptr, 0 }
|
||||
};
|
||||
|
||||
// Default inputmode value is "auto".
|
||||
|
@ -36,7 +36,7 @@ static const nsAttrValue::EnumTable kUnorderedListItemTypeTable[] = {
|
||||
{ "circle", NS_STYLE_LIST_STYLE_CIRCLE },
|
||||
{ "round", NS_STYLE_LIST_STYLE_CIRCLE },
|
||||
{ "square", NS_STYLE_LIST_STYLE_SQUARE },
|
||||
{ 0 }
|
||||
{ nullptr, 0 }
|
||||
};
|
||||
|
||||
// values that are handled case-sensitively
|
||||
@ -46,7 +46,7 @@ static const nsAttrValue::EnumTable kOrderedListItemTypeTable[] = {
|
||||
{ "I", NS_STYLE_LIST_STYLE_UPPER_ROMAN },
|
||||
{ "i", NS_STYLE_LIST_STYLE_LOWER_ROMAN },
|
||||
{ "1", NS_STYLE_LIST_STYLE_DECIMAL },
|
||||
{ 0 }
|
||||
{ nullptr, 0 }
|
||||
};
|
||||
|
||||
bool
|
||||
|
@ -47,7 +47,7 @@ HTMLLegendElement::ParseAttribute(int32_t aNamespaceID,
|
||||
{ "center", NS_STYLE_TEXT_ALIGN_CENTER },
|
||||
{ "bottom", NS_STYLE_VERTICAL_ALIGN_BOTTOM },
|
||||
{ "top", NS_STYLE_VERTICAL_ALIGN_TOP },
|
||||
{ 0 }
|
||||
{ nullptr, 0 }
|
||||
};
|
||||
|
||||
if (aAttribute == nsGkAtoms::align && aNamespaceID == kNameSpaceID_None) {
|
||||
|
@ -2544,6 +2544,8 @@ HTMLMediaElement::CaptureStreamInternal(bool aFinishWhenEnded,
|
||||
bool aCaptureAudio,
|
||||
MediaStreamGraph* aGraph)
|
||||
{
|
||||
MOZ_RELEASE_ASSERT(aGraph);
|
||||
|
||||
nsPIDOMWindowInner* window = OwnerDoc()->GetInnerWindow();
|
||||
if (!window) {
|
||||
return nullptr;
|
||||
@ -2554,13 +2556,6 @@ HTMLMediaElement::CaptureStreamInternal(bool aFinishWhenEnded,
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!aGraph) {
|
||||
MediaStreamGraph::GraphDriverType graphDriverType =
|
||||
HasAudio() ? MediaStreamGraph::AUDIO_THREAD_DRIVER
|
||||
: MediaStreamGraph::SYSTEM_THREAD_DRIVER;
|
||||
aGraph = MediaStreamGraph::GetInstance(graphDriverType, mAudioChannel);
|
||||
}
|
||||
|
||||
if (!mOutputStreams.IsEmpty() &&
|
||||
aGraph != mOutputStreams[0].mStream->GetInputStream()->Graph()) {
|
||||
return nullptr;
|
||||
@ -2655,7 +2650,10 @@ already_AddRefed<DOMMediaStream>
|
||||
HTMLMediaElement::CaptureAudio(ErrorResult& aRv,
|
||||
MediaStreamGraph* aGraph)
|
||||
{
|
||||
RefPtr<DOMMediaStream> stream = CaptureStreamInternal(false, aGraph);
|
||||
MOZ_RELEASE_ASSERT(aGraph);
|
||||
|
||||
RefPtr<DOMMediaStream> stream =
|
||||
CaptureStreamInternal(false, true, aGraph);
|
||||
if (!stream) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
@ -2665,10 +2663,16 @@ HTMLMediaElement::CaptureAudio(ErrorResult& aRv,
|
||||
}
|
||||
|
||||
already_AddRefed<DOMMediaStream>
|
||||
HTMLMediaElement::MozCaptureStream(ErrorResult& aRv,
|
||||
MediaStreamGraph* aGraph)
|
||||
HTMLMediaElement::MozCaptureStream(ErrorResult& aRv)
|
||||
{
|
||||
RefPtr<DOMMediaStream> stream = CaptureStreamInternal(false, aGraph);
|
||||
MediaStreamGraph::GraphDriverType graphDriverType =
|
||||
HasAudio() ? MediaStreamGraph::AUDIO_THREAD_DRIVER
|
||||
: MediaStreamGraph::SYSTEM_THREAD_DRIVER;
|
||||
MediaStreamGraph* graph =
|
||||
MediaStreamGraph::GetInstance(graphDriverType, mAudioChannel);
|
||||
|
||||
RefPtr<DOMMediaStream> stream =
|
||||
CaptureStreamInternal(false, false, graph);
|
||||
if (!stream) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
@ -2678,10 +2682,16 @@ HTMLMediaElement::MozCaptureStream(ErrorResult& aRv,
|
||||
}
|
||||
|
||||
already_AddRefed<DOMMediaStream>
|
||||
HTMLMediaElement::MozCaptureStreamUntilEnded(ErrorResult& aRv,
|
||||
MediaStreamGraph* aGraph)
|
||||
HTMLMediaElement::MozCaptureStreamUntilEnded(ErrorResult& aRv)
|
||||
{
|
||||
RefPtr<DOMMediaStream> stream = CaptureStreamInternal(true, aGraph);
|
||||
MediaStreamGraph::GraphDriverType graphDriverType =
|
||||
HasAudio() ? MediaStreamGraph::AUDIO_THREAD_DRIVER
|
||||
: MediaStreamGraph::SYSTEM_THREAD_DRIVER;
|
||||
MediaStreamGraph* graph =
|
||||
MediaStreamGraph::GetInstance(graphDriverType, mAudioChannel);
|
||||
|
||||
RefPtr<DOMMediaStream> stream =
|
||||
CaptureStreamInternal(true, false, graph);
|
||||
if (!stream) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
@ -3221,7 +3231,7 @@ bool HTMLMediaElement::ParseAttribute(int32_t aNamespaceID,
|
||||
{ "none", HTMLMediaElement::PRELOAD_ATTR_NONE },
|
||||
{ "metadata", HTMLMediaElement::PRELOAD_ATTR_METADATA },
|
||||
{ "auto", HTMLMediaElement::PRELOAD_ATTR_AUTO },
|
||||
{ 0 }
|
||||
{ nullptr, 0 }
|
||||
};
|
||||
|
||||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
@ -6574,7 +6584,8 @@ HTMLMediaElement::AudioCaptureStreamChangeIfNeeded()
|
||||
if (GetSrcMediaStream()) {
|
||||
mCaptureStreamPort = msg->ConnectToCaptureStream(id, GetSrcMediaStream());
|
||||
} else {
|
||||
RefPtr<DOMMediaStream> stream = CaptureStreamInternal(false, msg);
|
||||
RefPtr<DOMMediaStream> stream =
|
||||
CaptureStreamInternal(false, false, msg);
|
||||
mCaptureStreamPort = msg->ConnectToCaptureStream(id, stream->GetPlaybackStream());
|
||||
}
|
||||
} else if (!mAudioCapturedByWindow && mCaptureStreamPort) {
|
||||
|
@ -655,13 +655,11 @@ public:
|
||||
}
|
||||
|
||||
already_AddRefed<DOMMediaStream> CaptureAudio(ErrorResult& aRv,
|
||||
MediaStreamGraph* aGraph = nullptr);
|
||||
MediaStreamGraph* aGraph);
|
||||
|
||||
already_AddRefed<DOMMediaStream> MozCaptureStream(ErrorResult& aRv,
|
||||
MediaStreamGraph* aGraph = nullptr);
|
||||
already_AddRefed<DOMMediaStream> MozCaptureStream(ErrorResult& aRv);
|
||||
|
||||
already_AddRefed<DOMMediaStream> MozCaptureStreamUntilEnded(ErrorResult& aRv,
|
||||
MediaStreamGraph* aGraph = nullptr);
|
||||
already_AddRefed<DOMMediaStream> MozCaptureStreamUntilEnded(ErrorResult& aRv);
|
||||
|
||||
bool MozAudioCaptured() const
|
||||
{
|
||||
@ -897,7 +895,7 @@ protected:
|
||||
*/
|
||||
already_AddRefed<DOMMediaStream> CaptureStreamInternal(bool aFinishWhenEnded,
|
||||
bool aCaptureAudio,
|
||||
MediaStreamGraph* aGraph = nullptr);
|
||||
MediaStreamGraph* aGraph);
|
||||
|
||||
/**
|
||||
* Initialize a decoder as a clone of an existing decoder in another
|
||||
@ -1039,7 +1037,7 @@ protected:
|
||||
/**
|
||||
* Possible values of the 'preload' attribute.
|
||||
*/
|
||||
enum PreloadAttrValue {
|
||||
enum PreloadAttrValue : uint8_t {
|
||||
PRELOAD_ATTR_EMPTY, // set to ""
|
||||
PRELOAD_ATTR_NONE, // set to "none"
|
||||
PRELOAD_ATTR_METADATA, // set to "metadata"
|
||||
|
@ -22,7 +22,7 @@ NS_IMPL_NS_NEW_HTML_ELEMENT(Menu)
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
enum MenuType
|
||||
enum MenuType : uint8_t
|
||||
{
|
||||
MENU_TYPE_CONTEXT = 1,
|
||||
MENU_TYPE_TOOLBAR,
|
||||
@ -33,7 +33,7 @@ static const nsAttrValue::EnumTable kMenuTypeTable[] = {
|
||||
{ "context", MENU_TYPE_CONTEXT },
|
||||
{ "toolbar", MENU_TYPE_TOOLBAR },
|
||||
{ "list", MENU_TYPE_LIST },
|
||||
{ 0 }
|
||||
{ nullptr, 0 }
|
||||
};
|
||||
|
||||
static const nsAttrValue::EnumTable* kMenuDefaultType =
|
||||
|
@ -24,8 +24,8 @@ namespace dom {
|
||||
#define NS_MENUITEM_TYPE(bits) ((bits) & ~( \
|
||||
NS_CHECKED_IS_TOGGLED | NS_ORIGINAL_CHECKED_VALUE))
|
||||
|
||||
enum CmdType
|
||||
{
|
||||
enum CmdType : uint8_t
|
||||
{
|
||||
CMD_TYPE_MENUITEM = 1,
|
||||
CMD_TYPE_CHECKBOX,
|
||||
CMD_TYPE_RADIO
|
||||
@ -35,7 +35,7 @@ static const nsAttrValue::EnumTable kMenuItemTypeTable[] = {
|
||||
{ "menuitem", CMD_TYPE_MENUITEM },
|
||||
{ "checkbox", CMD_TYPE_CHECKBOX },
|
||||
{ "radio", CMD_TYPE_RADIO },
|
||||
{ 0 }
|
||||
{ nullptr, 0 }
|
||||
};
|
||||
|
||||
static const nsAttrValue::EnumTable* kMenuItemDefaultType =
|
||||
|
@ -55,7 +55,7 @@ nsAttrValue::EnumTable kListTypeTable[] = {
|
||||
{ "upper-roman", NS_STYLE_LIST_STYLE_UPPER_ROMAN },
|
||||
{ "lower-alpha", NS_STYLE_LIST_STYLE_LOWER_ALPHA },
|
||||
{ "upper-alpha", NS_STYLE_LIST_STYLE_UPPER_ALPHA },
|
||||
{ 0 }
|
||||
{ nullptr, 0 }
|
||||
};
|
||||
|
||||
static const nsAttrValue::EnumTable kOldListTypeTable[] = {
|
||||
@ -64,7 +64,7 @@ static const nsAttrValue::EnumTable kOldListTypeTable[] = {
|
||||
{ "a", NS_STYLE_LIST_STYLE_LOWER_ALPHA },
|
||||
{ "I", NS_STYLE_LIST_STYLE_UPPER_ROMAN },
|
||||
{ "i", NS_STYLE_LIST_STYLE_LOWER_ROMAN },
|
||||
{ 0 }
|
||||
{ nullptr, 0 }
|
||||
};
|
||||
|
||||
bool
|
||||
|
@ -32,7 +32,7 @@ static const nsAttrValue::EnumTable kCaptionAlignTable[] = {
|
||||
{ "right", NS_STYLE_CAPTION_SIDE_RIGHT },
|
||||
{ "top", NS_STYLE_CAPTION_SIDE_TOP },
|
||||
{ "bottom", NS_STYLE_CAPTION_SIDE_BOTTOM },
|
||||
{ 0 }
|
||||
{ nullptr, 0 }
|
||||
};
|
||||
|
||||
bool
|
||||
|
@ -366,7 +366,7 @@ static const nsAttrValue::EnumTable kCellScopeTable[] = {
|
||||
{ "col", NS_STYLE_CELL_SCOPE_COL },
|
||||
{ "rowgroup", NS_STYLE_CELL_SCOPE_ROWGROUP },
|
||||
{ "colgroup", NS_STYLE_CELL_SCOPE_COLGROUP },
|
||||
{ 0 }
|
||||
{ nullptr, 0 }
|
||||
};
|
||||
|
||||
void
|
||||
|
@ -67,7 +67,7 @@ static constexpr nsAttrValue::EnumTable kKindTable[] = {
|
||||
{ "descriptions", static_cast<int16_t>(TextTrackKind::Descriptions) },
|
||||
{ "chapters", static_cast<int16_t>(TextTrackKind::Chapters) },
|
||||
{ "metadata", static_cast<int16_t>(TextTrackKind::Metadata) },
|
||||
{ 0 }
|
||||
{ nullptr, 0 }
|
||||
};
|
||||
|
||||
// Invalid values are treated as "metadata" in ParseAttribute, but if no value
|
||||
|
@ -220,7 +220,7 @@ static const nsAttrValue::EnumTable kDirTable[] = {
|
||||
{ "ltr", eDir_LTR },
|
||||
{ "rtl", eDir_RTL },
|
||||
{ "auto", eDir_Auto },
|
||||
{ 0 }
|
||||
{ nullptr, 0 }
|
||||
};
|
||||
|
||||
void
|
||||
@ -1058,7 +1058,7 @@ static const nsAttrValue::EnumTable kDivAlignTable[] = {
|
||||
{ "center", NS_STYLE_TEXT_ALIGN_MOZ_CENTER },
|
||||
{ "middle", NS_STYLE_TEXT_ALIGN_MOZ_CENTER },
|
||||
{ "justify", NS_STYLE_TEXT_ALIGN_JUSTIFY },
|
||||
{ 0 }
|
||||
{ nullptr, 0 }
|
||||
};
|
||||
|
||||
static const nsAttrValue::EnumTable kFrameborderTable[] = {
|
||||
@ -1066,7 +1066,7 @@ static const nsAttrValue::EnumTable kFrameborderTable[] = {
|
||||
{ "no", NS_STYLE_FRAME_NO },
|
||||
{ "1", NS_STYLE_FRAME_1 },
|
||||
{ "0", NS_STYLE_FRAME_0 },
|
||||
{ 0 }
|
||||
{ nullptr, 0 }
|
||||
};
|
||||
|
||||
static const nsAttrValue::EnumTable kScrollingTable[] = {
|
||||
@ -1077,7 +1077,7 @@ static const nsAttrValue::EnumTable kScrollingTable[] = {
|
||||
{ "scroll", NS_STYLE_FRAME_SCROLL },
|
||||
{ "noscroll", NS_STYLE_FRAME_NOSCROLL },
|
||||
{ "auto", NS_STYLE_FRAME_AUTO },
|
||||
{ 0 }
|
||||
{ nullptr, 0 }
|
||||
};
|
||||
|
||||
static const nsAttrValue::EnumTable kTableVAlignTable[] = {
|
||||
@ -1085,7 +1085,7 @@ static const nsAttrValue::EnumTable kTableVAlignTable[] = {
|
||||
{ "middle", NS_STYLE_VERTICAL_ALIGN_MIDDLE },
|
||||
{ "bottom", NS_STYLE_VERTICAL_ALIGN_BOTTOM },
|
||||
{ "baseline",NS_STYLE_VERTICAL_ALIGN_BASELINE },
|
||||
{ 0 }
|
||||
{ nullptr, 0 }
|
||||
};
|
||||
|
||||
bool
|
||||
@ -1107,7 +1107,7 @@ nsGenericHTMLElement::ParseAlignValue(const nsAString& aString,
|
||||
{ "absmiddle", NS_STYLE_VERTICAL_ALIGN_MIDDLE },
|
||||
{ "abscenter", NS_STYLE_VERTICAL_ALIGN_MIDDLE },
|
||||
{ "absbottom", NS_STYLE_VERTICAL_ALIGN_BOTTOM },
|
||||
{ 0 }
|
||||
{ nullptr, 0 }
|
||||
};
|
||||
|
||||
return aResult.ParseEnumValue(aString, kAlignTable, false);
|
||||
@ -1121,7 +1121,7 @@ static const nsAttrValue::EnumTable kTableHAlignTable[] = {
|
||||
{ "center", NS_STYLE_TEXT_ALIGN_CENTER },
|
||||
{ "char", NS_STYLE_TEXT_ALIGN_CHAR },
|
||||
{ "justify",NS_STYLE_TEXT_ALIGN_JUSTIFY },
|
||||
{ 0 }
|
||||
{ nullptr, 0 }
|
||||
};
|
||||
|
||||
bool
|
||||
@ -1142,7 +1142,7 @@ static const nsAttrValue::EnumTable kTableCellHAlignTable[] = {
|
||||
{ "justify",NS_STYLE_TEXT_ALIGN_JUSTIFY },
|
||||
{ "middle", NS_STYLE_TEXT_ALIGN_MOZ_CENTER },
|
||||
{ "absmiddle", NS_STYLE_TEXT_ALIGN_CENTER },
|
||||
{ 0 }
|
||||
{ nullptr, 0 }
|
||||
};
|
||||
|
||||
bool
|
||||
@ -1190,12 +1190,12 @@ nsGenericHTMLElement::ParseReferrerAttribute(const nsAString& aString,
|
||||
nsAttrValue& aResult)
|
||||
{
|
||||
static const nsAttrValue::EnumTable kReferrerTable[] = {
|
||||
{ net::kRPS_No_Referrer, net::RP_No_Referrer },
|
||||
{ net::kRPS_Origin, net::RP_Origin },
|
||||
{ net::kRPS_Origin_When_Cross_Origin, net::RP_Origin_When_Crossorigin },
|
||||
{ net::kRPS_No_Referrer_When_Downgrade, net::RP_No_Referrer_When_Downgrade },
|
||||
{ net::kRPS_Unsafe_URL, net::RP_Unsafe_URL },
|
||||
{ 0 }
|
||||
{ net::kRPS_No_Referrer, static_cast<int16_t>(net::RP_No_Referrer) },
|
||||
{ net::kRPS_Origin, static_cast<int16_t>(net::RP_Origin) },
|
||||
{ net::kRPS_Origin_When_Cross_Origin, static_cast<int16_t>(net::RP_Origin_When_Crossorigin) },
|
||||
{ net::kRPS_No_Referrer_When_Downgrade, static_cast<int16_t>(net::RP_No_Referrer_When_Downgrade) },
|
||||
{ net::kRPS_Unsafe_URL, static_cast<int16_t>(net::RP_Unsafe_URL) },
|
||||
{ nullptr, 0 }
|
||||
};
|
||||
return aResult.ParseEnumValue(aString, kReferrerTable, false);
|
||||
}
|
||||
|
@ -38,14 +38,14 @@ enum FormControlsTypes {
|
||||
NS_FORM_INPUT_ELEMENT = 0x80 // 0b10000000
|
||||
};
|
||||
|
||||
enum ButtonElementTypes {
|
||||
enum ButtonElementTypes : uint8_t {
|
||||
NS_FORM_BUTTON_BUTTON = NS_FORM_BUTTON_ELEMENT + 1,
|
||||
NS_FORM_BUTTON_RESET,
|
||||
NS_FORM_BUTTON_SUBMIT,
|
||||
eButtonElementTypesMax
|
||||
};
|
||||
|
||||
enum InputElementTypes {
|
||||
enum InputElementTypes : uint8_t {
|
||||
NS_FORM_INPUT_BUTTON = NS_FORM_INPUT_ELEMENT + 1,
|
||||
NS_FORM_INPUT_CHECKBOX,
|
||||
NS_FORM_INPUT_COLOR,
|
||||
|
@ -302,8 +302,8 @@ MaybeInvalidTabContext::MaybeInvalidTabContext(const IPCTabContext& aParams)
|
||||
nsAutoCString originSuffix;
|
||||
nsAutoCString signedPkgOriginNoSuffix;
|
||||
nsAutoString presentationURL;
|
||||
UIStateChangeType showAccelerators;
|
||||
UIStateChangeType showFocusRings;
|
||||
UIStateChangeType showAccelerators = UIStateChangeType_NoChange;
|
||||
UIStateChangeType showFocusRings = UIStateChangeType_NoChange;
|
||||
|
||||
switch(aParams.type()) {
|
||||
case IPCTabContext::TPopupIPCTabContext: {
|
||||
|
@ -1006,7 +1006,7 @@ MediaRecorder::MediaRecorder(AudioNode& aSrcAudioNode,
|
||||
AudioNodeStream::Flags flags =
|
||||
AudioNodeStream::EXTERNAL_OUTPUT |
|
||||
AudioNodeStream::NEED_MAIN_THREAD_FINISHED;
|
||||
mPipeStream = AudioNodeStream::Create(ctx, engine, flags);
|
||||
mPipeStream = AudioNodeStream::Create(ctx, engine, flags, ctx->Graph());
|
||||
AudioNodeStream* ns = aSrcAudioNode.GetStream();
|
||||
if (ns) {
|
||||
mInputPort =
|
||||
|
@ -149,7 +149,7 @@ public:
|
||||
|
||||
NS_ENSURE_TRUE_VOID(ok);
|
||||
|
||||
if (size > 0) {
|
||||
if (size > 0 && durationUs.value() > 0) {
|
||||
RefPtr<layers::Image> img =
|
||||
new SurfaceTextureImage(mDecoder->mSurfaceTexture.get(), mDecoder->mConfig.mDisplay,
|
||||
gl::OriginPos::BottomLeft);
|
||||
@ -171,7 +171,6 @@ public:
|
||||
|
||||
if ((flags & MediaCodec::BUFFER_FLAG_END_OF_STREAM) != 0) {
|
||||
mDecoderCallback->DrainComplete();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -223,6 +222,15 @@ public:
|
||||
return RemoteDataDecoder::Flush();
|
||||
}
|
||||
|
||||
nsresult Drain() override
|
||||
{
|
||||
nsresult res = RemoteDataDecoder::Drain();
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
|
||||
mInputDurations.Put(0);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult Input(MediaRawData* aSample) override
|
||||
{
|
||||
nsresult res = RemoteDataDecoder::Input(aSample);
|
||||
@ -440,7 +448,7 @@ RemoteDataDecoder::Drain()
|
||||
bufferInfo->Set(0, 0, -1, MediaCodec::BUFFER_FLAG_END_OF_STREAM);
|
||||
|
||||
mJavaDecoder->Input(nullptr, bufferInfo);
|
||||
return NS_ERROR_FAILURE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -91,6 +91,7 @@ WMFVideoMFTManager::WMFVideoMFTManager(
|
||||
, mNullOutputCount(0)
|
||||
, mGotValidOutputAfterNullOutput(false)
|
||||
, mGotExcessiveNullOutput(false)
|
||||
, mIsValid(true)
|
||||
// mVideoStride, mVideoWidth, mVideoHeight, mUseHwAccel are initialized in
|
||||
// Init().
|
||||
{
|
||||
@ -370,9 +371,33 @@ WMFVideoMFTManager::InitializeDXVA(bool aForceD3D9)
|
||||
return mDXVA2Manager != nullptr;
|
||||
}
|
||||
|
||||
bool
|
||||
WMFVideoMFTManager::ValidateVideoInfo()
|
||||
{
|
||||
// The WMF H.264 decoder is documented to have a minimum resolution
|
||||
// 48x48 pixels. We've observed the decoder working for output smaller than
|
||||
// that, but on some output it hangs in IMFTransform::ProcessOutput(), so
|
||||
// we just reject streams which are less than the documented minimum.
|
||||
// https://msdn.microsoft.com/en-us/library/windows/desktop/dd797815(v=vs.85).aspx
|
||||
static const int32_t MIN_H264_FRAME_DIMENSION = 48;
|
||||
if (mStreamType == H264 &&
|
||||
(mVideoInfo.mImage.width < MIN_H264_FRAME_DIMENSION ||
|
||||
mVideoInfo.mImage.height < MIN_H264_FRAME_DIMENSION)) {
|
||||
LogToBrowserConsole(NS_LITERAL_STRING(
|
||||
"Can't decode H.264 stream with width or height less than 48 pixels."));
|
||||
mIsValid = false;
|
||||
}
|
||||
|
||||
return mIsValid;
|
||||
}
|
||||
|
||||
bool
|
||||
WMFVideoMFTManager::Init()
|
||||
{
|
||||
if (!ValidateVideoInfo()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool success = InitInternal(/* aForceD3D9 = */ false);
|
||||
|
||||
if (success && mDXVA2Manager) {
|
||||
@ -484,6 +509,10 @@ WMFVideoMFTManager::SetDecoderMediaTypes()
|
||||
HRESULT
|
||||
WMFVideoMFTManager::Input(MediaRawData* aSample)
|
||||
{
|
||||
if (!mIsValid) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (!mDecoder) {
|
||||
// This can happen during shutdown.
|
||||
return E_FAIL;
|
||||
@ -906,6 +935,7 @@ WMFVideoMFTManager::ConfigurationChanged(const TrackInfo& aConfig)
|
||||
MOZ_ASSERT(aConfig.GetAsVideoInfo());
|
||||
mVideoInfo = *aConfig.GetAsVideoInfo();
|
||||
mImageSize = mVideoInfo.mImage;
|
||||
ValidateVideoInfo();
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -51,6 +51,8 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
bool ValidateVideoInfo();
|
||||
|
||||
bool InitializeDXVA(bool aForceD3D9);
|
||||
|
||||
bool InitInternal(bool aForceD3D9);
|
||||
@ -101,6 +103,7 @@ private:
|
||||
uint32_t mNullOutputCount;
|
||||
bool mGotValidOutputAfterNullOutput;
|
||||
bool mGotExcessiveNullOutput;
|
||||
bool mIsValid;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -533,6 +533,20 @@ var gErrorTests = [
|
||||
{ name:"bogus.duh", type:"bogus/duh" }
|
||||
];
|
||||
|
||||
function IsWindowsVistaOrLater() {
|
||||
var re = /Windows NT (\d+.\d)/;
|
||||
var winver = manifestNavigator().userAgent.match(re);
|
||||
return winver && winver.length == 2 && parseFloat(winver[1]) >= 6.0;
|
||||
}
|
||||
|
||||
// Windows' H.264 decoder cannot handle H.264 streams with resolution
|
||||
// less than 48x48 pixels. We refuse to play and error on such streams.
|
||||
if (IsWindowsVistaOrLater() &&
|
||||
manifestVideo().canPlayType('video/mp4; codecs="avc1.42E01E"')) {
|
||||
gErrorTests = gErrorTests.concat({name: "red-46x48.mp4", type:"video/mp4"},
|
||||
{name: "red-48x46.mp4", type:"video/mp4"});
|
||||
}
|
||||
|
||||
// These are files that have nontrivial duration and are useful for seeking within.
|
||||
var gSeekTests = [
|
||||
{ name:"r11025_s16_c1.wav", type:"audio/x-wav", duration:1.0 },
|
||||
@ -562,12 +576,6 @@ var gFastSeekTests = [
|
||||
{ name:"bug516323.indexed.ogv", type:"video/ogg", keyframes:[0, 0.46, 3.06] },
|
||||
];
|
||||
|
||||
function IsWindows8OrLater() {
|
||||
var re = /Windows NT (\d.\d)/;
|
||||
var winver = manifestNavigator().userAgent.match(re);
|
||||
return winver && winver.length == 2 && parseFloat(winver[1]) >= 6.2;
|
||||
}
|
||||
|
||||
// These files are WebMs without cues. They're seekable within their buffered
|
||||
// ranges. If work renders WebMs fully seekable these files should be moved
|
||||
// into gSeekTests
|
||||
|
@ -491,6 +491,10 @@ support-files =
|
||||
r16000_u8_c1_list.wav
|
||||
r16000_u8_c1_list.wav^headers^
|
||||
reactivate_helper.html
|
||||
red-46x48.mp4
|
||||
red-46x48.mp4^headers^
|
||||
red-48x46.mp4
|
||||
red-48x46.mp4^headers^
|
||||
redirect.sjs
|
||||
referer.sjs
|
||||
region.vtt
|
||||
|
BIN
dom/media/test/red-46x48.mp4
Normal file
BIN
dom/media/test/red-46x48.mp4
Normal file
Binary file not shown.
1
dom/media/test/red-46x48.mp4^headers^
Normal file
1
dom/media/test/red-46x48.mp4^headers^
Normal file
@ -0,0 +1 @@
|
||||
Cache-Control: no-store
|
BIN
dom/media/test/red-48x46.mp4
Normal file
BIN
dom/media/test/red-48x46.mp4
Normal file
Binary file not shown.
1
dom/media/test/red-48x46.mp4^headers^
Normal file
1
dom/media/test/red-48x46.mp4^headers^
Normal file
@ -0,0 +1 @@
|
||||
Cache-Control: no-store
|
@ -113,7 +113,8 @@ AnalyserNode::AnalyserNode(AudioContext* aContext)
|
||||
{
|
||||
mStream = AudioNodeStream::Create(aContext,
|
||||
new AnalyserNodeEngine(this),
|
||||
AudioNodeStream::NO_STREAM_FLAGS);
|
||||
AudioNodeStream::NO_STREAM_FLAGS,
|
||||
aContext->Graph());
|
||||
|
||||
// Enough chunks must be recorded to handle the case of fftSize being
|
||||
// increased to maximum immediately before getFloatTimeDomainData() is
|
||||
|
@ -602,7 +602,8 @@ AudioBufferSourceNode::AudioBufferSourceNode(AudioContext* aContext)
|
||||
{
|
||||
AudioBufferSourceNodeEngine* engine = new AudioBufferSourceNodeEngine(this, aContext->Destination());
|
||||
mStream = AudioNodeStream::Create(aContext, engine,
|
||||
AudioNodeStream::NEED_MAIN_THREAD_FINISHED);
|
||||
AudioNodeStream::NEED_MAIN_THREAD_FINISHED,
|
||||
aContext->Graph());
|
||||
engine->SetSourceStream(mStream);
|
||||
mStream->AddMainThreadListener(this);
|
||||
}
|
||||
|
@ -71,20 +71,20 @@ AudioNodeStream::Create(AudioContext* aCtx, AudioNodeEngine* aEngine,
|
||||
Flags aFlags, MediaStreamGraph* aGraph)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_RELEASE_ASSERT(aGraph);
|
||||
|
||||
// MediaRecorders use an AudioNodeStream, but no AudioNode
|
||||
AudioNode* node = aEngine->NodeMainThread();
|
||||
MediaStreamGraph* graph = aGraph ? aGraph : aCtx->Graph();
|
||||
|
||||
RefPtr<AudioNodeStream> stream =
|
||||
new AudioNodeStream(aEngine, aFlags, graph->GraphRate());
|
||||
new AudioNodeStream(aEngine, aFlags, aGraph->GraphRate());
|
||||
stream->mSuspendedCount += aCtx->ShouldSuspendNewStream();
|
||||
if (node) {
|
||||
stream->SetChannelMixingParametersImpl(node->ChannelCount(),
|
||||
node->ChannelCountModeValue(),
|
||||
node->ChannelInterpretationValue());
|
||||
}
|
||||
graph->AddStream(stream);
|
||||
aGraph->AddStream(stream);
|
||||
return stream.forget();
|
||||
}
|
||||
|
||||
|
@ -62,13 +62,12 @@ public:
|
||||
/**
|
||||
* Create a stream that will process audio for an AudioNode.
|
||||
* Takes ownership of aEngine.
|
||||
* If aGraph is non-null, use that as the MediaStreamGraph, otherwise use
|
||||
* aCtx's graph. aGraph is only non-null when called for AudioDestinationNode
|
||||
* since the context's graph hasn't been set up in that case.
|
||||
* aGraph is required and equals the graph of aCtx in most cases. An exception
|
||||
* is AudioDestinationNode where the context's graph hasn't been set up yet.
|
||||
*/
|
||||
static already_AddRefed<AudioNodeStream>
|
||||
Create(AudioContext* aCtx, AudioNodeEngine* aEngine, Flags aKind,
|
||||
MediaStreamGraph* aGraph = nullptr);
|
||||
MediaStreamGraph* aGraph);
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
@ -91,7 +91,8 @@ AudioParam::Stream()
|
||||
AudioNodeEngine* engine = new AudioNodeEngine(nullptr);
|
||||
RefPtr<AudioNodeStream> stream =
|
||||
AudioNodeStream::Create(mNode->Context(), engine,
|
||||
AudioNodeStream::NO_STREAM_FLAGS);
|
||||
AudioNodeStream::NO_STREAM_FLAGS,
|
||||
mNode->Context()->Graph());
|
||||
|
||||
// Force the input to have only one channel, and make it down-mix using
|
||||
// the speaker rules if needed.
|
||||
|
@ -259,7 +259,8 @@ BiquadFilterNode::BiquadFilterNode(AudioContext* aContext)
|
||||
uint64_t windowID = aContext->GetParentObject()->WindowID();
|
||||
BiquadFilterNodeEngine* engine = new BiquadFilterNodeEngine(this, aContext->Destination(), windowID);
|
||||
mStream = AudioNodeStream::Create(aContext, engine,
|
||||
AudioNodeStream::NO_STREAM_FLAGS);
|
||||
AudioNodeStream::NO_STREAM_FLAGS,
|
||||
aContext->Graph());
|
||||
}
|
||||
|
||||
BiquadFilterNode::~BiquadFilterNode()
|
||||
|
@ -71,7 +71,8 @@ ChannelMergerNode::ChannelMergerNode(AudioContext* aContext,
|
||||
{
|
||||
mStream = AudioNodeStream::Create(aContext,
|
||||
new ChannelMergerNodeEngine(this),
|
||||
AudioNodeStream::NO_STREAM_FLAGS);
|
||||
AudioNodeStream::NO_STREAM_FLAGS,
|
||||
aContext->Graph());
|
||||
}
|
||||
|
||||
ChannelMergerNode::~ChannelMergerNode()
|
||||
|
@ -62,7 +62,8 @@ ChannelSplitterNode::ChannelSplitterNode(AudioContext* aContext,
|
||||
{
|
||||
mStream = AudioNodeStream::Create(aContext,
|
||||
new ChannelSplitterNodeEngine(this),
|
||||
AudioNodeStream::NO_STREAM_FLAGS);
|
||||
AudioNodeStream::NO_STREAM_FLAGS,
|
||||
aContext->Graph());
|
||||
}
|
||||
|
||||
ChannelSplitterNode::~ChannelSplitterNode()
|
||||
|
@ -200,7 +200,8 @@ ConvolverNode::ConvolverNode(AudioContext* aContext)
|
||||
{
|
||||
ConvolverNodeEngine* engine = new ConvolverNodeEngine(this, mNormalize);
|
||||
mStream = AudioNodeStream::Create(aContext, engine,
|
||||
AudioNodeStream::NO_STREAM_FLAGS);
|
||||
AudioNodeStream::NO_STREAM_FLAGS,
|
||||
aContext->Graph());
|
||||
}
|
||||
|
||||
ConvolverNode::~ConvolverNode()
|
||||
|
@ -202,7 +202,8 @@ DelayNode::DelayNode(AudioContext* aContext, double aMaxDelay)
|
||||
new DelayNodeEngine(this, aContext->Destination(),
|
||||
aContext->SampleRate() * aMaxDelay);
|
||||
mStream = AudioNodeStream::Create(aContext, engine,
|
||||
AudioNodeStream::NO_STREAM_FLAGS);
|
||||
AudioNodeStream::NO_STREAM_FLAGS,
|
||||
aContext->Graph());
|
||||
}
|
||||
|
||||
DelayNode::~DelayNode()
|
||||
|
@ -201,7 +201,8 @@ DynamicsCompressorNode::DynamicsCompressorNode(AudioContext* aContext)
|
||||
{
|
||||
DynamicsCompressorNodeEngine* engine = new DynamicsCompressorNodeEngine(this, aContext->Destination());
|
||||
mStream = AudioNodeStream::Create(aContext, engine,
|
||||
AudioNodeStream::NO_STREAM_FLAGS);
|
||||
AudioNodeStream::NO_STREAM_FLAGS,
|
||||
aContext->Graph());
|
||||
}
|
||||
|
||||
DynamicsCompressorNode::~DynamicsCompressorNode()
|
||||
|
@ -124,7 +124,8 @@ GainNode::GainNode(AudioContext* aContext)
|
||||
{
|
||||
GainNodeEngine* engine = new GainNodeEngine(this, aContext->Destination());
|
||||
mStream = AudioNodeStream::Create(aContext, engine,
|
||||
AudioNodeStream::NO_STREAM_FLAGS);
|
||||
AudioNodeStream::NO_STREAM_FLAGS,
|
||||
aContext->Graph());
|
||||
}
|
||||
|
||||
GainNode::~GainNode()
|
||||
|
@ -164,7 +164,8 @@ IIRFilterNode::IIRFilterNode(AudioContext* aContext,
|
||||
uint64_t windowID = aContext->GetParentObject()->WindowID();
|
||||
IIRFilterNodeEngine* engine = new IIRFilterNodeEngine(this, aContext->Destination(), mFeedforward, mFeedback, windowID);
|
||||
mStream = AudioNodeStream::Create(aContext, engine,
|
||||
AudioNodeStream::NO_STREAM_FLAGS);
|
||||
AudioNodeStream::NO_STREAM_FLAGS,
|
||||
aContext->Graph());
|
||||
}
|
||||
|
||||
IIRFilterNode::~IIRFilterNode()
|
||||
|
@ -49,7 +49,8 @@ MediaStreamAudioDestinationNode::MediaStreamAudioDestinationNode(AudioContext* a
|
||||
MOZ_ASSERT(!!outputStream);
|
||||
AudioNodeEngine* engine = new AudioNodeEngine(this);
|
||||
mStream = AudioNodeStream::Create(aContext, engine,
|
||||
AudioNodeStream::EXTERNAL_OUTPUT);
|
||||
AudioNodeStream::EXTERNAL_OUTPUT,
|
||||
aContext->Graph());
|
||||
mPort = outputStream->AllocateInputPort(mStream, AudioNodeStream::AUDIO_TRACK);
|
||||
}
|
||||
|
||||
|
@ -420,7 +420,8 @@ OscillatorNode::OscillatorNode(AudioContext* aContext)
|
||||
{
|
||||
OscillatorNodeEngine* engine = new OscillatorNodeEngine(this, aContext->Destination());
|
||||
mStream = AudioNodeStream::Create(aContext, engine,
|
||||
AudioNodeStream::NEED_MAIN_THREAD_FINISHED);
|
||||
AudioNodeStream::NEED_MAIN_THREAD_FINISHED,
|
||||
aContext->Graph());
|
||||
engine->SetSourceStream(mStream);
|
||||
mStream->AddMainThreadListener(this);
|
||||
}
|
||||
|
@ -315,7 +315,8 @@ PannerNode::PannerNode(AudioContext* aContext)
|
||||
{
|
||||
mStream = AudioNodeStream::Create(aContext,
|
||||
new PannerNodeEngine(this, aContext->Destination()),
|
||||
AudioNodeStream::NO_STREAM_FLAGS);
|
||||
AudioNodeStream::NO_STREAM_FLAGS,
|
||||
aContext->Graph());
|
||||
// We should register once we have set up our stream and engine.
|
||||
Context()->Listener()->RegisterPannerNode(this);
|
||||
}
|
||||
|
@ -504,7 +504,8 @@ ScriptProcessorNode::ScriptProcessorNode(AudioContext* aContext,
|
||||
BufferSize(),
|
||||
aNumberOfInputChannels);
|
||||
mStream = AudioNodeStream::Create(aContext, engine,
|
||||
AudioNodeStream::NO_STREAM_FLAGS);
|
||||
AudioNodeStream::NO_STREAM_FLAGS,
|
||||
aContext->Graph());
|
||||
}
|
||||
|
||||
ScriptProcessorNode::~ScriptProcessorNode()
|
||||
|
@ -179,7 +179,8 @@ StereoPannerNode::StereoPannerNode(AudioContext* aContext)
|
||||
{
|
||||
StereoPannerNodeEngine* engine = new StereoPannerNodeEngine(this, aContext->Destination());
|
||||
mStream = AudioNodeStream::Create(aContext, engine,
|
||||
AudioNodeStream::NO_STREAM_FLAGS);
|
||||
AudioNodeStream::NO_STREAM_FLAGS,
|
||||
aContext->Graph());
|
||||
}
|
||||
|
||||
StereoPannerNode::~StereoPannerNode()
|
||||
|
@ -322,7 +322,8 @@ WaveShaperNode::WaveShaperNode(AudioContext* aContext)
|
||||
|
||||
WaveShaperNodeEngine* engine = new WaveShaperNodeEngine(this);
|
||||
mStream = AudioNodeStream::Create(aContext, engine,
|
||||
AudioNodeStream::NO_STREAM_FLAGS);
|
||||
AudioNodeStream::NO_STREAM_FLAGS,
|
||||
aContext->Graph());
|
||||
}
|
||||
|
||||
WaveShaperNode::~WaveShaperNode()
|
||||
|
@ -191,63 +191,6 @@ nsCSPParser::atEndOfPath()
|
||||
return (atEnd() || peek(QUESTIONMARK) || peek(NUMBER_SIGN));
|
||||
}
|
||||
|
||||
void
|
||||
nsCSPParser::percentDecodeStr(const nsAString& aEncStr, nsAString& outDecStr)
|
||||
{
|
||||
outDecStr.Truncate();
|
||||
|
||||
// helper function that should not be visible outside this methods scope
|
||||
struct local {
|
||||
static inline char16_t convertHexDig(char16_t aHexDig) {
|
||||
if (isNumberToken(aHexDig)) {
|
||||
return aHexDig - '0';
|
||||
}
|
||||
if (aHexDig >= 'A' && aHexDig <= 'F') {
|
||||
return aHexDig - 'A' + 10;
|
||||
}
|
||||
// must be a lower case character
|
||||
// (aHexDig >= 'a' && aHexDig <= 'f')
|
||||
return aHexDig - 'a' + 10;
|
||||
}
|
||||
};
|
||||
|
||||
const char16_t *cur, *end, *hexDig1, *hexDig2;
|
||||
cur = aEncStr.BeginReading();
|
||||
end = aEncStr.EndReading();
|
||||
|
||||
while (cur != end) {
|
||||
// if it's not a percent sign then there is
|
||||
// nothing to do for that character
|
||||
if (*cur != PERCENT_SIGN) {
|
||||
outDecStr.Append(*cur);
|
||||
cur++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// get the two hexDigs following the '%'-sign
|
||||
hexDig1 = cur + 1;
|
||||
hexDig2 = cur + 2;
|
||||
|
||||
// if there are no hexdigs after the '%' then
|
||||
// there is nothing to do for us.
|
||||
if (hexDig1 == end || hexDig2 == end ||
|
||||
!isValidHexDig(*hexDig1) ||
|
||||
!isValidHexDig(*hexDig2)) {
|
||||
outDecStr.Append(PERCENT_SIGN);
|
||||
cur++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// decode "% hexDig1 hexDig2" into a character.
|
||||
char16_t decChar = (local::convertHexDig(*hexDig1) << 4) +
|
||||
local::convertHexDig(*hexDig2);
|
||||
outDecStr.Append(decChar);
|
||||
|
||||
// increment 'cur' to after the second hexDig
|
||||
cur = ++hexDig2;
|
||||
}
|
||||
}
|
||||
|
||||
// unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
|
||||
bool
|
||||
nsCSPParser::atValidUnreservedChar()
|
||||
@ -398,7 +341,7 @@ nsCSPParser::subPath(nsCSPHostSrc* aCspHost)
|
||||
// before appendig any additional portion of a subpath we have to pct-decode
|
||||
// that portion of the subpath. atValidPathChar() already verified a correct
|
||||
// pct-encoding, now we can safely decode and append the decoded-sub path.
|
||||
percentDecodeStr(mCurValue, pctDecodedSubPath);
|
||||
CSP_PercentDecodeStr(mCurValue, pctDecodedSubPath);
|
||||
aCspHost->appendPath(pctDecodedSubPath);
|
||||
// Resetting current value since we are appending parts of the path
|
||||
// to aCspHost, e.g; "http://www.example.com/path1/path2" then the
|
||||
@ -427,7 +370,7 @@ nsCSPParser::subPath(nsCSPHostSrc* aCspHost)
|
||||
// before appendig any additional portion of a subpath we have to pct-decode
|
||||
// that portion of the subpath. atValidPathChar() already verified a correct
|
||||
// pct-encoding, now we can safely decode and append the decoded-sub path.
|
||||
percentDecodeStr(mCurValue, pctDecodedSubPath);
|
||||
CSP_PercentDecodeStr(mCurValue, pctDecodedSubPath);
|
||||
aCspHost->appendPath(pctDecodedSubPath);
|
||||
resetCurValue();
|
||||
return true;
|
||||
|
@ -144,8 +144,6 @@ class nsCSPParser {
|
||||
bool atValidSubDelimChar(); // helper function to parse sub-delims
|
||||
bool atValidPctEncodedChar(); // helper function to parse pct-encoded
|
||||
bool subPath(nsCSPHostSrc* aCspHost); // helper function to parse paths
|
||||
void percentDecodeStr(const nsAString& aEncStr, // helper function to percent-decode
|
||||
nsAString& outDecStr);
|
||||
|
||||
inline bool atEnd()
|
||||
{
|
||||
|
@ -30,6 +30,63 @@ GetCspUtilsLog()
|
||||
#define CSPUTILSLOG(args) MOZ_LOG(GetCspUtilsLog(), mozilla::LogLevel::Debug, args)
|
||||
#define CSPUTILSLOGENABLED() MOZ_LOG_TEST(GetCspUtilsLog(), mozilla::LogLevel::Debug)
|
||||
|
||||
void
|
||||
CSP_PercentDecodeStr(const nsAString& aEncStr, nsAString& outDecStr)
|
||||
{
|
||||
outDecStr.Truncate();
|
||||
|
||||
// helper function that should not be visible outside this methods scope
|
||||
struct local {
|
||||
static inline char16_t convertHexDig(char16_t aHexDig) {
|
||||
if (isNumberToken(aHexDig)) {
|
||||
return aHexDig - '0';
|
||||
}
|
||||
if (aHexDig >= 'A' && aHexDig <= 'F') {
|
||||
return aHexDig - 'A' + 10;
|
||||
}
|
||||
// must be a lower case character
|
||||
// (aHexDig >= 'a' && aHexDig <= 'f')
|
||||
return aHexDig - 'a' + 10;
|
||||
}
|
||||
};
|
||||
|
||||
const char16_t *cur, *end, *hexDig1, *hexDig2;
|
||||
cur = aEncStr.BeginReading();
|
||||
end = aEncStr.EndReading();
|
||||
|
||||
while (cur != end) {
|
||||
// if it's not a percent sign then there is
|
||||
// nothing to do for that character
|
||||
if (*cur != PERCENT_SIGN) {
|
||||
outDecStr.Append(*cur);
|
||||
cur++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// get the two hexDigs following the '%'-sign
|
||||
hexDig1 = cur + 1;
|
||||
hexDig2 = cur + 2;
|
||||
|
||||
// if there are no hexdigs after the '%' then
|
||||
// there is nothing to do for us.
|
||||
if (hexDig1 == end || hexDig2 == end ||
|
||||
!isValidHexDig(*hexDig1) ||
|
||||
!isValidHexDig(*hexDig2)) {
|
||||
outDecStr.Append(PERCENT_SIGN);
|
||||
cur++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// decode "% hexDig1 hexDig2" into a character.
|
||||
char16_t decChar = (local::convertHexDig(*hexDig1) << 4) +
|
||||
local::convertHexDig(*hexDig2);
|
||||
outDecStr.Append(decChar);
|
||||
|
||||
// increment 'cur' to after the second hexDig
|
||||
cur = ++hexDig2;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CSP_GetLocalizedStr(const char16_t* aName,
|
||||
const char16_t** aParams,
|
||||
@ -567,6 +624,9 @@ nsCSPHostSrc::permits(nsIURI* aUri, const nsAString& aNonce, bool aWasRedirected
|
||||
nsresult rv = aUri->GetHost(uriHost);
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
|
||||
nsString decodedUriHost;
|
||||
CSP_PercentDecodeStr(NS_ConvertUTF8toUTF16(uriHost), decodedUriHost);
|
||||
|
||||
// 4.5) host matching: Check if the allowed host starts with a wilcard.
|
||||
if (mHost.First() == '*') {
|
||||
NS_ASSERTION(mHost[1] == '.', "Second character needs to be '.' whenever host starts with '*'");
|
||||
@ -575,12 +635,12 @@ nsCSPHostSrc::permits(nsIURI* aUri, const nsAString& aNonce, bool aWasRedirected
|
||||
// if the remaining characters match
|
||||
nsString wildCardHost = mHost;
|
||||
wildCardHost = Substring(wildCardHost, 1, wildCardHost.Length() - 1);
|
||||
if (!StringEndsWith(NS_ConvertUTF8toUTF16(uriHost), wildCardHost)) {
|
||||
if (!StringEndsWith(decodedUriHost, wildCardHost)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// 4.6) host matching: Check if hosts match.
|
||||
else if (!mHost.Equals(NS_ConvertUTF8toUTF16(uriHost))) {
|
||||
else if (!mHost.Equals(decodedUriHost)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -604,18 +664,22 @@ nsCSPHostSrc::permits(nsIURI* aUri, const nsAString& aNonce, bool aWasRedirected
|
||||
nsAutoCString uriPath;
|
||||
rv = url->GetFilePath(uriPath);
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
|
||||
nsString decodedUriPath;
|
||||
CSP_PercentDecodeStr(NS_ConvertUTF8toUTF16(uriPath), decodedUriPath);
|
||||
|
||||
// check if the last character of mPath is '/'; if so
|
||||
// we just have to check loading resource is within
|
||||
// the allowed path.
|
||||
if (mPath.Last() == '/') {
|
||||
if (!StringBeginsWith(NS_ConvertUTF8toUTF16(uriPath), mPath)) {
|
||||
if (!StringBeginsWith(decodedUriPath, mPath)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// otherwise mPath whitelists a specific file, and we have to
|
||||
// check if the loading resource matches that whitelisted file.
|
||||
else {
|
||||
if (!mPath.Equals(NS_ConvertUTF8toUTF16(uriPath))) {
|
||||
if (!mPath.Equals(decodedUriPath)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -193,6 +193,8 @@ CSPDirective CSP_ContentTypeToDirective(nsContentPolicyType aType);
|
||||
|
||||
class nsCSPSrcVisitor;
|
||||
|
||||
void CSP_PercentDecodeStr(const nsAString& aEncStr, nsAString& outDecStr);
|
||||
|
||||
/* =============== nsCSPSrc ================== */
|
||||
|
||||
class nsCSPBaseSrc {
|
||||
|
7
dom/security/test/csp/file_bug1229639.html
Normal file
7
dom/security/test/csp/file_bug1229639.html
Normal file
@ -0,0 +1,7 @@
|
||||
<html>
|
||||
<head> <meta charset="utf-8"> </head>
|
||||
<body>
|
||||
<!-- this should be allowed -->
|
||||
<script src="http://mochi.test:8888/tests/dom/security/test/csp/%24.js"> </script>
|
||||
</body>
|
||||
</html>
|
1
dom/security/test/csp/file_bug1229639.html^headers^
Normal file
1
dom/security/test/csp/file_bug1229639.html^headers^
Normal file
@ -0,0 +1 @@
|
||||
Content-Security-Policy: "default-src 'self'; script-src http://mochi.test:8888/tests/dom/security/test/csp/%24.js
|
@ -81,6 +81,8 @@ support-files =
|
||||
file_bug909029_star.html^headers^
|
||||
file_bug909029_none.html
|
||||
file_bug909029_none.html^headers^
|
||||
file_bug1229639.html
|
||||
file_bug1229639.html^headers^
|
||||
file_policyuri_regression_from_multipolicy.html
|
||||
file_policyuri_regression_from_multipolicy.html^headers^
|
||||
file_policyuri_regression_from_multipolicy_policy
|
||||
@ -208,6 +210,7 @@ skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug)) || toolkit == 'and
|
||||
[test_redirects.html]
|
||||
[test_bug910139.html]
|
||||
[test_bug909029.html]
|
||||
[test_bug1229639.html]
|
||||
[test_policyuri_regression_from_multipolicy.html]
|
||||
[test_nonce_source.html]
|
||||
[test_bug941404.html]
|
||||
|
51
dom/security/test/csp/test_bug1229639.html
Normal file
51
dom/security/test/csp/test_bug1229639.html
Normal file
@ -0,0 +1,51 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Bug 1229639 - Percent encoded CSP path matching.</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
|
||||
<iframe style="width:200px;height:200px;" id='cspframe'></iframe>
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
// This is used to watch the blocked data bounce off CSP and allowed data
|
||||
// get sent out to the wire.
|
||||
function examiner() {
|
||||
SpecialPowers.addObserver(this, "csp-on-violate-policy", false);
|
||||
SpecialPowers.addObserver(this, "specialpowers-http-notify-request", false);
|
||||
}
|
||||
|
||||
examiner.prototype = {
|
||||
observe: function(subject, topic, data) {
|
||||
if (data === 'http://mochi.test:8888/tests/dom/security/test/csp/%24.js') {
|
||||
is(topic, "specialpowers-http-notify-request");
|
||||
this.remove();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
},
|
||||
|
||||
// must eventually call this to remove the listener,
|
||||
// or mochitests might get borked.
|
||||
remove: function() {
|
||||
SpecialPowers.removeObserver(this, "csp-on-violate-policy");
|
||||
SpecialPowers.removeObserver(this, "specialpowers-http-notify-request");
|
||||
}
|
||||
}
|
||||
|
||||
window.examiner = new examiner();
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
// save this for last so that our listeners are registered.
|
||||
// ... this loads the testbed of good and bad requests.
|
||||
document.getElementById('cspframe').src = 'file_bug1229639.html';
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -271,7 +271,7 @@ protected:
|
||||
typedef FallibleTArray<nsSMILValue> nsSMILValueArray;
|
||||
|
||||
// Types
|
||||
enum nsSMILCalcMode
|
||||
enum nsSMILCalcMode : uint8_t
|
||||
{
|
||||
CALC_LINEAR,
|
||||
CALC_DISCRETE,
|
||||
|
@ -578,7 +578,7 @@ protected:
|
||||
nsSMILTimeValue mMin;
|
||||
nsSMILTimeValue mMax;
|
||||
|
||||
enum nsSMILFillMode
|
||||
enum nsSMILFillMode : uint8_t
|
||||
{
|
||||
FILL_REMOVE,
|
||||
FILL_FREEZE
|
||||
@ -586,7 +586,7 @@ protected:
|
||||
nsSMILFillMode mFillMode;
|
||||
static nsAttrValue::EnumTable sFillModeTable[];
|
||||
|
||||
enum nsSMILRestartMode
|
||||
enum nsSMILRestartMode : uint8_t
|
||||
{
|
||||
RESTART_ALWAYS,
|
||||
RESTART_WHENNOTACTIVE,
|
||||
|
@ -737,6 +737,7 @@ nsXBLPrototypeHandler::ConstructPrototype(nsIContent* aKeyElement,
|
||||
|
||||
if (aKeyElement) {
|
||||
mType |= NS_HANDLER_TYPE_XUL;
|
||||
MOZ_ASSERT(!mPrototypeBinding);
|
||||
nsCOMPtr<nsIWeakReference> weak = do_GetWeakReference(aKeyElement);
|
||||
if (!weak) {
|
||||
return;
|
||||
@ -836,12 +837,14 @@ nsXBLPrototypeHandler::ConstructPrototype(nsIContent* aKeyElement,
|
||||
mMisc = 1;
|
||||
mDetail = key[0];
|
||||
const uint8_t GTK2Modifiers = cShift | cControl | cShiftMask | cControlMask;
|
||||
if ((mKeyMask & GTK2Modifiers) == GTK2Modifiers &&
|
||||
if ((mType & NS_HANDLER_TYPE_XUL) &&
|
||||
(mKeyMask & GTK2Modifiers) == GTK2Modifiers &&
|
||||
modifiers.First() != char16_t(',') &&
|
||||
(mDetail == 'u' || mDetail == 'U'))
|
||||
ReportKeyConflict(key.get(), modifiers.get(), aKeyElement, "GTK2Conflict2");
|
||||
const uint8_t WinModifiers = cControl | cAlt | cControlMask | cAltMask;
|
||||
if ((mKeyMask & WinModifiers) == WinModifiers &&
|
||||
if ((mType & NS_HANDLER_TYPE_XUL) &&
|
||||
(mKeyMask & WinModifiers) == WinModifiers &&
|
||||
modifiers.First() != char16_t(',') &&
|
||||
(('A' <= mDetail && mDetail <= 'Z') ||
|
||||
('a' <= mDetail && mDetail <= 'z')))
|
||||
@ -885,7 +888,7 @@ nsXBLPrototypeHandler::ReportKeyConflict(const char16_t* aKey, const char16_t* a
|
||||
if (docInfo) {
|
||||
doc = docInfo->GetDocument();
|
||||
}
|
||||
} else if (aKeyElement) {
|
||||
} else {
|
||||
doc = aKeyElement->OwnerDoc();
|
||||
}
|
||||
|
||||
|
@ -204,6 +204,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
||||
BROWSER_CHROME_MANIFESTS += ['tests/browser.ini']
|
||||
MARIONETTE_LAYOUT_MANIFESTS += ['tests/marionette/manifest.ini']
|
||||
MOCHITEST_MANIFESTS += ['tests/mochitest.ini']
|
||||
MOCHITEST_CHROME_MANIFESTS += ['tests/chrome/chrome.ini']
|
||||
|
||||
|
@ -3050,31 +3050,34 @@ nsLayoutUtils::TranslateViewToWidget(nsPresContext* aPresContext,
|
||||
}
|
||||
|
||||
// Combine aNewBreakType with aOrigBreakType, but limit the break types
|
||||
// to NS_STYLE_CLEAR_LEFT, RIGHT, BOTH.
|
||||
uint8_t
|
||||
nsLayoutUtils::CombineBreakType(uint8_t aOrigBreakType,
|
||||
uint8_t aNewBreakType)
|
||||
// to StyleClear::Left, Right, Both.
|
||||
StyleClear
|
||||
nsLayoutUtils::CombineBreakType(StyleClear aOrigBreakType,
|
||||
StyleClear aNewBreakType)
|
||||
{
|
||||
uint8_t breakType = aOrigBreakType;
|
||||
StyleClear breakType = aOrigBreakType;
|
||||
switch(breakType) {
|
||||
case NS_STYLE_CLEAR_LEFT:
|
||||
if (NS_STYLE_CLEAR_RIGHT == aNewBreakType ||
|
||||
NS_STYLE_CLEAR_BOTH == aNewBreakType) {
|
||||
breakType = NS_STYLE_CLEAR_BOTH;
|
||||
}
|
||||
break;
|
||||
case NS_STYLE_CLEAR_RIGHT:
|
||||
if (NS_STYLE_CLEAR_LEFT == aNewBreakType ||
|
||||
NS_STYLE_CLEAR_BOTH == aNewBreakType) {
|
||||
breakType = NS_STYLE_CLEAR_BOTH;
|
||||
}
|
||||
break;
|
||||
case NS_STYLE_CLEAR_NONE:
|
||||
if (NS_STYLE_CLEAR_LEFT == aNewBreakType ||
|
||||
NS_STYLE_CLEAR_RIGHT == aNewBreakType ||
|
||||
NS_STYLE_CLEAR_BOTH == aNewBreakType) {
|
||||
breakType = aNewBreakType;
|
||||
}
|
||||
case StyleClear::Left:
|
||||
if (StyleClear::Right == aNewBreakType ||
|
||||
StyleClear::Both == aNewBreakType) {
|
||||
breakType = StyleClear::Both;
|
||||
}
|
||||
break;
|
||||
case StyleClear::Right:
|
||||
if (StyleClear::Left == aNewBreakType ||
|
||||
StyleClear::Both == aNewBreakType) {
|
||||
breakType = StyleClear::Both;
|
||||
}
|
||||
break;
|
||||
case StyleClear::None_:
|
||||
if (StyleClear::Left == aNewBreakType ||
|
||||
StyleClear::Right == aNewBreakType ||
|
||||
StyleClear::Both == aNewBreakType) {
|
||||
breakType = aNewBreakType;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return breakType;
|
||||
}
|
||||
|
@ -694,8 +694,9 @@ public:
|
||||
static nsIFrame* GetFloatFromPlaceholder(nsIFrame* aPlaceholder);
|
||||
|
||||
// Combine aNewBreakType with aOrigBreakType, but limit the break types
|
||||
// to NS_STYLE_CLEAR_LEFT, RIGHT, LEFT_AND_RIGHT.
|
||||
static uint8_t CombineBreakType(uint8_t aOrigBreakType, uint8_t aNewBreakType);
|
||||
// to StyleClear::Left, Right, Both.
|
||||
static mozilla::StyleClear CombineBreakType(mozilla::StyleClear aOrigBreakType,
|
||||
mozilla::StyleClear aNewBreakType);
|
||||
|
||||
/**
|
||||
* Get the coordinates of a given DOM mouse event, relative to a given
|
||||
|
@ -44,7 +44,7 @@ BlockReflowInput::BlockReflowInput(const ReflowInput& aReflowInput,
|
||||
mBorderPadding(mReflowInput.ComputedLogicalBorderPadding()),
|
||||
mPrevBEndMargin(),
|
||||
mLineNumber(0),
|
||||
mFloatBreakType(NS_STYLE_CLEAR_NONE),
|
||||
mFloatBreakType(StyleClear::None_),
|
||||
mConsumedBSize(aConsumedBSize)
|
||||
{
|
||||
if (!sFloatFragmentsInsideColumnPrefCached) {
|
||||
@ -732,7 +732,7 @@ BlockReflowInput::FlowAndPlaceFloat(nsIFrame* aFloat)
|
||||
// See if the float should clear any preceding floats...
|
||||
// XXX We need to mark this float somehow so that it gets reflowed
|
||||
// when floats are inserted before it.
|
||||
if (NS_STYLE_CLEAR_NONE != floatDisplay->mBreakType) {
|
||||
if (StyleClear::None_ != floatDisplay->mBreakType) {
|
||||
// XXXldb Does this handle vertical margins correctly?
|
||||
mBCoord = ClearFloats(mBCoord, floatDisplay->PhysicalBreakType(wm));
|
||||
}
|
||||
@ -1080,7 +1080,7 @@ BlockReflowInput::PlaceBelowCurrentLineFloats(nsFloatCacheFreeList& aList,
|
||||
}
|
||||
|
||||
nscoord
|
||||
BlockReflowInput::ClearFloats(nscoord aBCoord, uint8_t aBreakType,
|
||||
BlockReflowInput::ClearFloats(nscoord aBCoord, StyleClear aBreakType,
|
||||
nsIFrame *aReplacedBlock,
|
||||
uint32_t aFlags)
|
||||
{
|
||||
@ -1092,8 +1092,8 @@ BlockReflowInput::ClearFloats(nscoord aBCoord, uint8_t aBreakType,
|
||||
#endif
|
||||
|
||||
#ifdef NOISY_FLOAT_CLEARING
|
||||
printf("BlockReflowInput::ClearFloats: aBCoord=%d breakType=%d\n",
|
||||
aBCoord, aBreakType);
|
||||
printf("BlockReflowInput::ClearFloats: aBCoord=%d breakType=%s\n",
|
||||
aBCoord, nsLineBox::BreakTypeToString(aBreakType));
|
||||
mFloatManager->List(stdout);
|
||||
#endif
|
||||
|
||||
@ -1103,7 +1103,7 @@ BlockReflowInput::ClearFloats(nscoord aBCoord, uint8_t aBreakType,
|
||||
|
||||
nscoord newBCoord = aBCoord;
|
||||
|
||||
if (aBreakType != NS_STYLE_CLEAR_NONE) {
|
||||
if (aBreakType != StyleClear::None_) {
|
||||
newBCoord = mFloatManager->ClearFloats(newBCoord, aBreakType, aFlags);
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ public:
|
||||
// Returns the first coordinate >= aBCoord that clears the
|
||||
// floats indicated by aBreakType and has enough inline size between floats
|
||||
// (or no floats remaining) to accomodate aReplacedBlock.
|
||||
nscoord ClearFloats(nscoord aBCoord, uint8_t aBreakType,
|
||||
nscoord ClearFloats(nscoord aBCoord, mozilla::StyleClear aBreakType,
|
||||
nsIFrame *aReplacedBlock = nullptr,
|
||||
uint32_t aFlags = 0);
|
||||
|
||||
@ -371,7 +371,7 @@ public:
|
||||
|
||||
Flags mFlags;
|
||||
|
||||
uint8_t mFloatBreakType;
|
||||
StyleClear mFloatBreakType;
|
||||
|
||||
// The amount of computed block-direction size "consumed" by previous-in-flows.
|
||||
nscoord mConsumedBSize;
|
||||
|
@ -2014,14 +2014,15 @@ nsStyleDisplay::PhysicalFloats(mozilla::WritingMode aWM) const
|
||||
return mFloat;
|
||||
}
|
||||
|
||||
inline uint8_t
|
||||
inline mozilla::StyleClear
|
||||
nsStyleDisplay::PhysicalBreakType(mozilla::WritingMode aWM) const
|
||||
{
|
||||
if (mBreakType == NS_STYLE_CLEAR_INLINE_START) {
|
||||
return aWM.IsBidiLTR() ? NS_STYLE_CLEAR_LEFT : NS_STYLE_CLEAR_RIGHT;
|
||||
using StyleClear = mozilla::StyleClear;
|
||||
if (mBreakType == StyleClear::InlineStart) {
|
||||
return aWM.IsBidiLTR() ? StyleClear::Left : StyleClear::Right;
|
||||
}
|
||||
if (mBreakType == NS_STYLE_CLEAR_INLINE_END) {
|
||||
return aWM.IsBidiLTR() ? NS_STYLE_CLEAR_RIGHT : NS_STYLE_CLEAR_LEFT;
|
||||
if (mBreakType == StyleClear::InlineEnd) {
|
||||
return aWM.IsBidiLTR() ? StyleClear::Right : StyleClear::Left;
|
||||
}
|
||||
return mBreakType;
|
||||
}
|
||||
|
@ -144,9 +144,9 @@ BRFrame::Reflow(nsPresContext* aPresContext,
|
||||
}
|
||||
|
||||
// Return our reflow status
|
||||
uint32_t breakType = aReflowInput.mStyleDisplay->PhysicalBreakType(wm);
|
||||
if (NS_STYLE_CLEAR_NONE == breakType) {
|
||||
breakType = NS_STYLE_CLEAR_LINE;
|
||||
StyleClear breakType = aReflowInput.mStyleDisplay->PhysicalBreakType(wm);
|
||||
if (StyleClear::None_ == breakType) {
|
||||
breakType = StyleClear::Line;
|
||||
}
|
||||
|
||||
aStatus = NS_INLINE_BREAK | NS_INLINE_BREAK_AFTER |
|
||||
|
@ -1549,7 +1549,7 @@ nsBlockFrame::ComputeFinalSize(const ReflowInput& aReflowInput,
|
||||
// Include the float manager's state to properly account for the
|
||||
// block-end margin of any floated elements; e.g., inside a table cell.
|
||||
nscoord floatHeight =
|
||||
aState.ClearFloats(blockEndEdgeOfChildren, NS_STYLE_CLEAR_BOTH,
|
||||
aState.ClearFloats(blockEndEdgeOfChildren, StyleClear::Both,
|
||||
nullptr, nsFloatManager::DONT_CLEAR_PUSHED_FLOATS);
|
||||
blockEndEdgeOfChildren = std::max(blockEndEdgeOfChildren, floatHeight);
|
||||
}
|
||||
@ -1919,14 +1919,15 @@ nsBlockFrame::PrepareResizeReflow(BlockReflowInput& aState)
|
||||
#ifdef DEBUG
|
||||
if (gNoisyReflow && !line->IsDirty()) {
|
||||
IndentBy(stdout, gNoiseIndent + 1);
|
||||
printf("skipped: line=%p next=%p %s %s%s%s breakTypeBefore/After=%d/%d xmost=%d\n",
|
||||
printf("skipped: line=%p next=%p %s %s%s%s breakTypeBefore/After=%s/%s xmost=%d\n",
|
||||
static_cast<void*>(line.get()),
|
||||
static_cast<void*>((line.next() != end_lines() ? line.next().get() : nullptr)),
|
||||
line->IsBlock() ? "block" : "inline",
|
||||
line->HasBreakAfter() ? "has-break-after " : "",
|
||||
line->HasFloats() ? "has-floats " : "",
|
||||
line->IsImpactedByFloat() ? "impacted " : "",
|
||||
line->GetBreakTypeBefore(), line->GetBreakTypeAfter(),
|
||||
line->BreakTypeToString(line->GetBreakTypeBefore()),
|
||||
line->BreakTypeToString(line->GetBreakTypeAfter()),
|
||||
line->IEnd());
|
||||
}
|
||||
#endif
|
||||
@ -2029,7 +2030,7 @@ nsBlockFrame::PropagateFloatDamage(BlockReflowInput& aState,
|
||||
|
||||
static bool LineHasClear(nsLineBox* aLine) {
|
||||
return aLine->IsBlock()
|
||||
? (aLine->GetBreakTypeBefore() ||
|
||||
? (aLine->GetBreakTypeBefore() != StyleClear::None_ ||
|
||||
(aLine->mFirstChild->GetStateBits() & NS_BLOCK_HAS_CLEAR_CHILDREN) ||
|
||||
!nsBlockFrame::BlockCanIntersectFloats(aLine->mFirstChild))
|
||||
: aLine->HasFloatBreakAfter();
|
||||
@ -2080,7 +2081,7 @@ nsBlockFrame::ReflowDirtyLines(BlockReflowInput& aState)
|
||||
{
|
||||
bool keepGoing = true;
|
||||
bool repositionViews = false; // should we really need this?
|
||||
bool foundAnyClears = aState.mFloatBreakType != NS_STYLE_CLEAR_NONE;
|
||||
bool foundAnyClears = aState.mFloatBreakType != StyleClear::None_;
|
||||
bool willReflowAgain = false;
|
||||
|
||||
#ifdef DEBUG
|
||||
@ -2121,7 +2122,7 @@ nsBlockFrame::ReflowDirtyLines(BlockReflowInput& aState)
|
||||
(mFloats.FirstChild()->GetStateBits() & NS_FRAME_IS_PUSHED_FLOAT);
|
||||
bool lastLineMovedUp = false;
|
||||
// We save up information about BR-clearance here
|
||||
uint8_t inlineFloatBreakType = aState.mFloatBreakType;
|
||||
StyleClear inlineFloatBreakType = aState.mFloatBreakType;
|
||||
|
||||
line_iterator line = begin_lines(), line_end = end_lines();
|
||||
|
||||
@ -2152,12 +2153,12 @@ nsBlockFrame::ReflowDirtyLines(BlockReflowInput& aState)
|
||||
// We have to reflow the line if it's a block whose clearance
|
||||
// might have changed, so detect that.
|
||||
if (!line->IsDirty() &&
|
||||
(line->GetBreakTypeBefore() != NS_STYLE_CLEAR_NONE ||
|
||||
(line->GetBreakTypeBefore() != StyleClear::None_ ||
|
||||
replacedBlock)) {
|
||||
nscoord curBCoord = aState.mBCoord;
|
||||
// See where we would be after applying any clearance due to
|
||||
// BRs.
|
||||
if (inlineFloatBreakType != NS_STYLE_CLEAR_NONE) {
|
||||
if (inlineFloatBreakType != StyleClear::None_) {
|
||||
curBCoord = aState.ClearFloats(curBCoord, inlineFloatBreakType);
|
||||
}
|
||||
|
||||
@ -2183,14 +2184,14 @@ nsBlockFrame::ReflowDirtyLines(BlockReflowInput& aState)
|
||||
}
|
||||
|
||||
// We might have to reflow a line that is after a clearing BR.
|
||||
if (inlineFloatBreakType != NS_STYLE_CLEAR_NONE) {
|
||||
if (inlineFloatBreakType != StyleClear::None_) {
|
||||
aState.mBCoord = aState.ClearFloats(aState.mBCoord, inlineFloatBreakType);
|
||||
if (aState.mBCoord != line->BStart() + deltaBCoord) {
|
||||
// SlideLine is not going to put the line where the clearance
|
||||
// put it. Reflow the line to be sure.
|
||||
line->MarkDirty();
|
||||
}
|
||||
inlineFloatBreakType = NS_STYLE_CLEAR_NONE;
|
||||
inlineFloatBreakType = StyleClear::None_;
|
||||
}
|
||||
|
||||
bool previousMarginWasDirty = line->IsPreviousMarginDirty();
|
||||
@ -2443,7 +2444,7 @@ nsBlockFrame::ReflowDirtyLines(BlockReflowInput& aState)
|
||||
}
|
||||
|
||||
// Handle BR-clearance from the last line of the block
|
||||
if (inlineFloatBreakType != NS_STYLE_CLEAR_NONE) {
|
||||
if (inlineFloatBreakType != StyleClear::None_) {
|
||||
aState.mBCoord = aState.ClearFloats(aState.mBCoord, inlineFloatBreakType);
|
||||
}
|
||||
|
||||
@ -3126,12 +3127,12 @@ nsBlockFrame::ReflowBlockFrame(BlockReflowInput& aState,
|
||||
// Prepare the block reflow engine
|
||||
nsBlockReflowContext brc(aState.mPresContext, aState.mReflowInput);
|
||||
|
||||
uint8_t breakType = frame->StyleDisplay()->
|
||||
StyleClear breakType = frame->StyleDisplay()->
|
||||
PhysicalBreakType(aState.mReflowInput.GetWritingMode());
|
||||
if (NS_STYLE_CLEAR_NONE != aState.mFloatBreakType) {
|
||||
if (StyleClear::None_ != aState.mFloatBreakType) {
|
||||
breakType = nsLayoutUtils::CombineBreakType(breakType,
|
||||
aState.mFloatBreakType);
|
||||
aState.mFloatBreakType = NS_STYLE_CLEAR_NONE;
|
||||
aState.mFloatBreakType = StyleClear::None_;
|
||||
}
|
||||
|
||||
// Clear past floats before the block if the clear style is not none
|
||||
@ -3154,7 +3155,7 @@ nsBlockFrame::ReflowBlockFrame(BlockReflowInput& aState,
|
||||
}
|
||||
bool treatWithClearance = aLine->HasClearance();
|
||||
|
||||
bool mightClearFloats = breakType != NS_STYLE_CLEAR_NONE;
|
||||
bool mightClearFloats = breakType != StyleClear::None_;
|
||||
nsIFrame *replacedBlock = nullptr;
|
||||
if (!nsBlockFrame::BlockCanIntersectFloats(frame)) {
|
||||
mightClearFloats = true;
|
||||
@ -3433,7 +3434,7 @@ nsBlockFrame::ReflowBlockFrame(BlockReflowInput& aState,
|
||||
}
|
||||
// ClearFloats might be able to advance us further once we're there.
|
||||
aState.mBCoord =
|
||||
aState.ClearFloats(newBCoord, NS_STYLE_CLEAR_NONE, replacedBlock);
|
||||
aState.ClearFloats(newBCoord, StyleClear::None_, replacedBlock);
|
||||
// Start over with a new available space rect at the new height.
|
||||
floatAvailableSpace =
|
||||
aState.GetFloatAvailableSpaceWithState(aState.mBCoord,
|
||||
@ -4054,7 +4055,7 @@ nsBlockFrame::DoReflowInlineFrames(BlockReflowInput& aState,
|
||||
* The line reflow status is simple: true means keep placing frames
|
||||
* on the line; false means don't (the line is done). If the line
|
||||
* has some sort of breaking affect then aLine's break-type will be set
|
||||
* to something other than NS_STYLE_CLEAR_NONE.
|
||||
* to something other than StyleClear::None_.
|
||||
*/
|
||||
void
|
||||
nsBlockFrame::ReflowInlineFrame(BlockReflowInput& aState,
|
||||
@ -4111,18 +4112,17 @@ nsBlockFrame::ReflowInlineFrame(BlockReflowInput& aState,
|
||||
// break-after-not-complete. There are two situations: we are a
|
||||
// block or we are an inline. This makes a total of 10 cases
|
||||
// (fortunately, there is some overlap).
|
||||
aLine->SetBreakTypeAfter(NS_STYLE_CLEAR_NONE);
|
||||
if (NS_INLINE_IS_BREAK(frameReflowStatus) ||
|
||||
(NS_STYLE_CLEAR_NONE != aState.mFloatBreakType)) {
|
||||
aLine->SetBreakTypeAfter(StyleClear::None_);
|
||||
if (NS_INLINE_IS_BREAK(frameReflowStatus) ||
|
||||
StyleClear::None_ != aState.mFloatBreakType) {
|
||||
// Always abort the line reflow (because a line break is the
|
||||
// minimal amount of break we do).
|
||||
*aLineReflowStatus = LINE_REFLOW_STOP;
|
||||
|
||||
// XXX what should aLine's break-type be set to in all these cases?
|
||||
uint8_t breakType = NS_INLINE_GET_BREAK_TYPE(frameReflowStatus);
|
||||
NS_ASSERTION((NS_STYLE_CLEAR_NONE != breakType) ||
|
||||
(NS_STYLE_CLEAR_NONE != aState.mFloatBreakType), "bad break type");
|
||||
NS_ASSERTION(NS_STYLE_CLEAR_MAX >= breakType, "invalid break type");
|
||||
StyleClear breakType = NS_INLINE_GET_BREAK_TYPE(frameReflowStatus);
|
||||
MOZ_ASSERT(StyleClear::None_ != breakType ||
|
||||
StyleClear::None_ != aState.mFloatBreakType, "bad break type");
|
||||
|
||||
if (NS_INLINE_IS_BREAK_BEFORE(frameReflowStatus)) {
|
||||
// Break-before cases.
|
||||
@ -4147,18 +4147,18 @@ nsBlockFrame::ReflowInlineFrame(BlockReflowInput& aState,
|
||||
}
|
||||
}
|
||||
else {
|
||||
// If a float split and its prev-in-flow was followed by a <BR>, then combine
|
||||
// the <BR>'s break type with the inline's break type (the inline will be the very
|
||||
// If a float split and its prev-in-flow was followed by a <BR>, then combine
|
||||
// the <BR>'s break type with the inline's break type (the inline will be the very
|
||||
// next frame after the split float).
|
||||
if (NS_STYLE_CLEAR_NONE != aState.mFloatBreakType) {
|
||||
if (StyleClear::None_ != aState.mFloatBreakType) {
|
||||
breakType = nsLayoutUtils::CombineBreakType(breakType,
|
||||
aState.mFloatBreakType);
|
||||
aState.mFloatBreakType = NS_STYLE_CLEAR_NONE;
|
||||
aState.mFloatBreakType = StyleClear::None_;
|
||||
}
|
||||
// Break-after cases
|
||||
if (breakType == NS_STYLE_CLEAR_LINE) {
|
||||
if (breakType == StyleClear::Line) {
|
||||
if (!aLineLayout.GetLineEndsInBR()) {
|
||||
breakType = NS_STYLE_CLEAR_NONE;
|
||||
breakType = StyleClear::None_;
|
||||
}
|
||||
}
|
||||
aLine->SetBreakTypeAfter(breakType);
|
||||
@ -6226,7 +6226,7 @@ nsBlockFrame::ReflowFloat(BlockReflowInput& aState,
|
||||
#endif
|
||||
}
|
||||
|
||||
uint8_t
|
||||
StyleClear
|
||||
nsBlockFrame::FindTrailingClear()
|
||||
{
|
||||
// find the break type of the last line
|
||||
@ -6238,7 +6238,7 @@ nsBlockFrame::FindTrailingClear()
|
||||
return endLine->GetBreakTypeAfter();
|
||||
}
|
||||
}
|
||||
return NS_STYLE_CLEAR_NONE;
|
||||
return StyleClear::None_;
|
||||
}
|
||||
|
||||
void
|
||||
@ -6307,7 +6307,7 @@ nsBlockFrame::ReflowPushedFloats(BlockReflowInput& aState,
|
||||
}
|
||||
|
||||
// If there are continued floats, then we may need to continue BR clearance
|
||||
if (0 != aState.ClearFloats(0, NS_STYLE_CLEAR_BOTH)) {
|
||||
if (0 != aState.ClearFloats(0, StyleClear::Both)) {
|
||||
nsBlockFrame* prevBlock = static_cast<nsBlockFrame*>(GetPrevInFlow());
|
||||
if (prevBlock) {
|
||||
aState.mFloatBreakType = prevBlock->FindTrailingClear();
|
||||
|
@ -576,7 +576,7 @@ protected:
|
||||
|
||||
/** Find any trailing BR clear from the last line of the block (or its PIFs)
|
||||
*/
|
||||
uint8_t FindTrailingClear();
|
||||
mozilla::StyleClear FindTrailingClear();
|
||||
|
||||
/**
|
||||
* Remove a float from our float list.
|
||||
|
@ -168,7 +168,7 @@ nsBlockReflowContext::ComputeCollapsedBStartMargin(const ReflowInput& aRI,
|
||||
availSpace);
|
||||
// Record that we're being optimistic by assuming the kid
|
||||
// has no clearance
|
||||
if (kid->StyleDisplay()->mBreakType != NS_STYLE_CLEAR_NONE ||
|
||||
if (kid->StyleDisplay()->mBreakType != StyleClear::None_ ||
|
||||
!nsBlockFrame::BlockCanIntersectFloats(kid)) {
|
||||
*aMayNeedRetry = true;
|
||||
}
|
||||
|
@ -478,7 +478,7 @@ nsFloatManager::List(FILE* out) const
|
||||
#endif
|
||||
|
||||
nscoord
|
||||
nsFloatManager::ClearFloats(nscoord aBCoord, uint8_t aBreakType,
|
||||
nsFloatManager::ClearFloats(nscoord aBCoord, StyleClear aBreakType,
|
||||
uint32_t aFlags) const
|
||||
{
|
||||
if (!(aFlags & DONT_CLEAR_PUSHED_FLOATS) && ClearContinues(aBreakType)) {
|
||||
@ -492,14 +492,14 @@ nsFloatManager::ClearFloats(nscoord aBCoord, uint8_t aBreakType,
|
||||
|
||||
const FloatInfo &tail = mFloats[mFloats.Length() - 1];
|
||||
switch (aBreakType) {
|
||||
case NS_STYLE_CLEAR_BOTH:
|
||||
case StyleClear::Both:
|
||||
blockEnd = std::max(blockEnd, tail.mLeftBEnd);
|
||||
blockEnd = std::max(blockEnd, tail.mRightBEnd);
|
||||
break;
|
||||
case NS_STYLE_CLEAR_LEFT:
|
||||
case StyleClear::Left:
|
||||
blockEnd = std::max(blockEnd, tail.mLeftBEnd);
|
||||
break;
|
||||
case NS_STYLE_CLEAR_RIGHT:
|
||||
case StyleClear::Right:
|
||||
blockEnd = std::max(blockEnd, tail.mRightBEnd);
|
||||
break;
|
||||
default:
|
||||
@ -513,14 +513,14 @@ nsFloatManager::ClearFloats(nscoord aBCoord, uint8_t aBreakType,
|
||||
}
|
||||
|
||||
bool
|
||||
nsFloatManager::ClearContinues(uint8_t aBreakType) const
|
||||
nsFloatManager::ClearContinues(StyleClear aBreakType) const
|
||||
{
|
||||
return ((mPushedLeftFloatPastBreak || mSplitLeftFloatAcrossBreak) &&
|
||||
(aBreakType == NS_STYLE_CLEAR_BOTH ||
|
||||
aBreakType == NS_STYLE_CLEAR_LEFT)) ||
|
||||
(aBreakType == StyleClear::Both ||
|
||||
aBreakType == StyleClear::Left)) ||
|
||||
((mPushedRightFloatPastBreak || mSplitRightFloatAcrossBreak) &&
|
||||
(aBreakType == NS_STYLE_CLEAR_BOTH ||
|
||||
aBreakType == NS_STYLE_CLEAR_RIGHT));
|
||||
(aBreakType == StyleClear::Both ||
|
||||
aBreakType == StyleClear::Right));
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -271,14 +271,14 @@ public:
|
||||
// pushed to the next page/column.
|
||||
DONT_CLEAR_PUSHED_FLOATS = (1<<0)
|
||||
};
|
||||
nscoord ClearFloats(nscoord aBCoord, uint8_t aBreakType,
|
||||
nscoord ClearFloats(nscoord aBCoord, mozilla::StyleClear aBreakType,
|
||||
uint32_t aFlags = 0) const;
|
||||
|
||||
/**
|
||||
* Checks if clear would pass into the floats' BFC's next-in-flow,
|
||||
* i.e. whether floats affecting this clear have continuations.
|
||||
*/
|
||||
bool ClearContinues(uint8_t aBreakType) const;
|
||||
bool ClearContinues(mozilla::StyleClear aBreakType) const;
|
||||
|
||||
void AssertStateMatches(SavedState *aState) const
|
||||
{
|
||||
|
@ -4503,19 +4503,19 @@ nsIFrame::InlinePrefISizeData::ForceBreak()
|
||||
for (uint32_t i = 0, i_end = mFloats.Length(); i != i_end; ++i) {
|
||||
const FloatInfo& floatInfo = mFloats[i];
|
||||
const nsStyleDisplay* floatDisp = floatInfo.Frame()->StyleDisplay();
|
||||
uint8_t breakType = floatDisp->PhysicalBreakType(mLineContainerWM);
|
||||
if (breakType == NS_STYLE_CLEAR_LEFT ||
|
||||
breakType == NS_STYLE_CLEAR_RIGHT ||
|
||||
breakType == NS_STYLE_CLEAR_BOTH) {
|
||||
StyleClear breakType = floatDisp->PhysicalBreakType(mLineContainerWM);
|
||||
if (breakType == StyleClear::Left ||
|
||||
breakType == StyleClear::Right ||
|
||||
breakType == StyleClear::Both) {
|
||||
nscoord floats_cur = NSCoordSaturatingAdd(floats_cur_left,
|
||||
floats_cur_right);
|
||||
if (floats_cur > floats_done) {
|
||||
floats_done = floats_cur;
|
||||
}
|
||||
if (breakType != NS_STYLE_CLEAR_RIGHT) {
|
||||
if (breakType != StyleClear::Right) {
|
||||
floats_cur_left = 0;
|
||||
}
|
||||
if (breakType != NS_STYLE_CLEAR_LEFT) {
|
||||
if (breakType != StyleClear::Left) {
|
||||
floats_cur_right = 0;
|
||||
}
|
||||
}
|
||||
|
@ -285,9 +285,10 @@ typedef uint32_t nsReflowStatus;
|
||||
#define NS_INLINE_IS_BREAK_BEFORE(_status) \
|
||||
(NS_INLINE_BREAK == ((_status) & (NS_INLINE_BREAK|NS_INLINE_BREAK_AFTER)))
|
||||
|
||||
#define NS_INLINE_GET_BREAK_TYPE(_status) (((_status) >> 12) & 0xF)
|
||||
#define NS_INLINE_GET_BREAK_TYPE(_status) \
|
||||
(static_cast<StyleClear>(((_status) >> 12) & 0xF))
|
||||
|
||||
#define NS_INLINE_MAKE_BREAK_TYPE(_type) ((_type) << 12)
|
||||
#define NS_INLINE_MAKE_BREAK_TYPE(_type) (static_cast<int>(_type) << 12)
|
||||
|
||||
// Construct a line-break-before status. Note that there is no
|
||||
// completion status for a line-break before because we *know* that
|
||||
@ -295,7 +296,7 @@ typedef uint32_t nsReflowStatus;
|
||||
// status doesn't matter.
|
||||
#define NS_INLINE_LINE_BREAK_BEFORE() \
|
||||
(NS_INLINE_BREAK | NS_INLINE_BREAK_BEFORE | \
|
||||
NS_INLINE_MAKE_BREAK_TYPE(NS_STYLE_CLEAR_LINE))
|
||||
NS_INLINE_MAKE_BREAK_TYPE(StyleClear::Line))
|
||||
|
||||
// Take a completion status and add to it the desire to have a
|
||||
// line-break after. For this macro we do need the completion status
|
||||
@ -303,7 +304,7 @@ typedef uint32_t nsReflowStatus;
|
||||
// continue the frame or not.
|
||||
#define NS_INLINE_LINE_BREAK_AFTER(_completionStatus) \
|
||||
((_completionStatus) | NS_INLINE_BREAK | NS_INLINE_BREAK_AFTER | \
|
||||
NS_INLINE_MAKE_BREAK_TYPE(NS_STYLE_CLEAR_LINE))
|
||||
NS_INLINE_MAKE_BREAK_TYPE(StyleClear::Line))
|
||||
|
||||
// A frame is "truncated" if the part of the frame before the first
|
||||
// possible break point was unable to fit in the available vertical
|
||||
|
@ -48,13 +48,9 @@ nsLineBox::nsLineBox(nsIFrame* aFrame, int32_t aCount, bool aIsBlock)
|
||||
"wrong kind of child frame");
|
||||
}
|
||||
#endif
|
||||
|
||||
static_assert(NS_STYLE_CLEAR_MAX <= 15,
|
||||
static_assert(static_cast<int>(StyleClear::Max) <= 15,
|
||||
"FlagBits needs more bits to store the full range of "
|
||||
"break type ('clear') values");
|
||||
#if NS_STYLE_CLEAR_NONE > 0
|
||||
mFlags.mBreakType = NS_STYLE_CLEAR_NONE;
|
||||
#endif
|
||||
mChildCount = aCount;
|
||||
MarkDirty();
|
||||
mFlags.mBlock = aIsBlock;
|
||||
@ -195,17 +191,19 @@ ListFloats(FILE* out, const char* aPrefix, const nsFloatCacheList& aFloats)
|
||||
}
|
||||
}
|
||||
|
||||
const char *
|
||||
BreakTypeToString(uint8_t aBreakType)
|
||||
const char*
|
||||
nsLineBox::BreakTypeToString(StyleClear aBreakType) const
|
||||
{
|
||||
switch (aBreakType) {
|
||||
case NS_STYLE_CLEAR_NONE: return "nobr";
|
||||
case NS_STYLE_CLEAR_LEFT: return "leftbr";
|
||||
case NS_STYLE_CLEAR_RIGHT: return "rightbr";
|
||||
case NS_STYLE_CLEAR_BOTH: return "leftbr+rightbr";
|
||||
case NS_STYLE_CLEAR_LINE: return "linebr";
|
||||
default:
|
||||
break;
|
||||
case StyleClear::None_: return "nobr";
|
||||
case StyleClear::Left: return "leftbr";
|
||||
case StyleClear::Right: return "rightbr";
|
||||
case StyleClear::InlineStart: return "inlinestartbr";
|
||||
case StyleClear::InlineEnd: return "inlineendbr";
|
||||
case StyleClear::Both: return "leftbr+rightbr";
|
||||
case StyleClear::Line: return "linebr";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return "unknown";
|
||||
}
|
||||
@ -285,9 +283,7 @@ nsLineBox::List(FILE* out, const char* aPrefix, uint32_t aFlags) const
|
||||
}
|
||||
fprintf_stderr(out, "%s>\n", aPrefix);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
nsIFrame*
|
||||
nsLineBox::LastChild() const
|
||||
{
|
||||
|
@ -143,7 +143,6 @@ protected:
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
#define LINE_MAX_BREAK_TYPE ((1 << 4) - 1)
|
||||
#define LINE_MAX_CHILD_COUNT INT32_MAX
|
||||
|
||||
/**
|
||||
@ -394,37 +393,38 @@ public:
|
||||
// Break information is applied *before* the line if the line is a block,
|
||||
// or *after* the line if the line is an inline. Confusing, I know, but
|
||||
// using different names should help.
|
||||
using StyleClear = mozilla::StyleClear;
|
||||
bool HasBreakBefore() const {
|
||||
return IsBlock() && NS_STYLE_CLEAR_NONE != mFlags.mBreakType;
|
||||
return IsBlock() && StyleClear::None_ != BreakType();
|
||||
}
|
||||
void SetBreakTypeBefore(uint8_t aBreakType) {
|
||||
NS_ASSERTION(IsBlock(), "Only blocks have break-before");
|
||||
NS_ASSERTION(aBreakType == NS_STYLE_CLEAR_NONE ||
|
||||
aBreakType == NS_STYLE_CLEAR_LEFT ||
|
||||
aBreakType == NS_STYLE_CLEAR_RIGHT ||
|
||||
aBreakType == NS_STYLE_CLEAR_BOTH,
|
||||
"Only float break types are allowed before a line");
|
||||
mFlags.mBreakType = aBreakType;
|
||||
void SetBreakTypeBefore(StyleClear aBreakType) {
|
||||
MOZ_ASSERT(IsBlock(), "Only blocks have break-before");
|
||||
MOZ_ASSERT(aBreakType == StyleClear::None_ ||
|
||||
aBreakType == StyleClear::Left ||
|
||||
aBreakType == StyleClear::Right ||
|
||||
aBreakType == StyleClear::Both,
|
||||
"Only float break types are allowed before a line");
|
||||
mFlags.mBreakType = static_cast<int>(aBreakType);
|
||||
}
|
||||
uint8_t GetBreakTypeBefore() const {
|
||||
return IsBlock() ? mFlags.mBreakType : NS_STYLE_CLEAR_NONE;
|
||||
StyleClear GetBreakTypeBefore() const {
|
||||
return IsBlock() ? BreakType() : StyleClear::None_;
|
||||
}
|
||||
|
||||
bool HasBreakAfter() const {
|
||||
return !IsBlock() && NS_STYLE_CLEAR_NONE != mFlags.mBreakType;
|
||||
return !IsBlock() && StyleClear::None_ != BreakType();
|
||||
}
|
||||
void SetBreakTypeAfter(uint8_t aBreakType) {
|
||||
NS_ASSERTION(!IsBlock(), "Only inlines have break-after");
|
||||
NS_ASSERTION(aBreakType <= LINE_MAX_BREAK_TYPE, "bad break type");
|
||||
mFlags.mBreakType = aBreakType;
|
||||
void SetBreakTypeAfter(StyleClear aBreakType) {
|
||||
MOZ_ASSERT(!IsBlock(), "Only inlines have break-after");
|
||||
mFlags.mBreakType = static_cast<int>(aBreakType);
|
||||
}
|
||||
bool HasFloatBreakAfter() const {
|
||||
return !IsBlock() && (NS_STYLE_CLEAR_LEFT == mFlags.mBreakType ||
|
||||
NS_STYLE_CLEAR_RIGHT == mFlags.mBreakType ||
|
||||
NS_STYLE_CLEAR_BOTH == mFlags.mBreakType);
|
||||
return !IsBlock() &&
|
||||
(StyleClear::Left == BreakType() ||
|
||||
StyleClear::Right == BreakType() ||
|
||||
StyleClear::Both == BreakType());
|
||||
}
|
||||
uint8_t GetBreakTypeAfter() const {
|
||||
return !IsBlock() ? mFlags.mBreakType : NS_STYLE_CLEAR_NONE;
|
||||
StyleClear GetBreakTypeAfter() const {
|
||||
return !IsBlock() ? BreakType() : StyleClear::None_;
|
||||
}
|
||||
|
||||
// mCarriedOutBEndMargin value
|
||||
@ -572,6 +572,7 @@ public:
|
||||
int32_t* aFrameIndexInLine);
|
||||
|
||||
#ifdef DEBUG_FRAME_DUMP
|
||||
const char* BreakTypeToString(StyleClear aBreakType) const;
|
||||
char* StateToString(char* aBuf, int32_t aBufSize) const;
|
||||
|
||||
void List(FILE* out, int32_t aIndent, uint32_t aFlags = 0) const;
|
||||
@ -663,7 +664,9 @@ public:
|
||||
uint32_t mImpactedByFloat : 1;
|
||||
uint32_t mLineWrapped: 1;
|
||||
uint32_t mInvalidateTextRuns : 1;
|
||||
uint32_t mResizeReflowOptimizationDisabled: 1; // default 0 = means that the opt potentially applies to this line. 1 = never skip reflowing this line for a resize reflow
|
||||
// default 0 = means that the opt potentially applies to this line.
|
||||
// 1 = never skip reflowing this line for a resize reflow
|
||||
uint32_t mResizeReflowOptimizationDisabled: 1;
|
||||
uint32_t mEmptyCacheValid: 1;
|
||||
uint32_t mEmptyCacheState: 1;
|
||||
// mHasBullet indicates that this is an inline line whose block's
|
||||
@ -699,11 +702,17 @@ public:
|
||||
|
||||
protected:
|
||||
nscoord mAscent; // see |SetAscent| / |GetAscent|
|
||||
static_assert(sizeof(FlagBits) <= sizeof(uint32_t),
|
||||
"size of FlagBits should not be larger than size of uint32_t");
|
||||
union {
|
||||
uint32_t mAllFlags;
|
||||
FlagBits mFlags;
|
||||
};
|
||||
|
||||
StyleClear BreakType() const {
|
||||
return static_cast<StyleClear>(mFlags.mBreakType);
|
||||
};
|
||||
|
||||
union {
|
||||
ExtraData* mData;
|
||||
ExtraBlockData* mBlockData;
|
||||
|
@ -449,7 +449,7 @@ public:
|
||||
typename = typename std::enable_if<std::is_enum<T>::value>::type>
|
||||
void SetIntValue(T aInt, Unit aUnit)
|
||||
{
|
||||
static_assert(mozilla::IsEnumFittingWithin<T, int32_t>::value,
|
||||
static_assert(mozilla::EnumTypeFitsWithin<T, int32_t>::value,
|
||||
"aValue must be an enum that fits within mValue.mInt");
|
||||
SetIntValue(static_cast<int32_t>(aInt), aUnit);
|
||||
}
|
||||
|
@ -1058,13 +1058,13 @@ const KTableEntry nsCSSProps::kCaptionSideKTable[] = {
|
||||
};
|
||||
|
||||
KTableEntry nsCSSProps::kClearKTable[] = {
|
||||
{ eCSSKeyword_none, NS_STYLE_CLEAR_NONE },
|
||||
{ eCSSKeyword_left, NS_STYLE_CLEAR_LEFT },
|
||||
{ eCSSKeyword_right, NS_STYLE_CLEAR_RIGHT },
|
||||
{ eCSSKeyword_inline_start, NS_STYLE_CLEAR_INLINE_START },
|
||||
{ eCSSKeyword_inline_end, NS_STYLE_CLEAR_INLINE_END },
|
||||
{ eCSSKeyword_both, NS_STYLE_CLEAR_BOTH },
|
||||
{ eCSSKeyword_UNKNOWN, -1 }
|
||||
{ eCSSKeyword_none, StyleClear::None_ },
|
||||
{ eCSSKeyword_left, StyleClear::Left },
|
||||
{ eCSSKeyword_right, StyleClear::Right },
|
||||
{ eCSSKeyword_inline_start, StyleClear::InlineStart },
|
||||
{ eCSSKeyword_inline_end, StyleClear::InlineEnd },
|
||||
{ eCSSKeyword_both, StyleClear::Both },
|
||||
{ eCSSKeyword_UNKNOWN, -1 }
|
||||
};
|
||||
|
||||
// See also kContextPatternKTable for SVG paint-specific values
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "nsCSSKeywords.h"
|
||||
#include "mozilla/CSSEnabledState.h"
|
||||
#include "mozilla/UseCounter.h"
|
||||
#include "mozilla/EnumTypeTraits.h"
|
||||
|
||||
// Length of the "--" prefix on custom names (such as custom property names,
|
||||
// and, in the future, custom media query names).
|
||||
@ -327,24 +328,6 @@ enum nsStyleAnimType {
|
||||
eStyleAnimType_None
|
||||
};
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
// Type trait that determines whether the integral or enum type Type can fit
|
||||
// within the integral type Storage without loss.
|
||||
template<typename T, typename Storage>
|
||||
struct IsEnumFittingWithin
|
||||
: IntegralConstant<
|
||||
bool,
|
||||
std::is_integral<Storage>::value &&
|
||||
std::numeric_limits<typename std::underlying_type<T>::type>::min() >=
|
||||
std::numeric_limits<Storage>::min() &&
|
||||
std::numeric_limits<typename std::underlying_type<T>::type>::max() <=
|
||||
std::numeric_limits<Storage>::max()
|
||||
>
|
||||
{};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
class nsCSSProps {
|
||||
public:
|
||||
typedef mozilla::CSSEnabledState EnabledState;
|
||||
@ -366,7 +349,7 @@ public:
|
||||
: mKeyword(aKeyword)
|
||||
, mValue(static_cast<int16_t>(aValue))
|
||||
{
|
||||
static_assert(mozilla::IsEnumFittingWithin<T, int16_t>::value,
|
||||
static_assert(mozilla::EnumTypeFitsWithin<T, int16_t>::value,
|
||||
"aValue must be an enum that fits within mValue");
|
||||
}
|
||||
|
||||
@ -452,7 +435,7 @@ public:
|
||||
static nsCSSKeyword ValueToKeywordEnum(T aValue,
|
||||
const KTableEntry aTable[])
|
||||
{
|
||||
static_assert(mozilla::IsEnumFittingWithin<T, int16_t>::value,
|
||||
static_assert(mozilla::EnumTypeFitsWithin<T, int16_t>::value,
|
||||
"aValue must be an enum that fits within KTableEntry::mValue");
|
||||
return ValueToKeywordEnum(static_cast<int16_t>(aValue), aTable);
|
||||
}
|
||||
@ -464,7 +447,7 @@ public:
|
||||
static const nsAFlatCString& ValueToKeyword(T aValue,
|
||||
const KTableEntry aTable[])
|
||||
{
|
||||
static_assert(mozilla::IsEnumFittingWithin<T, int16_t>::value,
|
||||
static_assert(mozilla::EnumTypeFitsWithin<T, int16_t>::value,
|
||||
"aValue must be an enum that fits within KTableEntry::mValue");
|
||||
return ValueToKeyword(static_cast<int16_t>(aValue), aTable);
|
||||
}
|
||||
|
@ -758,7 +758,7 @@ public:
|
||||
typename = typename std::enable_if<std::is_enum<T>::value>::type>
|
||||
void SetIntValue(T aValue, nsCSSUnit aUnit)
|
||||
{
|
||||
static_assert(mozilla::IsEnumFittingWithin<T, int32_t>::value,
|
||||
static_assert(mozilla::EnumTypeFitsWithin<T, int32_t>::value,
|
||||
"aValue must be an enum that fits within mValue.mInt");
|
||||
SetIntValue(static_cast<int32_t>(aValue), aUnit);
|
||||
}
|
||||
|
@ -1342,6 +1342,7 @@ struct SetEnumValueHelper
|
||||
DEFINE_ENUM_CLASS_SETTER(StyleBoxOrient, Horizontal, Vertical)
|
||||
DEFINE_ENUM_CLASS_SETTER(StyleBoxPack, Start, Justify)
|
||||
DEFINE_ENUM_CLASS_SETTER(StyleBoxSizing, Content, Border)
|
||||
DEFINE_ENUM_CLASS_SETTER(StyleClear, None_, Both)
|
||||
DEFINE_ENUM_CLASS_SETTER(StyleFillRule, Nonzero, Evenodd)
|
||||
DEFINE_ENUM_CLASS_SETTER(StyleFloat, None_, InlineEnd)
|
||||
DEFINE_ENUM_CLASS_SETTER(StyleFloatEdge, ContentBox, MarginBox)
|
||||
@ -6044,7 +6045,7 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
|
||||
SetValue(*aRuleData->ValueForClear(), display->mBreakType, conditions,
|
||||
SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
|
||||
parentDisplay->mBreakType,
|
||||
NS_STYLE_CLEAR_NONE);
|
||||
StyleClear::None_);
|
||||
|
||||
// temp fix for bug 24000
|
||||
// Map 'auto' and 'avoid' to false, and 'always', 'left', and
|
||||
|
@ -108,6 +108,20 @@ enum class StyleBoxShadowType : uint8_t {
|
||||
Inset,
|
||||
};
|
||||
|
||||
// clear
|
||||
enum class StyleClear : uint8_t {
|
||||
None_ = 0,
|
||||
Left,
|
||||
Right,
|
||||
InlineStart,
|
||||
InlineEnd,
|
||||
Both,
|
||||
// StyleClear::Line can be added to one of the other values in layout
|
||||
// so it needs to use a bit value that none of the other values can have.
|
||||
Line = 8,
|
||||
Max = 13 // Max = (Both | Line)
|
||||
};
|
||||
|
||||
// clip-path geometry box
|
||||
enum class StyleClipPathGeometryBox : uint8_t {
|
||||
NoBox,
|
||||
@ -403,18 +417,6 @@ enum class FillMode : uint32_t;
|
||||
#define NS_STYLE_BORDER_IMAGE_SLICE_NOFILL 0
|
||||
#define NS_STYLE_BORDER_IMAGE_SLICE_FILL 1
|
||||
|
||||
// See nsStyleDisplay
|
||||
#define NS_STYLE_CLEAR_NONE 0
|
||||
#define NS_STYLE_CLEAR_LEFT 1
|
||||
#define NS_STYLE_CLEAR_RIGHT 2
|
||||
#define NS_STYLE_CLEAR_INLINE_START 3
|
||||
#define NS_STYLE_CLEAR_INLINE_END 4
|
||||
#define NS_STYLE_CLEAR_BOTH 5
|
||||
#define NS_STYLE_CLEAR_LINE 8
|
||||
// @note NS_STYLE_CLEAR_LINE can be added to one of the other values in layout
|
||||
// so it needs to use a bit value that none of the other values can have.
|
||||
#define NS_STYLE_CLEAR_MAX (NS_STYLE_CLEAR_LINE | NS_STYLE_CLEAR_BOTH)
|
||||
|
||||
// See nsStyleContent
|
||||
#define NS_STYLE_CONTENT_OPEN_QUOTE 0
|
||||
#define NS_STYLE_CONTENT_CLOSE_QUOTE 1
|
||||
|
@ -2988,7 +2988,7 @@ nsStyleDisplay::nsStyleDisplay(StyleStructContext aContext)
|
||||
, mPosition(NS_STYLE_POSITION_STATIC)
|
||||
, mFloat(StyleFloat::None_)
|
||||
, mOriginalFloat(StyleFloat::None_)
|
||||
, mBreakType(NS_STYLE_CLEAR_NONE)
|
||||
, mBreakType(StyleClear::None_)
|
||||
, mBreakInside(NS_STYLE_PAGE_BREAK_AUTO)
|
||||
, mBreakBefore(false)
|
||||
, mBreakAfter(false)
|
||||
|
@ -2840,7 +2840,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleDisplay
|
||||
// [reset] Save mFloat for position:absolute/fixed; otherwise equal to mFloat.
|
||||
mozilla::StyleFloat mOriginalFloat;
|
||||
|
||||
uint8_t mBreakType; // [reset] see nsStyleConsts.h NS_STYLE_CLEAR_*
|
||||
mozilla::StyleClear mBreakType; // [reset]
|
||||
uint8_t mBreakInside; // [reset] NS_STYLE_PAGE_BREAK_AUTO/AVOID
|
||||
bool mBreakBefore; // [reset]
|
||||
bool mBreakAfter; // [reset]
|
||||
@ -3094,7 +3094,7 @@ public:
|
||||
// resolved to {left,right} according to the given writing mode. These are
|
||||
// defined in WritingModes.h.
|
||||
inline mozilla::StyleFloat PhysicalFloats(mozilla::WritingMode aWM) const;
|
||||
inline uint8_t PhysicalBreakType(mozilla::WritingMode aWM) const;
|
||||
inline mozilla::StyleClear PhysicalBreakType(mozilla::WritingMode aWM) const;
|
||||
};
|
||||
|
||||
struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleTable
|
||||
|
70
mfbt/EnumTypeTraits.h
Normal file
70
mfbt/EnumTypeTraits.h
Normal file
@ -0,0 +1,70 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/* Type traits for enums. */
|
||||
|
||||
#ifndef mozilla_EnumTypeTraits_h
|
||||
#define mozilla_EnumTypeTraits_h
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<size_t EnumSize, bool EnumSigned, size_t StorageSize, bool StorageSigned>
|
||||
struct EnumFitsWithinHelper;
|
||||
|
||||
// Signed enum, signed storage.
|
||||
template<size_t EnumSize, size_t StorageSize>
|
||||
struct EnumFitsWithinHelper<EnumSize, true, StorageSize, true>
|
||||
: public std::integral_constant<bool, (EnumSize <= StorageSize)>
|
||||
{};
|
||||
|
||||
// Signed enum, unsigned storage.
|
||||
template<size_t EnumSize, size_t StorageSize>
|
||||
struct EnumFitsWithinHelper<EnumSize, true, StorageSize, false>
|
||||
: public std::integral_constant<bool, false>
|
||||
{};
|
||||
|
||||
// Unsigned enum, signed storage.
|
||||
template<size_t EnumSize, size_t StorageSize>
|
||||
struct EnumFitsWithinHelper<EnumSize, false, StorageSize, true>
|
||||
: public std::integral_constant<bool, (EnumSize * 2 <= StorageSize)>
|
||||
{};
|
||||
|
||||
// Unsigned enum, unsigned storage.
|
||||
template<size_t EnumSize, size_t StorageSize>
|
||||
struct EnumFitsWithinHelper<EnumSize, false, StorageSize, false>
|
||||
: public std::integral_constant<bool, (EnumSize <= StorageSize)>
|
||||
{};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/*
|
||||
* Type trait that determines whether the enum type T can fit within the
|
||||
* integral type Storage without data loss. This trait should be used with
|
||||
* caution with an enum type whose underlying type has not been explicitly
|
||||
* specified: for such enums, the C++ implementation is free to choose a type
|
||||
* no smaller than int whose range encompasses all possible values of the enum.
|
||||
* So for an enum with only small non-negative values, the underlying type may
|
||||
* be either int or unsigned int, depending on the whims of the implementation.
|
||||
*/
|
||||
template<typename T, typename Storage>
|
||||
struct EnumTypeFitsWithin
|
||||
: public detail::EnumFitsWithinHelper<
|
||||
sizeof(T),
|
||||
std::is_signed<typename std::underlying_type<T>::type>::value,
|
||||
sizeof(Storage),
|
||||
std::is_signed<Storage>::value
|
||||
>
|
||||
{
|
||||
static_assert(std::is_enum<T>::value, "must provide an enum type");
|
||||
static_assert(std::is_integral<Storage>::value, "must provide an integral type");
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif /* mozilla_EnumTypeTraits_h */
|
@ -39,6 +39,7 @@ EXPORTS.mozilla = [
|
||||
'EnumeratedArray.h',
|
||||
'EnumeratedRange.h',
|
||||
'EnumSet.h',
|
||||
'EnumTypeTraits.h',
|
||||
'FastBernoulliTrial.h',
|
||||
'FloatingPoint.h',
|
||||
'Function.h',
|
||||
|
136
mfbt/tests/TestEnumTypeTraits.cpp
Normal file
136
mfbt/tests/TestEnumTypeTraits.cpp
Normal file
@ -0,0 +1,136 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/IntegerTypeTraits.h"
|
||||
#include "mozilla/EnumTypeTraits.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
/* Feature check for EnumTypeFitsWithin. */
|
||||
|
||||
#define MAKE_FIXED_EMUM_FOR_TYPE(IntType) \
|
||||
enum FixedEnumFor_##IntType : IntType { \
|
||||
A_##IntType, \
|
||||
B_##IntType, \
|
||||
C_##IntType, \
|
||||
};
|
||||
|
||||
template<typename EnumType, typename IntType>
|
||||
static void
|
||||
TestShouldFit()
|
||||
{
|
||||
static_assert(EnumTypeFitsWithin<EnumType, IntType>::value,
|
||||
"Should fit within exact/promoted integral type");
|
||||
}
|
||||
|
||||
template<typename EnumType, typename IntType>
|
||||
static void
|
||||
TestShouldNotFit()
|
||||
{
|
||||
static_assert(!EnumTypeFitsWithin<EnumType, IntType>::value,
|
||||
"Should not fit within");
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
// check for int8_t
|
||||
MAKE_FIXED_EMUM_FOR_TYPE(int8_t);
|
||||
TestShouldFit<FixedEnumFor_int8_t, int8_t>();
|
||||
TestShouldFit<FixedEnumFor_int8_t, int16_t>();
|
||||
TestShouldFit<FixedEnumFor_int8_t, int32_t>();
|
||||
TestShouldFit<FixedEnumFor_int8_t, int64_t>();
|
||||
|
||||
TestShouldNotFit<FixedEnumFor_int8_t, uint8_t>();
|
||||
TestShouldNotFit<FixedEnumFor_int8_t, uint16_t>();
|
||||
TestShouldNotFit<FixedEnumFor_int8_t, uint32_t>();
|
||||
TestShouldNotFit<FixedEnumFor_int8_t, uint64_t>();
|
||||
|
||||
// check for uint8_t
|
||||
MAKE_FIXED_EMUM_FOR_TYPE(uint8_t);
|
||||
TestShouldFit<FixedEnumFor_uint8_t, uint8_t>();
|
||||
TestShouldFit<FixedEnumFor_uint8_t, uint16_t>();
|
||||
TestShouldFit<FixedEnumFor_uint8_t, uint32_t>();
|
||||
TestShouldFit<FixedEnumFor_uint8_t, uint64_t>();
|
||||
|
||||
TestShouldNotFit<FixedEnumFor_uint8_t, int8_t>();
|
||||
TestShouldFit<FixedEnumFor_uint8_t, int16_t>();
|
||||
TestShouldFit<FixedEnumFor_uint8_t, int32_t>();
|
||||
TestShouldFit<FixedEnumFor_uint8_t, int64_t>();
|
||||
|
||||
// check for int16_t
|
||||
MAKE_FIXED_EMUM_FOR_TYPE(int16_t);
|
||||
TestShouldNotFit<FixedEnumFor_int16_t, int8_t>();
|
||||
TestShouldFit<FixedEnumFor_int16_t, int16_t>();
|
||||
TestShouldFit<FixedEnumFor_int16_t, int32_t>();
|
||||
TestShouldFit<FixedEnumFor_int16_t, int64_t>();
|
||||
|
||||
TestShouldNotFit<FixedEnumFor_int16_t, uint8_t>();
|
||||
TestShouldNotFit<FixedEnumFor_int16_t, uint16_t>();
|
||||
TestShouldNotFit<FixedEnumFor_int16_t, uint32_t>();
|
||||
TestShouldNotFit<FixedEnumFor_int16_t, uint64_t>();
|
||||
|
||||
// check for uint16_t
|
||||
MAKE_FIXED_EMUM_FOR_TYPE(uint16_t);
|
||||
TestShouldNotFit<FixedEnumFor_uint16_t, uint8_t>();
|
||||
TestShouldFit<FixedEnumFor_uint16_t, uint16_t>();
|
||||
TestShouldFit<FixedEnumFor_uint16_t, uint32_t>();
|
||||
TestShouldFit<FixedEnumFor_uint16_t, uint64_t>();
|
||||
|
||||
TestShouldNotFit<FixedEnumFor_uint16_t, int8_t>();
|
||||
TestShouldNotFit<FixedEnumFor_uint16_t, int16_t>();
|
||||
TestShouldFit<FixedEnumFor_uint16_t, int32_t>();
|
||||
TestShouldFit<FixedEnumFor_uint16_t, int64_t>();
|
||||
|
||||
// check for int32_t
|
||||
MAKE_FIXED_EMUM_FOR_TYPE(int32_t);
|
||||
TestShouldNotFit<FixedEnumFor_int32_t, int8_t>();
|
||||
TestShouldNotFit<FixedEnumFor_int32_t, int16_t>();
|
||||
TestShouldFit<FixedEnumFor_int32_t, int32_t>();
|
||||
TestShouldFit<FixedEnumFor_int32_t, int64_t>();
|
||||
|
||||
TestShouldNotFit<FixedEnumFor_int32_t, uint8_t>();
|
||||
TestShouldNotFit<FixedEnumFor_int32_t, uint16_t>();
|
||||
TestShouldNotFit<FixedEnumFor_int32_t, uint32_t>();
|
||||
TestShouldNotFit<FixedEnumFor_int32_t, uint64_t>();
|
||||
|
||||
// check for uint32_t
|
||||
MAKE_FIXED_EMUM_FOR_TYPE(uint32_t);
|
||||
TestShouldNotFit<FixedEnumFor_uint32_t, uint8_t>();
|
||||
TestShouldNotFit<FixedEnumFor_uint32_t, uint16_t>();
|
||||
TestShouldFit<FixedEnumFor_uint32_t, uint32_t>();
|
||||
TestShouldFit<FixedEnumFor_uint32_t, uint64_t>();
|
||||
|
||||
TestShouldNotFit<FixedEnumFor_uint32_t, int8_t>();
|
||||
TestShouldNotFit<FixedEnumFor_uint32_t, int16_t>();
|
||||
TestShouldNotFit<FixedEnumFor_uint32_t, int32_t>();
|
||||
TestShouldFit<FixedEnumFor_uint32_t, int64_t>();
|
||||
|
||||
// check for int64_t
|
||||
MAKE_FIXED_EMUM_FOR_TYPE(int64_t);
|
||||
TestShouldNotFit<FixedEnumFor_int64_t, int8_t>();
|
||||
TestShouldNotFit<FixedEnumFor_int64_t, int16_t>();
|
||||
TestShouldNotFit<FixedEnumFor_int64_t, int32_t>();
|
||||
TestShouldFit<FixedEnumFor_int64_t, int64_t>();
|
||||
|
||||
TestShouldNotFit<FixedEnumFor_int64_t, uint8_t>();
|
||||
TestShouldNotFit<FixedEnumFor_int64_t, uint16_t>();
|
||||
TestShouldNotFit<FixedEnumFor_int64_t, uint32_t>();
|
||||
TestShouldNotFit<FixedEnumFor_int64_t, uint64_t>();
|
||||
|
||||
// check for uint64_t
|
||||
MAKE_FIXED_EMUM_FOR_TYPE(uint64_t);
|
||||
TestShouldNotFit<FixedEnumFor_uint64_t, uint8_t>();
|
||||
TestShouldNotFit<FixedEnumFor_uint64_t, uint16_t>();
|
||||
TestShouldNotFit<FixedEnumFor_uint64_t, uint32_t>();
|
||||
TestShouldFit<FixedEnumFor_uint64_t, uint64_t>();
|
||||
|
||||
TestShouldNotFit<FixedEnumFor_uint64_t, int8_t>();
|
||||
TestShouldNotFit<FixedEnumFor_uint64_t, int16_t>();
|
||||
TestShouldNotFit<FixedEnumFor_uint64_t, int32_t>();
|
||||
TestShouldNotFit<FixedEnumFor_uint64_t, int64_t>();
|
||||
|
||||
return 0;
|
||||
}
|
@ -17,6 +17,7 @@ CppUnitTests([
|
||||
'TestCountZeroes',
|
||||
'TestEndian',
|
||||
'TestEnumSet',
|
||||
'TestEnumTypeTraits',
|
||||
'TestFastBernoulliTrial',
|
||||
'TestFloatingPoint',
|
||||
'TestFunction',
|
||||
|
@ -2571,7 +2571,9 @@ public abstract class GeckoApp
|
||||
if (CPU.equals(topic)) {
|
||||
wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, topic);
|
||||
} else if (SCREEN.equals(topic)) {
|
||||
wl = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, topic);
|
||||
// ON_AFTER_RELEASE is set, the user activity timer will be reset when the
|
||||
// WakeLock is released, causing the illumination to remain on a bit longer.
|
||||
wl = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE, topic);
|
||||
}
|
||||
|
||||
if (wl != null) {
|
||||
|
@ -68,6 +68,12 @@ public class LauncherActivity extends Activity {
|
||||
private void dispatchNormalIntent() {
|
||||
Intent intent = new Intent(getIntent());
|
||||
intent.setClassName(getApplicationContext(), AppConstants.MOZ_ANDROID_BROWSER_INTENT_CLASS);
|
||||
|
||||
// Explicitly remove the new task and clear task flags (Our browser activity is a single
|
||||
// task activity and we never want to start a second task here). See bug 1280112.
|
||||
intent.setFlags(intent.getFlags() & ~Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent.setFlags(intent.getFlags() & ~Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ public final class Sample implements Parcelable {
|
||||
}
|
||||
|
||||
public boolean isDummy() {
|
||||
return bytes == null && info.size == 0;
|
||||
return !isEOS() && bytes == null && info.size == 0;
|
||||
}
|
||||
|
||||
public boolean isEOS() {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user