mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-15 08:53:07 +09:00
Issue #2862 - Change code references from CSS lowering to CSS flattening
This commit is contained in:
parent
505600c45e
commit
64d55b0a2e
4 changed files with 19 additions and 19 deletions
|
|
@ -3,7 +3,7 @@
|
|||
* 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 "CSSNestingLowerer.h"
|
||||
#include "CSSNestingFlattener.h"
|
||||
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "nsString.h"
|
||||
|
|
@ -14,22 +14,22 @@ namespace css {
|
|||
|
||||
namespace {
|
||||
|
||||
class CSSNestingLowerer final
|
||||
class CSSNestingFlattener final
|
||||
{
|
||||
using SelectorList = nsTArray<nsString>;
|
||||
|
||||
public:
|
||||
explicit CSSNestingLowerer(const nsAString& aInput)
|
||||
explicit CSSNestingFlattener(const nsAString& aInput)
|
||||
: mInput(aInput)
|
||||
, mPos(0)
|
||||
, mSawNesting(false)
|
||||
{
|
||||
}
|
||||
|
||||
bool Lower(nsAString& aOutput)
|
||||
bool Flatten(nsAString& aOutput)
|
||||
{
|
||||
nsAutoString lowered;
|
||||
if (!ProcessStylesheet(lowered, false)) {
|
||||
nsAutoString flattened;
|
||||
if (!ProcessStylesheet(flattened, false)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
aOutput.Assign(lowered);
|
||||
aOutput.Assign(flattened);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -952,10 +952,10 @@ private:
|
|||
} // namespace
|
||||
|
||||
bool
|
||||
LowerBasicCSSNesting(const nsAString& aInput, nsAString& aOutput)
|
||||
FlattenBasicCSSNesting(const nsAString& aInput, nsAString& aOutput)
|
||||
{
|
||||
CSSNestingLowerer lowerer(aInput);
|
||||
return lowerer.Lower(aOutput);
|
||||
CSSNestingFlattener flattener(aInput);
|
||||
return flattener.Flatten(aOutput);
|
||||
}
|
||||
|
||||
} // namespace css
|
||||
|
|
@ -3,17 +3,17 @@
|
|||
* 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/. */
|
||||
|
||||
#ifndef CSSNestingLowerer_h
|
||||
#define CSSNestingLowerer_h
|
||||
#ifndef CSSNestingFlattener_h
|
||||
#define CSSNestingFlattener_h
|
||||
|
||||
class nsAString;
|
||||
|
||||
namespace mozilla {
|
||||
namespace css {
|
||||
|
||||
bool LowerBasicCSSNesting(const nsAString& aInput, nsAString& aOutput);
|
||||
bool FlattenBasicCSSNesting(const nsAString& aInput, nsAString& aOutput);
|
||||
|
||||
} // namespace css
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // CSSNestingLowerer_h
|
||||
#endif // CSSNestingFlattener_h
|
||||
|
|
@ -127,7 +127,7 @@ UNIFIED_SOURCES += [
|
|||
'CounterStyleManager.cpp',
|
||||
'CSS.cpp',
|
||||
'CSSLexer.cpp',
|
||||
'CSSNestingLowerer.cpp',
|
||||
'CSSNestingFlattener.cpp',
|
||||
'CSSRuleList.cpp',
|
||||
'CSSStyleSheet.cpp',
|
||||
'CSSVariableDeclarations.cpp',
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
#include <regex> // for std::regex and std::regex_match
|
||||
|
||||
#include "nsCSSParser.h"
|
||||
#include "CSSNestingLowerer.h"
|
||||
#include "CSSNestingFlattener.h"
|
||||
#include "nsAlgorithm.h"
|
||||
#include "nsCSSProps.h"
|
||||
#include "nsCSSKeywords.h"
|
||||
|
|
@ -1826,11 +1826,11 @@ CSSParserImpl::ParseSheet(const nsAString& aInput,
|
|||
"Sheet principal does not match passed principal");
|
||||
#endif
|
||||
|
||||
nsAutoString loweredInput;
|
||||
nsAutoString flattenedInput;
|
||||
const nsAString* input = &aInput;
|
||||
if (sNestingEnabled &&
|
||||
mozilla::css::LowerBasicCSSNesting(aInput, loweredInput)) {
|
||||
input = &loweredInput;
|
||||
mozilla::css::FlattenBasicCSSNesting(aInput, flattenedInput)) {
|
||||
input = &flattenedInput;
|
||||
}
|
||||
|
||||
nsCSSScanner scanner(*input, aLineNumber);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue