зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1529444 - Add operator<< for PseudoStyleType to dump a string. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D20602 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
84ab7df19a
Коммит
dbd6045fc0
|
@ -7440,10 +7440,7 @@ void nsIFrame::ListGeneric(nsACString& aTo, const char* aPrefix,
|
|||
aTo += nsPrintfCString(" [cs=%p", static_cast<void*>(mComputedStyle));
|
||||
if (mComputedStyle) {
|
||||
auto pseudoType = mComputedStyle->GetPseudoType();
|
||||
if (pseudoType != PseudoStyleType::NotPseudo) {
|
||||
// FIXME(emilio): It'd be nice to get the string from here.
|
||||
aTo += nsPrintfCString("pseudo: %d", static_cast<int>(pseudoType));
|
||||
}
|
||||
aTo += ToString(pseudoType).c_str();
|
||||
}
|
||||
aTo += "]";
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "mozilla/ComputedStyle.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/ToString.h"
|
||||
|
||||
#include "nsCSSAnonBoxes.h"
|
||||
#include "nsCSSPseudoElements.h"
|
||||
|
@ -259,7 +260,7 @@ void ComputedStyle::List(FILE* out, int32_t aIndent) {
|
|||
}
|
||||
str.Append(nsPrintfCString("%p(%d) parent=%p ", (void*)this, 0, nullptr));
|
||||
if (mPseudoType != PseudoStyleType::NotPseudo) {
|
||||
str.Append(nsPrintfCString("pseudo-%d ", static_cast<int>(mPseudoType)));
|
||||
str.Append(nsPrintfCString("%s ", ToString(mPseudoType).c_str()));
|
||||
}
|
||||
|
||||
fprintf_stderr(out, "%s{ServoComputedData}\n", str.get());
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* 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 "PseudoStyleType.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
std::ostream& operator<<(std::ostream& aStream, PseudoStyleType aType) {
|
||||
switch (aType) {
|
||||
#define CSS_PSEUDO_ELEMENT(_name, _value, _flags) \
|
||||
case PseudoStyleType::_name: \
|
||||
aStream << _value; \
|
||||
break;
|
||||
#include "nsCSSPseudoElementList.h"
|
||||
#undef CSS_PSEUDO_ELEMENT
|
||||
|
||||
#define CSS_ANON_BOX(_name, _str) \
|
||||
case PseudoStyleType::_name: \
|
||||
aStream << _str; \
|
||||
break;
|
||||
#include "nsCSSAnonBoxList.h"
|
||||
#undef CSS_ANON_BOX
|
||||
|
||||
case PseudoStyleType::XULTree:
|
||||
case PseudoStyleType::NotPseudo:
|
||||
default:
|
||||
// Output nothing.
|
||||
break;
|
||||
}
|
||||
|
||||
return aStream;
|
||||
}
|
||||
|
||||
}; // namespace mozilla
|
|
@ -8,6 +8,7 @@
|
|||
#define mozilla_PseudoStyleType_h
|
||||
|
||||
#include <cstdint>
|
||||
#include <iosfwd>
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -75,6 +76,8 @@ enum class PseudoStyleType : uint8_t {
|
|||
MAX
|
||||
};
|
||||
|
||||
std::ostream& operator<<(std::ostream&, PseudoStyleType);
|
||||
|
||||
class PseudoStyle final {
|
||||
public:
|
||||
using Type = PseudoStyleType;
|
||||
|
|
|
@ -209,6 +209,7 @@ UNIFIED_SOURCES += [
|
|||
'PaintWorkletImpl.cpp',
|
||||
'PostTraversalTask.cpp',
|
||||
'PreloadedStyleSheet.cpp',
|
||||
'PseudoStyleType.cpp',
|
||||
'Rule.cpp',
|
||||
'ServoCSSParser.cpp',
|
||||
'ServoCSSRuleList.cpp',
|
||||
|
|
Загрузка…
Ссылка в новой задаче