diff options
Diffstat (limited to 'layout/style')
111 files changed, 489 insertions, 234 deletions
diff --git a/layout/style/AnimationCollection.cpp b/layout/style/AnimationCollection.cpp index f7826f5ed..fc913f27f 100644 --- a/layout/style/AnimationCollection.cpp +++ b/layout/style/AnimationCollection.cpp @@ -1,5 +1,4 @@ /* -*- 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/. */ diff --git a/layout/style/AnimationCollection.h b/layout/style/AnimationCollection.h index 96163fcc8..efab94bdc 100644 --- a/layout/style/AnimationCollection.h +++ b/layout/style/AnimationCollection.h @@ -1,5 +1,4 @@ /* -*- 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/. */ diff --git a/layout/style/AnimationCommon.cpp b/layout/style/AnimationCommon.cpp index f4ebc2a93..27682e0ea 100644 --- a/layout/style/AnimationCommon.cpp +++ b/layout/style/AnimationCommon.cpp @@ -1,4 +1,3 @@ -/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ /* 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/. */ diff --git a/layout/style/AnimationCommon.h b/layout/style/AnimationCommon.h index 025c034a4..61a60a53e 100644 --- a/layout/style/AnimationCommon.h +++ b/layout/style/AnimationCommon.h @@ -1,4 +1,3 @@ -/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ /* 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/. */ diff --git a/layout/style/CSSCalc.h b/layout/style/CSSCalc.h index 141ca9c0a..06a570c73 100644 --- a/layout/style/CSSCalc.h +++ b/layout/style/CSSCalc.h @@ -1,4 +1,3 @@ -/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ /* 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/. */ diff --git a/layout/style/CSSEnabledState.h b/layout/style/CSSEnabledState.h index 650397072..da9a10fe0 100644 --- a/layout/style/CSSEnabledState.h +++ b/layout/style/CSSEnabledState.h @@ -1,5 +1,4 @@ /* -*- 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/. */ diff --git a/layout/style/CSSRuleList.cpp b/layout/style/CSSRuleList.cpp index 8493e8a37..0e4df33d2 100644 --- a/layout/style/CSSRuleList.cpp +++ b/layout/style/CSSRuleList.cpp @@ -1,5 +1,4 @@ /* -*- 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/. */ diff --git a/layout/style/CSSStyleSheet.cpp b/layout/style/CSSStyleSheet.cpp index 9404fa713..40a4ee4d8 100644 --- a/layout/style/CSSStyleSheet.cpp +++ b/layout/style/CSSStyleSheet.cpp @@ -695,7 +695,7 @@ nsMediaList::GetMediaText(nsAString& aMediaText) // nsCOMPtr<nsIDocument> #define BEGIN_MEDIA_CHANGE(sheet, doc) \ if (sheet) { \ - doc = sheet->GetOwningDocument(); \ + doc = sheet->GetAssociatedDocument(); \ } \ mozAutoDocUpdate updateBatch(doc, UPDATE_STYLE, true); \ if (sheet) { \ @@ -865,7 +865,8 @@ struct ChildSheetListBuilder { void SetParentLinks(CSSStyleSheet* aSheet) { aSheet->mParent = parent; - aSheet->SetOwningDocument(parent->mDocument); + aSheet->SetAssociatedDocument(parent->mDocument, + parent->mDocumentAssociationMode); } static void ReparentChildList(CSSStyleSheet* aPrimarySheet, @@ -873,7 +874,8 @@ struct ChildSheetListBuilder { { for (CSSStyleSheet *child = aFirstChild; child; child = child->mNext) { child->mParent = aPrimarySheet; - child->SetOwningDocument(aPrimarySheet->mDocument); + child->SetAssociatedDocument(aPrimarySheet->mDocument, + aPrimarySheet->mDocumentAssociationMode); } } }; @@ -1360,16 +1362,22 @@ CSSStyleSheet::GetParentSheet() const } void -CSSStyleSheet::SetOwningDocument(nsIDocument* aDocument) -{ // not ref counted +CSSStyleSheet::SetAssociatedDocument(nsIDocument* aDocument, + DocumentAssociationMode aAssociationMode) +{ + MOZ_ASSERT_IF(!aDocument, aAssociationMode == NotOwnedByDocument); + + // not ref counted mDocument = aDocument; + mDocumentAssociationMode = aAssociationMode; + // Now set the same document on all our child sheets.... // XXXbz this is a little bogus; see the XXX comment where we // declare mFirstChild. for (CSSStyleSheet* child = mInner->mFirstChild; child; child = child->mNext) { if (child->mParent == this) { - child->SetOwningDocument(aDocument); + child->SetAssociatedDocument(aDocument, aAssociationMode); } } } diff --git a/layout/style/CSSStyleSheet.h b/layout/style/CSSStyleSheet.h index 74e12291e..89189d781 100644 --- a/layout/style/CSSStyleSheet.h +++ b/layout/style/CSSStyleSheet.h @@ -129,7 +129,8 @@ public: // style sheet owner info CSSStyleSheet* GetParentSheet() const; // may be null - void SetOwningDocument(nsIDocument* aDocument); + void SetAssociatedDocument(nsIDocument* aDocument, + DocumentAssociationMode aAssociationMode); // Find the ID of the owner inner window. uint64_t FindOwningWindowInnerID() const; diff --git a/layout/style/CSSUnprefixingService.js b/layout/style/CSSUnprefixingService.js index 801ea198c..f6c63a023 100644 --- a/layout/style/CSSUnprefixingService.js +++ b/layout/style/CSSUnprefixingService.js @@ -1,5 +1,4 @@ /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- / -/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ /* 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/. */ diff --git a/layout/style/CSSValue.h b/layout/style/CSSValue.h index ecba05e84..c02341d01 100644 --- a/layout/style/CSSValue.h +++ b/layout/style/CSSValue.h @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=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/. */ diff --git a/layout/style/CSSVariableDeclarations.cpp b/layout/style/CSSVariableDeclarations.cpp index 67bb8d732..34a2bb035 100644 --- a/layout/style/CSSVariableDeclarations.cpp +++ b/layout/style/CSSVariableDeclarations.cpp @@ -1,5 +1,4 @@ /* -*- 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/. */ diff --git a/layout/style/CSSVariableDeclarations.h b/layout/style/CSSVariableDeclarations.h index ebc17285b..294e71a00 100644 --- a/layout/style/CSSVariableDeclarations.h +++ b/layout/style/CSSVariableDeclarations.h @@ -1,4 +1,3 @@ -/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ /* 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/. */ diff --git a/layout/style/CSSVariableResolver.cpp b/layout/style/CSSVariableResolver.cpp index 0d25b747b..abf9fc12a 100644 --- a/layout/style/CSSVariableResolver.cpp +++ b/layout/style/CSSVariableResolver.cpp @@ -1,4 +1,3 @@ -/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ /* 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/. */ diff --git a/layout/style/CSSVariableResolver.h b/layout/style/CSSVariableResolver.h index f9758ca3a..ec7d1386f 100644 --- a/layout/style/CSSVariableResolver.h +++ b/layout/style/CSSVariableResolver.h @@ -1,4 +1,3 @@ -/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ /* 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/. */ diff --git a/layout/style/CSSVariableValues.h b/layout/style/CSSVariableValues.h index e26566be1..3e4c6d9d0 100644 --- a/layout/style/CSSVariableValues.h +++ b/layout/style/CSSVariableValues.h @@ -1,4 +1,3 @@ -/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ /* 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/. */ diff --git a/layout/style/CounterStyleManager.cpp b/layout/style/CounterStyleManager.cpp index bccc9b836..b36fe5021 100644 --- a/layout/style/CounterStyleManager.cpp +++ b/layout/style/CounterStyleManager.cpp @@ -1,5 +1,4 @@ /* -*- 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/. */ diff --git a/layout/style/CounterStyleManager.h b/layout/style/CounterStyleManager.h index 2f760f340..8445562ef 100644 --- a/layout/style/CounterStyleManager.h +++ b/layout/style/CounterStyleManager.h @@ -1,5 +1,4 @@ /* -*- 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/. */ diff --git a/layout/style/DeclarationBlock.h b/layout/style/DeclarationBlock.h index c3ed663b4..180b32cba 100644 --- a/layout/style/DeclarationBlock.h +++ b/layout/style/DeclarationBlock.h @@ -1,5 +1,4 @@ /* -*- 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/. */ diff --git a/layout/style/DeclarationBlockInlines.h b/layout/style/DeclarationBlockInlines.h index 791d24498..e8ff3ebba 100644 --- a/layout/style/DeclarationBlockInlines.h +++ b/layout/style/DeclarationBlockInlines.h @@ -1,5 +1,4 @@ /* -*- 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/. */ diff --git a/layout/style/DocumentStyleRootIterator.cpp b/layout/style/DocumentStyleRootIterator.cpp new file mode 100644 index 000000000..d99454ee0 --- /dev/null +++ b/layout/style/DocumentStyleRootIterator.cpp @@ -0,0 +1,40 @@ +/* -*- Mode: C++; tab-width: 8; 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 "DocumentStyleRootIterator.h" + +#include "nsContentUtils.h" + +namespace mozilla { + +DocumentStyleRootIterator::DocumentStyleRootIterator(nsIDocument* aDocument) + : mPosition(0) +{ + MOZ_COUNT_CTOR(DocumentStyleRootIterator); + if (Element* root = aDocument->GetRootElement()) { + mStyleRoots.AppendElement(root); + } + nsContentUtils::AppendDocumentLevelNativeAnonymousContentTo( + aDocument, mStyleRoots); +} + +Element* +DocumentStyleRootIterator::GetNextStyleRoot() +{ + for (;;) { + if (mPosition >= mStyleRoots.Length()) { + return nullptr; + } + + nsIContent* next = mStyleRoots[mPosition]; + ++mPosition; + + if (next->IsElement()) { + return next->AsElement(); + } + } +} + +} // namespace mozilla diff --git a/layout/style/DocumentStyleRootIterator.h b/layout/style/DocumentStyleRootIterator.h new file mode 100644 index 000000000..7c07d5c2c --- /dev/null +++ b/layout/style/DocumentStyleRootIterator.h @@ -0,0 +1,37 @@ +/* -*- Mode: C++; tab-width: 8; 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/. */ + +#ifndef DocumentStyleRootIterator_h +#define DocumentStyleRootIterator_h + +#include "nsTArray.h" +#include "mozilla/dom/Element.h" + +class nsIContent; +class nsIDocument; + +namespace mozilla { + +/** + * DocumentStyleRootIterator traverses the roots of the document from the + * perspective of the Servo-backed style system. This will first traverse + * the document root, followed by any document level native anonymous content. + */ +class DocumentStyleRootIterator +{ +public: + explicit DocumentStyleRootIterator(nsIDocument* aDocument); + ~DocumentStyleRootIterator() { MOZ_COUNT_DTOR(DocumentStyleRootIterator); } + + Element* GetNextStyleRoot(); + +private: + AutoTArray<nsIContent*, 8> mStyleRoots; + uint32_t mPosition; +}; + +} // namespace mozilla + +#endif // DocumentStyleRootIterator_h diff --git a/layout/style/FontFaceSet.cpp b/layout/style/FontFaceSet.cpp index 81c5ede0e..7309ef3fb 100644 --- a/layout/style/FontFaceSet.cpp +++ b/layout/style/FontFaceSet.cpp @@ -1,5 +1,4 @@ /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */ -/* vim: set ts=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/. */ diff --git a/layout/style/HandleRefPtr.h b/layout/style/HandleRefPtr.h index 0a73a4cf7..487634c47 100644 --- a/layout/style/HandleRefPtr.h +++ b/layout/style/HandleRefPtr.h @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * vim: set ts=2 sw=2 et tw=78: * 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/. diff --git a/layout/style/IncrementalClearCOMRuleArray.cpp b/layout/style/IncrementalClearCOMRuleArray.cpp index 92cdced22..76baec794 100644 --- a/layout/style/IncrementalClearCOMRuleArray.cpp +++ b/layout/style/IncrementalClearCOMRuleArray.cpp @@ -1,5 +1,4 @@ /* -*- 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/. */ diff --git a/layout/style/IncrementalClearCOMRuleArray.h b/layout/style/IncrementalClearCOMRuleArray.h index 9934fd683..2b17b9163 100644 --- a/layout/style/IncrementalClearCOMRuleArray.h +++ b/layout/style/IncrementalClearCOMRuleArray.h @@ -1,5 +1,4 @@ /* -*- 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/. */ diff --git a/layout/style/LayerAnimationInfo.cpp b/layout/style/LayerAnimationInfo.cpp index 8a119512b..035054eb4 100644 --- a/layout/style/LayerAnimationInfo.cpp +++ b/layout/style/LayerAnimationInfo.cpp @@ -1,4 +1,3 @@ -/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ /* 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/. */ diff --git a/layout/style/LayerAnimationInfo.h b/layout/style/LayerAnimationInfo.h index 53c5ae9bf..461695c63 100644 --- a/layout/style/LayerAnimationInfo.h +++ b/layout/style/LayerAnimationInfo.h @@ -1,4 +1,3 @@ -/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ /* 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/. */ diff --git a/layout/style/Loader.cpp b/layout/style/Loader.cpp index a06dd3737..155ecbeee 100644 --- a/layout/style/Loader.cpp +++ b/layout/style/Loader.cpp @@ -50,6 +50,7 @@ #include "nsGkAtoms.h" #include "nsIThreadInternal.h" #include "nsINetworkPredictor.h" +#include "nsITimedChannel.h" #include "mozilla/dom/ShadowRoot.h" #include "mozilla/dom/URL.h" #include "mozilla/AsyncEventDispatcher.h" @@ -1335,7 +1336,7 @@ Loader::InsertSheetInDoc(StyleSheet* aSheet, // XXX Need to cancel pending sheet loads for this element, if any - int32_t sheetCount = aDocument->GetNumberOfStyleSheets(); + int32_t sheetCount = aDocument->SheetCount(); /* * Start the walk at the _end_ of the list, since in the typical @@ -1347,7 +1348,7 @@ Loader::InsertSheetInDoc(StyleSheet* aSheet, */ int32_t insertionPoint; for (insertionPoint = sheetCount - 1; insertionPoint >= 0; --insertionPoint) { - StyleSheet* curSheet = aDocument->GetStyleSheetAt(insertionPoint); + StyleSheet* curSheet = aDocument->SheetAt(insertionPoint); NS_ASSERTION(curSheet, "There must be a sheet here!"); nsCOMPtr<nsINode> sheetOwner = curSheet->GetOwnerNode(); if (sheetOwner && !aLinkingContent) { @@ -2215,9 +2216,9 @@ Loader::LoadChildSheet(StyleSheet* aParentSheet, nsCOMPtr<nsINode> owningNode; - // check for an owning document: if none, don't bother walking up the parent - // sheets - if (aParentSheet->GetOwningDocument()) { + // check for an associated document: if none, don't bother walking up the + // parent sheets + if (aParentSheet->GetAssociatedDocument()) { StyleSheet* topSheet = aParentSheet; while (StyleSheet* parent = topSheet->GetParentSheet()) { topSheet = parent; diff --git a/layout/style/MediaQueryList.h b/layout/style/MediaQueryList.h index d2acb34c1..b660d523e 100644 --- a/layout/style/MediaQueryList.h +++ b/layout/style/MediaQueryList.h @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ /* 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/. */ diff --git a/layout/style/RuleNodeCacheConditions.cpp b/layout/style/RuleNodeCacheConditions.cpp index 2dbb6c344..194b27591 100644 --- a/layout/style/RuleNodeCacheConditions.cpp +++ b/layout/style/RuleNodeCacheConditions.cpp @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=2 et sw=2 tw=78: */ /* 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/. */ diff --git a/layout/style/RuleProcessorCache.cpp b/layout/style/RuleProcessorCache.cpp index e2e788c56..caaec4dde 100644 --- a/layout/style/RuleProcessorCache.cpp +++ b/layout/style/RuleProcessorCache.cpp @@ -1,5 +1,4 @@ /* -*- 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/. */ diff --git a/layout/style/RuleProcessorCache.h b/layout/style/RuleProcessorCache.h index 7eb808fc9..8d43aed34 100644 --- a/layout/style/RuleProcessorCache.h +++ b/layout/style/RuleProcessorCache.h @@ -1,5 +1,4 @@ /* -*- 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/. */ diff --git a/layout/style/ServoBindingList.h b/layout/style/ServoBindingList.h index 3badfc37f..ff0fba408 100644 --- a/layout/style/ServoBindingList.h +++ b/layout/style/ServoBindingList.h @@ -1,5 +1,4 @@ /* -*- 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/. */ diff --git a/layout/style/ServoBindingTypes.h b/layout/style/ServoBindingTypes.h index b315d9b49..c1e25aad5 100644 --- a/layout/style/ServoBindingTypes.h +++ b/layout/style/ServoBindingTypes.h @@ -1,5 +1,4 @@ /* -*- 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/. */ diff --git a/layout/style/ServoBindings.cpp b/layout/style/ServoBindings.cpp index ad34633e9..5f6842da6 100644 --- a/layout/style/ServoBindings.cpp +++ b/layout/style/ServoBindings.cpp @@ -1,5 +1,4 @@ /* -*- 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/. */ diff --git a/layout/style/ServoBindings.h b/layout/style/ServoBindings.h index 81ea48d5b..a8a621467 100644 --- a/layout/style/ServoBindings.h +++ b/layout/style/ServoBindings.h @@ -1,5 +1,4 @@ /* -*- 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/. */ diff --git a/layout/style/ServoElementSnapshot.cpp b/layout/style/ServoElementSnapshot.cpp index 2b1dd840d..ed40ea0f1 100644 --- a/layout/style/ServoElementSnapshot.cpp +++ b/layout/style/ServoElementSnapshot.cpp @@ -1,5 +1,4 @@ /* -*- 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/. */ diff --git a/layout/style/ServoElementSnapshot.h b/layout/style/ServoElementSnapshot.h index 638b2fd31..5f157f817 100644 --- a/layout/style/ServoElementSnapshot.h +++ b/layout/style/ServoElementSnapshot.h @@ -1,5 +1,4 @@ /* -*- 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/. */ diff --git a/layout/style/ServoStyleSet.cpp b/layout/style/ServoStyleSet.cpp index f0230b55b..38752bcc9 100644 --- a/layout/style/ServoStyleSet.cpp +++ b/layout/style/ServoStyleSet.cpp @@ -1,5 +1,4 @@ /* -*- 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/. */ @@ -340,7 +339,7 @@ ServoStyleSet::AddDocStyleSheet(ServoStyleSheet* aSheet, mSheets[SheetType::Doc].RemoveElement(aSheet); size_t index = - aDocument->FindDocStyleSheetInsertionPoint(mSheets[SheetType::Doc], aSheet); + aDocument->FindDocStyleSheetInsertionPoint(mSheets[SheetType::Doc], *aSheet); mSheets[SheetType::Doc].InsertElementAt(index, aSheet); // Maintain a mirrored list of sheets on the servo side. diff --git a/layout/style/ServoStyleSet.h b/layout/style/ServoStyleSet.h index 26b515afd..eacb8378b 100644 --- a/layout/style/ServoStyleSet.h +++ b/layout/style/ServoStyleSet.h @@ -1,5 +1,4 @@ /* -*- 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/. */ diff --git a/layout/style/ServoStyleSheet.cpp b/layout/style/ServoStyleSheet.cpp index 340ecc22a..8b6decb4f 100644 --- a/layout/style/ServoStyleSheet.cpp +++ b/layout/style/ServoStyleSheet.cpp @@ -1,5 +1,4 @@ /* -*- 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/. */ @@ -34,19 +33,23 @@ ServoStyleSheet::HasRules() const } void -ServoStyleSheet::SetOwningDocument(nsIDocument* aDocument) +ServoStyleSheet::SetAssociatedDocument(nsIDocument* aDocument, + DocumentAssociationMode aAssociationMode) { + MOZ_ASSERT_IF(!aDocument, aAssociationMode == NotOwnedByDocument); + // XXXheycam: Traverse to child ServoStyleSheets to set this, like - // CSSStyleSheet::SetOwningDocument does. + // CSSStyleSheet::SetAssociatedDocument does. mDocument = aDocument; + mDocumentAssociationMode = aAssociationMode; } ServoStyleSheet* ServoStyleSheet::GetParentSheet() const { // XXXheycam: When we implement support for child sheets, we'll have - // to fix SetOwningDocument to propagate the owning document down + // to fix SetAssociatedDocument to propagate the associated document down // to the children. MOZ_CRASH("stylo: not implemented"); } diff --git a/layout/style/ServoStyleSheet.h b/layout/style/ServoStyleSheet.h index 079f196eb..d32d57674 100644 --- a/layout/style/ServoStyleSheet.h +++ b/layout/style/ServoStyleSheet.h @@ -1,5 +1,4 @@ /* -*- 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/. */ @@ -29,7 +28,8 @@ public: bool HasRules() const; - void SetOwningDocument(nsIDocument* aDocument); + void SetAssociatedDocument(nsIDocument* aDocument, + DocumentAssociationMode aAssociationMode); ServoStyleSheet* GetParentSheet() const; void AppendStyleSheet(ServoStyleSheet* aSheet); diff --git a/layout/style/ServoTypes.h b/layout/style/ServoTypes.h index 6d1324b88..8bfed9b5a 100644 --- a/layout/style/ServoTypes.h +++ b/layout/style/ServoTypes.h @@ -1,5 +1,4 @@ /* -*- 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/. */ diff --git a/layout/style/ServoUtils.h b/layout/style/ServoUtils.h index b116b9c4f..047cbb7a0 100644 --- a/layout/style/ServoUtils.h +++ b/layout/style/ServoUtils.h @@ -1,5 +1,4 @@ /* -*- 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/. */ diff --git a/layout/style/SheetParsingMode.h b/layout/style/SheetParsingMode.h index 2eb6b2f64..132b99a79 100644 --- a/layout/style/SheetParsingMode.h +++ b/layout/style/SheetParsingMode.h @@ -1,5 +1,4 @@ /* -*- 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/. */ diff --git a/layout/style/StyleAnimationValue.cpp b/layout/style/StyleAnimationValue.cpp index d931961d4..ff6783553 100644 --- a/layout/style/StyleAnimationValue.cpp +++ b/layout/style/StyleAnimationValue.cpp @@ -1,5 +1,4 @@ /* -*- 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/. */ diff --git a/layout/style/StyleBackendType.h b/layout/style/StyleBackendType.h index f02b86213..99d5c154d 100644 --- a/layout/style/StyleBackendType.h +++ b/layout/style/StyleBackendType.h @@ -1,5 +1,4 @@ /* -*- 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/. */ diff --git a/layout/style/StyleComplexColor.h b/layout/style/StyleComplexColor.h index 6385b57a1..f3ff126a4 100644 --- a/layout/style/StyleComplexColor.h +++ b/layout/style/StyleComplexColor.h @@ -1,5 +1,4 @@ /* -*- 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/. */ diff --git a/layout/style/StyleRule.cpp b/layout/style/StyleRule.cpp index 6c374404d..8fde72534 100644 --- a/layout/style/StyleRule.cpp +++ b/layout/style/StyleRule.cpp @@ -1079,6 +1079,16 @@ public: return mRule ? mRule->GetDocument() : nullptr; } + virtual DocGroup* GetDocGroup() const override + { + if (!mRule) { + return nullptr; + } + + nsIDocument* document = mRule->GetDocument(); + return document ? document->GetDocGroup() : nullptr; + } + friend class css::DOMCSSStyleRule; protected: @@ -1210,13 +1220,13 @@ DOMCSSDeclarationImpl::SetCSSDeclaration(DeclarationBlock* aDecl) NS_PRECONDITION(mRule, "can only be called when |GetCSSDeclaration| returned a declaration"); - nsCOMPtr<nsIDocument> owningDoc; + nsCOMPtr<nsIDocument> doc; RefPtr<CSSStyleSheet> sheet = mRule->GetStyleSheet(); if (sheet) { - owningDoc = sheet->GetOwningDocument(); + doc = sheet->GetAssociatedDocument(); } - mozAutoDocUpdate updateBatch(owningDoc, UPDATE_STYLE, true); + mozAutoDocUpdate updateBatch(doc, UPDATE_STYLE, true); mRule->SetDeclaration(aDecl->AsGecko()); @@ -1224,8 +1234,8 @@ DOMCSSDeclarationImpl::SetCSSDeclaration(DeclarationBlock* aDecl) sheet->DidDirty(); } - if (owningDoc) { - owningDoc->StyleRuleChanged(sheet, mRule); + if (doc) { + doc->StyleRuleChanged(sheet, mRule); } return NS_OK; } diff --git a/layout/style/StyleSetHandle.h b/layout/style/StyleSetHandle.h index ad75f75ae..6c67a058d 100644 --- a/layout/style/StyleSetHandle.h +++ b/layout/style/StyleSetHandle.h @@ -1,5 +1,4 @@ /* -*- 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/. */ diff --git a/layout/style/StyleSetHandleInlines.h b/layout/style/StyleSetHandleInlines.h index 2bb32101f..8cc1f53fe 100644 --- a/layout/style/StyleSetHandleInlines.h +++ b/layout/style/StyleSetHandleInlines.h @@ -1,5 +1,4 @@ /* -*- 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/. */ diff --git a/layout/style/StyleSheet.cpp b/layout/style/StyleSheet.cpp index 1a7178edb..03f8e19d8 100644 --- a/layout/style/StyleSheet.cpp +++ b/layout/style/StyleSheet.cpp @@ -1,5 +1,4 @@ /* -*- 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/. */ @@ -12,8 +11,8 @@ #include "mozilla/ServoStyleSheet.h" #include "mozilla/StyleSheetInlines.h" #include "mozilla/CSSStyleSheet.h" -#include "mozAutoDocUpdate.h" +#include "mozAutoDocUpdate.h" #include "nsIMediaList.h" #include "nsNullPrincipal.h" @@ -27,6 +26,7 @@ StyleSheet::StyleSheet(StyleBackendType aType, css::SheetParsingMode aParsingMod , mParsingMode(aParsingMode) , mType(aType) , mDisabled(false) + , mDocumentAssociationMode(NotOwnedByDocument) { } @@ -39,6 +39,9 @@ StyleSheet::StyleSheet(const StyleSheet& aCopy, , mParsingMode(aCopy.mParsingMode) , mType(aCopy.mType) , mDisabled(aCopy.mDisabled) + // We only use this constructor during cloning. It's the cloner's + // responsibility to notify us if we end up being owned by a document. + , mDocumentAssociationMode(NotOwnedByDocument) { } @@ -354,7 +357,7 @@ StyleSheet::AreRulesAvailable(nsIPrincipal& aSubjectPrincipal, JSObject* StyleSheet::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) { - return CSSStyleSheetBinding::Wrap(aCx, this, aGivenProto); + return dom::CSSStyleSheetBinding::Wrap(aCx, this, aGivenProto); } } // namespace mozilla diff --git a/layout/style/StyleSheet.h b/layout/style/StyleSheet.h index 863f6d22f..55d114700 100644 --- a/layout/style/StyleSheet.h +++ b/layout/style/StyleSheet.h @@ -1,5 +1,4 @@ /* -*- 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/. */ @@ -95,8 +94,22 @@ public: inline bool HasRules() const; // style sheet owner info - nsIDocument* GetOwningDocument() const { return mDocument; } - inline void SetOwningDocument(nsIDocument* aDocument); + enum DocumentAssociationMode { + // OwnedByDocument means mDocument owns us (possibly via a chain of other + // stylesheets). + OwnedByDocument, + // NotOwnedByDocument means we're owned by something that might have a + // different lifetime than mDocument. + NotOwnedByDocument + }; + nsIDocument* GetAssociatedDocument() const { return mDocument; } + bool IsOwnedByDocument() const { + return mDocumentAssociationMode == OwnedByDocument; + } + // aDocument must not be null. + inline void SetAssociatedDocument(nsIDocument* aDocument, + DocumentAssociationMode aMode); + inline void ClearAssociatedDocument(); nsINode* GetOwnerNode() const { return mOwningNode; } inline StyleSheet* GetParentSheet() const; @@ -206,6 +219,11 @@ protected: const StyleBackendType mType; bool mDisabled; + + // mDocumentAssociationMode determines whether mDocument directly owns us (in + // the sense that if it's known-live then we're known-live). Always + // NotOwnedByDocument when mDocument is null. + DocumentAssociationMode mDocumentAssociationMode; }; } // namespace mozilla diff --git a/layout/style/StyleSheetInfo.h b/layout/style/StyleSheetInfo.h index 9d085fa81..519222ab1 100644 --- a/layout/style/StyleSheetInfo.h +++ b/layout/style/StyleSheetInfo.h @@ -1,5 +1,4 @@ /* -*- 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/. */ diff --git a/layout/style/StyleSheetInlines.h b/layout/style/StyleSheetInlines.h index d03a3741b..6426ea5d7 100644 --- a/layout/style/StyleSheetInlines.h +++ b/layout/style/StyleSheetInlines.h @@ -1,5 +1,4 @@ /* -*- 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/. */ @@ -83,9 +82,17 @@ StyleSheet::HasRules() const } void -StyleSheet::SetOwningDocument(nsIDocument* aDocument) +StyleSheet::SetAssociatedDocument(nsIDocument* aDocument, + DocumentAssociationMode aAssociationMode) { - MOZ_STYLO_FORWARD(SetOwningDocument, (aDocument)) + MOZ_ASSERT(aDocument); + MOZ_STYLO_FORWARD(SetAssociatedDocument, (aDocument, aAssociationMode)) +} + +void +StyleSheet::ClearAssociatedDocument() +{ + MOZ_STYLO_FORWARD(SetAssociatedDocument, (nullptr, NotOwnedByDocument)); } StyleSheet* diff --git a/layout/style/crashtests/1017798-1.html b/layout/style/crashtests/1017798-1.html index 097217d18..0460c8756 100644 --- a/layout/style/crashtests/1017798-1.html +++ b/layout/style/crashtests/1017798-1.html @@ -50,27 +50,27 @@ gaia_switch/examples/index.html from the Gaia repository. window.GaiaSwitch = (function(win) { // Extend from the HTMLElement prototype - var proto = Object.create(HTMLElement.prototype); + class GaiaSwitch extends HTMLElement { + connectedCallback() { + var shadow = this.createShadowRoot(); + this._template = template.content.cloneNode(true); + this._input = this._template.querySelector('input[type="checkbox"]'); + + var checked = this.getAttribute('checked'); + if (checked !== null) { + this._input.checked = true; + } - proto.createdCallback = function() { - var shadow = this.createShadowRoot(); - this._template = template.content.cloneNode(true); - this._input = this._template.querySelector('input[type="checkbox"]'); + shadow.appendChild(this._template); - var checked = this.getAttribute('checked'); - if (checked !== null) { - this._input.checked = true; + ComponentUtils.style.call(this, ''); } - - shadow.appendChild(this._template); - - ComponentUtils.style.call(this, ''); }; /** * Proxy the checked property to the input element. */ - Object.defineProperty( proto, 'checked', { + Object.defineProperty( GaiaSwitch.prototype, 'checked', { get: function() { return this._input.checked; }, @@ -82,7 +82,7 @@ window.GaiaSwitch = (function(win) { /** * Proxy the name property to the input element. */ - Object.defineProperty( proto, 'name', { + Object.defineProperty( GaiaSwitch.prototype, 'name', { get: function() { return this.getAttribute('name'); }, diff --git a/layout/style/crashtests/786108-2.html b/layout/style/crashtests/786108-2.html index 1b2892040..df9fe7844 100644 --- a/layout/style/crashtests/786108-2.html +++ b/layout/style/crashtests/786108-2.html @@ -6,7 +6,7 @@ // are reported from CSS embedded in a file with a long data URI. Addressed // by 786108; should finish quickly with that patch and run for a very long // time otherwise. This version is designed for slow / memory constrained - // platforms like Android. + // platforms. var img = new Array; img.push('<img src="data:image/svg+xml,'); diff --git a/layout/style/moz.build b/layout/style/moz.build index bdc86ee99..7f08fc236 100644 --- a/layout/style/moz.build +++ b/layout/style/moz.build @@ -1,5 +1,4 @@ # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: # 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/. @@ -87,6 +86,7 @@ EXPORTS.mozilla += [ 'CSSVariableValues.h', 'DeclarationBlock.h', 'DeclarationBlockInlines.h', + 'DocumentStyleRootIterator.h', 'HandleRefPtr.h', 'IncrementalClearCOMRuleArray.h', 'LayerAnimationInfo.h', @@ -150,6 +150,7 @@ SOURCES += [ 'CSSVariableResolver.cpp', 'CSSVariableValues.cpp', 'Declaration.cpp', + 'DocumentStyleRootIterator.cpp', 'ErrorReporter.cpp', 'FontFace.cpp', 'FontFaceSet.cpp', diff --git a/layout/style/nsAnimationManager.cpp b/layout/style/nsAnimationManager.cpp index 268117738..718870985 100644 --- a/layout/style/nsAnimationManager.cpp +++ b/layout/style/nsAnimationManager.cpp @@ -1,4 +1,3 @@ -/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ /* 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/. */ @@ -11,7 +10,6 @@ #include "mozilla/EffectSet.h" #include "mozilla/MemoryReporting.h" #include "mozilla/StyleAnimationValue.h" -#include "mozilla/dom/AnimationEffectReadOnly.h" #include "mozilla/dom/DocumentTimeline.h" #include "mozilla/dom/KeyframeEffectReadOnly.h" @@ -31,7 +29,6 @@ using namespace mozilla; using namespace mozilla::css; using mozilla::dom::Animation; using mozilla::dom::AnimationPlayState; -using mozilla::dom::AnimationEffectReadOnly; using mozilla::dom::KeyframeEffectReadOnly; using mozilla::dom::CSSAnimation; @@ -369,7 +366,7 @@ UpdateOldAnimationPropertiesWithNew( // Update the old from the new so we can keep the original object // identity (and any expando properties attached to it). if (aOld.GetEffect()) { - AnimationEffectReadOnly* oldEffect = aOld.GetEffect(); + dom::AnimationEffectReadOnly* oldEffect = aOld.GetEffect(); animationChanged = oldEffect->SpecifiedTiming() != aNewTiming; oldEffect->SetSpecifiedTiming(aNewTiming); diff --git a/layout/style/nsAnimationManager.h b/layout/style/nsAnimationManager.h index d838d090a..a2846e5cc 100644 --- a/layout/style/nsAnimationManager.h +++ b/layout/style/nsAnimationManager.h @@ -1,4 +1,3 @@ -/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ /* 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/. */ diff --git a/layout/style/nsCSSDataBlock.cpp b/layout/style/nsCSSDataBlock.cpp index 1dfdaed0e..33c309dd4 100644 --- a/layout/style/nsCSSDataBlock.cpp +++ b/layout/style/nsCSSDataBlock.cpp @@ -1,5 +1,4 @@ /* -*- 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/. */ diff --git a/layout/style/nsCSSDataBlock.h b/layout/style/nsCSSDataBlock.h index 76deaa911..b699c408b 100644 --- a/layout/style/nsCSSDataBlock.h +++ b/layout/style/nsCSSDataBlock.h @@ -1,5 +1,4 @@ /* -*- 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/. */ diff --git a/layout/style/nsCSSKeywordList.h b/layout/style/nsCSSKeywordList.h index 86ba59142..689ff47eb 100644 --- a/layout/style/nsCSSKeywordList.h +++ b/layout/style/nsCSSKeywordList.h @@ -509,6 +509,7 @@ CSS_KEY(scrollbar, scrollbar) CSS_KEY(scrollbar-small, scrollbar_small) CSS_KEY(scrollbar-horizontal, scrollbar_horizontal) CSS_KEY(scrollbar-vertical, scrollbar_vertical) +CSS_KEY(scrollbar-width, scrollbar_width) CSS_KEY(se-resize, se_resize) CSS_KEY(select-after, select_after) CSS_KEY(select-all, select_all) diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index a8ed48894..0f1b04a17 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=2 et sw=2 tw=78: */ /* 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/. */ @@ -15328,17 +15327,17 @@ CSSParserImpl::ParseFontFeatureSettings(nsCSSValue& aValue) return true; } -bool -CSSParserImpl::ParseFontVariationSettings(nsCSSValue& aValue) -{ - // TODO: Actually implement this. - - // This stub is here because websites insist on considering this - // very hardware-dependent and O.S.-variable low-level font-control - // as a "critical feature" which it isn't as there is 0 guarantee - // that font variation settings are supported or honored by any - // operating system used by the client. - return true; +bool
+CSSParserImpl::ParseFontVariationSettings(nsCSSValue& aValue)
+{
+ // TODO: Actually implement this.
+
+ // This stub is here because websites insist on considering this
+ // very hardware-dependent and O.S.-variable low-level font-control
+ // as a "critical feature" which it isn't as there is 0 guarantee
+ // that font variation settings are supported or honored by any
+ // operating system used by the client.
+ return true;
} bool diff --git a/layout/style/nsCSSPropAliasList.h b/layout/style/nsCSSPropAliasList.h index 334f3b1ac..4f2a6e6b6 100644 --- a/layout/style/nsCSSPropAliasList.h +++ b/layout/style/nsCSSPropAliasList.h @@ -1,4 +1,3 @@ -/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ /* 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/. */ diff --git a/layout/style/nsCSSPropList.h b/layout/style/nsCSSPropList.h index 658ea68d7..e78dafcc5 100644 --- a/layout/style/nsCSSPropList.h +++ b/layout/style/nsCSSPropList.h @@ -3709,6 +3709,16 @@ CSS_PROP_DISPLAY( kScrollSnapTypeKTable, CSS_PROP_NO_OFFSET, eStyleAnimType_Discrete) +CSS_PROP_USERINTERFACE( + scrollbar-width, + scrollbar_width, + ScrollbarWidth, + CSS_PROPERTY_PARSE_VALUE, + "layout.css.scrollbar-width.enabled", + VARIANT_HK, + kScrollbarWidthKTable, + CSS_PROP_NO_OFFSET, + eStyleAnimType_Discrete) CSS_PROP_DISPLAY( shape-outside, shape_outside, diff --git a/layout/style/nsCSSProps.cpp b/layout/style/nsCSSProps.cpp index e0cda2488..b6ffe7952 100644 --- a/layout/style/nsCSSProps.cpp +++ b/layout/style/nsCSSProps.cpp @@ -2009,6 +2009,12 @@ const KTableEntry nsCSSProps::kScrollSnapTypeKTable[] = { { eCSSKeyword_UNKNOWN, -1 } }; +const KTableEntry nsCSSProps::kScrollbarWidthKTable[] = { + { eCSSKeyword_auto, StyleScrollbarWidth::Auto }, + { eCSSKeyword_thin, StyleScrollbarWidth::Thin }, + { eCSSKeyword_none, StyleScrollbarWidth::None } +}; + const KTableEntry nsCSSProps::kStackSizingKTable[] = { { eCSSKeyword_ignore, NS_STYLE_STACK_SIZING_IGNORE }, { eCSSKeyword_stretch_to_fit, NS_STYLE_STACK_SIZING_STRETCH_TO_FIT }, diff --git a/layout/style/nsCSSProps.h b/layout/style/nsCSSProps.h index 34d457c08..7b8c56860 100644 --- a/layout/style/nsCSSProps.h +++ b/layout/style/nsCSSProps.h @@ -856,6 +856,7 @@ public: static const KTableEntry kRubyPositionKTable[]; static const KTableEntry kScrollBehaviorKTable[]; static const KTableEntry kScrollSnapTypeKTable[]; + static const KTableEntry kScrollbarWidthKTable[]; static const KTableEntry kSpeakKTable[]; static const KTableEntry kSpeakHeaderKTable[]; static const KTableEntry kSpeakNumeralKTable[]; diff --git a/layout/style/nsCSSPseudoClassList.h b/layout/style/nsCSSPseudoClassList.h index ec7bfcb77..7f620ec32 100644 --- a/layout/style/nsCSSPseudoClassList.h +++ b/layout/style/nsCSSPseudoClassList.h @@ -92,9 +92,6 @@ CSS_PSEUDO_CLASS(nthLastOfType, ":nth-last-of-type", 0, "") // Match nodes that are HTML but not XHTML CSS_PSEUDO_CLASS(mozIsHTML, ":-moz-is-html", 0, "") -// Match all custom elements whose created callback has not yet been invoked - CSS_STATE_PSEUDO_CLASS(unresolved, ":unresolved", 0, "", NS_EVENT_STATE_UNRESOLVED) - // Matches nodes that are in a native-anonymous subtree (i.e., nodes in // a subtree of C++ anonymous content constructed by Gecko for its own // purposes). @@ -213,6 +210,19 @@ CSS_STATE_PSEUDO_CLASS(mozMathIncrementScriptLevel, ":-moz-math-increment-script-level", 0, "", NS_EVENT_STATE_INCREMENT_SCRIPT_LEVEL) +CSS_STATE_PSEUDO_CLASS(mozHasDirAttr, ":-moz-has-dir-attr", + CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS, "", + NS_EVENT_STATE_HAS_DIR_ATTR) +CSS_STATE_PSEUDO_CLASS(mozDirAttrLTR, ":-moz-dir-attr-ltr", + CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS, "", + NS_EVENT_STATE_DIR_ATTR_LTR) +CSS_STATE_PSEUDO_CLASS(mozDirAttrRTL, ":-moz-dir-attr-rtl", + CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS, "", + NS_EVENT_STATE_DIR_ATTR_RTL) +CSS_STATE_PSEUDO_CLASS(mozDirAttrLikeAuto, ":-moz-dir-attr-like-auto", + CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS, "", + NS_EVENT_STATE_DIR_ATTR_LIKE_AUTO) + // CSS 3 UI // http://www.w3.org/TR/2004/CR-css3-ui-20040511/#pseudo-classes CSS_STATE_PSEUDO_CLASS(required, ":required", 0, "", NS_EVENT_STATE_REQUIRED) diff --git a/layout/style/nsCSSPseudoElements.h b/layout/style/nsCSSPseudoElements.h index acf818a2c..22c744ad0 100644 --- a/layout/style/nsCSSPseudoElements.h +++ b/layout/style/nsCSSPseudoElements.h @@ -36,6 +36,10 @@ #define CSS_PSEUDO_ELEMENT_SUPPORTS_USER_ACTION_STATE (1<<3) // Is content prevented from parsing selectors containing this pseudo-element? #define CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY (1<<4) +// Can we use the ChromeOnly document.createElement(..., { pseudo: "::foo" }) +// API for creating pseudo-implementing native anonymous content in JS with this +// pseudo-element? +#define CSS_PSEUDO_ELEMENT_IS_JS_CREATED_NAC (1<<5) namespace mozilla { @@ -98,6 +102,11 @@ public: static bool PseudoElementSupportsUserActionState(const Type aType); + static bool PseudoElementIsJSCreatedNAC(Type aType) + { + return PseudoElementHasFlags(aType, CSS_PSEUDO_ELEMENT_IS_JS_CREATED_NAC); + } + static bool IsEnabled(Type aType, EnabledState aEnabledState) { return !PseudoElementHasFlags(aType, CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY) || @@ -106,15 +115,6 @@ public: private: // Does the given pseudo-element have all of the flags given? - - // Work around https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64037 , - // which is a general gcc bug that we seem to have hit only on Android/x86. -#if defined(ANDROID) && defined(__i386__) && defined(__GNUC__) && \ - !defined(__clang__) -#if (MOZ_GCC_VERSION_AT_MOST(4,9,2)) - __attribute__((noinline)) -#endif -#endif static bool PseudoElementHasFlags(const Type aType, uint32_t aFlags) { MOZ_ASSERT(aType < Type::Count); diff --git a/layout/style/nsCSSRules.cpp b/layout/style/nsCSSRules.cpp index 4b90b6f0c..dc79e471d 100644 --- a/layout/style/nsCSSRules.cpp +++ b/layout/style/nsCSSRules.cpp @@ -1515,6 +1515,13 @@ nsCSSFontFaceStyleDecl::GetParentObject() return ContainingRule()->GetDocument(); } +DocGroup* +nsCSSFontFaceStyleDecl::GetDocGroup() const +{ + nsIDocument* document = ContainingRule()->GetDocument(); + return document ? document->GetDocGroup() : nullptr; +} + JSObject* nsCSSFontFaceStyleDecl::WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto) { @@ -1991,6 +1998,17 @@ nsCSSKeyframeStyleDeclaration::GetParentObject() return mRule ? mRule->GetDocument() : nullptr; } +DocGroup* +nsCSSKeyframeStyleDeclaration::GetDocGroup() const +{ + if (!mRule) { + return nullptr; + } + + nsIDocument* document = mRule->GetDocument(); + return document ? document->GetDocGroup() : nullptr; +} + // ------------------------------------------- // nsCSSKeyframeRule // @@ -2538,6 +2556,17 @@ nsCSSPageStyleDeclaration::GetParentObject() return mRule ? mRule->GetDocument() : nullptr; } +DocGroup* +nsCSSPageStyleDeclaration::GetDocGroup() const +{ + if (!mRule) { + return nullptr; + } + + nsIDocument* document = mRule->GetDocument(); + return document ? document->GetDocGroup() : nullptr; +} + // ------------------------------------------- // nsCSSPageRule // diff --git a/layout/style/nsCSSRules.h b/layout/style/nsCSSRules.h index daefaf3f9..1c6361c3e 100644 --- a/layout/style/nsCSSRules.h +++ b/layout/style/nsCSSRules.h @@ -39,6 +39,10 @@ class nsMediaList; namespace mozilla { +namespace dom { +class DocGroup; +} // namespace dom + class ErrorResult; namespace css { @@ -209,6 +213,7 @@ public: using nsICSSDeclaration::GetPropertyCSSValue; virtual nsINode *GetParentObject() override; + virtual mozilla::dom::DocGroup* GetDocGroup() const override; virtual void IndexedGetter(uint32_t aIndex, bool& aFound, nsAString& aPropName) override; nsresult GetPropertyValue(nsCSSFontDesc aFontDescID, @@ -366,6 +371,7 @@ public: nsICSSDeclaration) virtual nsINode* GetParentObject() override; + virtual mozilla::dom::DocGroup* GetDocGroup() const override; protected: virtual ~nsCSSKeyframeStyleDeclaration(); @@ -496,6 +502,7 @@ public: nsICSSDeclaration) virtual nsINode *GetParentObject() override; + virtual mozilla::dom::DocGroup* GetDocGroup() const override; protected: virtual ~nsCSSPageStyleDeclaration(); diff --git a/layout/style/nsCSSValue.cpp b/layout/style/nsCSSValue.cpp index 0a905a055..40d804b02 100644 --- a/layout/style/nsCSSValue.cpp +++ b/layout/style/nsCSSValue.cpp @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=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/. */ diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index bbad9c371..7ac5fa604 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -1,5 +1,4 @@ /* -*- 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/. */ @@ -640,6 +639,34 @@ nsComputedDOMStyle::SetFrameStyleContext(nsStyleContext* aContext) mStyleContext = aContext; } +/** + * The following function checks whether we need to explicitly resolve the style + * again, even though we have a style context coming from the frame. + * + * This basically checks whether the style is or may be under a ::first-line or + * ::first-letter frame, in which case we can't return the frame style, and we + * need to resolve it. See bug 505515. + */ +static bool +MustReresolveStyle(const nsStyleContext* aContext) +{ + MOZ_ASSERT(aContext); + + if (aContext->HasPseudoElementData()) { + if (!aContext->GetPseudo() || + aContext->StyleSource().IsServoComputedValues()) { + // TODO(emilio): When ::first-line is supported in Servo, we may want to + // fix this to avoid re-resolving pseudo-element styles. + return true; + } + + return aContext->GetParent() && + aContext->GetParent()->HasPseudoElementData(); + } + + return false; +} + void nsComputedDOMStyle::UpdateCurrentStyleSources(bool aNeedsLayoutFlush) { @@ -692,9 +719,20 @@ nsComputedDOMStyle::UpdateCurrentStyleSources(bool aNeedsLayoutFlush) // XXX the !mElement->IsHTMLElement(nsGkAtoms::area) // check is needed due to bug 135040 (to avoid using // mPrimaryFrame). Remove it once that's fixed. - if (!mPseudo && mStyleType == eAll && - !mElement->IsHTMLElement(nsGkAtoms::area)) { - mOuterFrame = mElement->GetPrimaryFrame(); + if (mStyleType == eAll && !mElement->IsHTMLElement(nsGkAtoms::area)) { + mOuterFrame = nullptr; + + if (!mPseudo) { + mOuterFrame = mElement->GetPrimaryFrame(); + } else if (mPseudo == nsCSSPseudoElements::before || + mPseudo == nsCSSPseudoElements::after) { + nsIAtom* property = mPseudo == nsCSSPseudoElements::before + ? nsGkAtoms::beforePseudoProperty + : nsGkAtoms::afterPseudoProperty; + + auto* pseudo = static_cast<Element*>(mElement->GetProperty(property)); + mOuterFrame = pseudo ? pseudo->GetPrimaryFrame() : nullptr; + } mInnerFrame = mOuterFrame; if (mOuterFrame) { nsIAtom* type = mOuterFrame->GetType(); @@ -713,13 +751,15 @@ nsComputedDOMStyle::UpdateCurrentStyleSources(bool aNeedsLayoutFlush) } } - if (!mStyleContext || mStyleContext->HasPseudoElementData()) { + if (!mStyleContext || MustReresolveStyle(mStyleContext)) { #ifdef DEBUG if (mStyleContext) { // We want to check that going through this path because of // HasPseudoElementData is rare, because it slows us down a good // bit. So check that we're really inside something associated - // with a pseudo-element that contains elements. + // with a pseudo-element that contains elements. (We also allow + // the element to be NAC, just in case some chrome JS calls + // getComputedStyle on a NAC-implemented pseudo.) nsStyleContext* topWithPseudoElementData = mStyleContext; while (topWithPseudoElementData->GetParent()->HasPseudoElementData()) { topWithPseudoElementData = topWithPseudoElementData->GetParent(); @@ -730,7 +770,8 @@ nsComputedDOMStyle::UpdateCurrentStyleSources(bool aNeedsLayoutFlush) NS_LITERAL_STRING("we should be in a pseudo-element that is expected to contain elements (")); assertMsg.Append(nsDependentString(pseudoAtom->GetUTF16String())); assertMsg.Append(')'); - NS_ASSERTION(nsCSSPseudoElements::PseudoElementContainsElements(pseudo), + NS_ASSERTION(nsCSSPseudoElements::PseudoElementContainsElements(pseudo) || + mElement->IsNativeAnonymous(), NS_LossyConvertUTF16toASCII(assertMsg).get()); } #endif @@ -3264,6 +3305,16 @@ nsComputedDOMStyle::DoGetScrollSnapTypeY() return val.forget(); } +already_AddRefed<CSSValue>
+nsComputedDOMStyle::DoGetScrollbarWidth()
+{
+ RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
+ val->SetIdent(
+ nsCSSProps::ValueToKeywordEnum(StyleUserInterface()->mScrollbarWidth,
+ nsCSSProps::kScrollbarWidthKTable));
+ return val.forget();
+} + already_AddRefed<CSSValue> nsComputedDOMStyle::GetScrollSnapPoints(const nsStyleCoord& aCoord) { diff --git a/layout/style/nsComputedDOMStyle.h b/layout/style/nsComputedDOMStyle.h index 79c7ed519..38a61e23c 100644 --- a/layout/style/nsComputedDOMStyle.h +++ b/layout/style/nsComputedDOMStyle.h @@ -27,6 +27,7 @@ namespace mozilla { namespace dom { +class DocGroup; class Element; } // namespace dom struct ComputedGridTrackInfo; @@ -84,6 +85,11 @@ public: return mElement; } + virtual mozilla::dom::DocGroup* GetDocGroup() const override + { + return mElement ? mElement->GetDocGroup() : nullptr; + } + static already_AddRefed<nsStyleContext> GetStyleContextForElement(mozilla::dom::Element* aElement, nsIAtom* aPseudo, nsIPresShell* aPresShell, @@ -486,6 +492,7 @@ private: already_AddRefed<CSSValue> DoGetCursor(); already_AddRefed<CSSValue> DoGetForceBrokenImageIcon(); already_AddRefed<CSSValue> DoGetIMEMode(); + already_AddRefed<CSSValue> DoGetScrollbarWidth(); already_AddRefed<CSSValue> DoGetUserFocus(); already_AddRefed<CSSValue> DoGetUserInput(); already_AddRefed<CSSValue> DoGetUserModify(); diff --git a/layout/style/nsComputedDOMStylePropertyList.h b/layout/style/nsComputedDOMStylePropertyList.h index 6a18a7ad0..ec223cda4 100644 --- a/layout/style/nsComputedDOMStylePropertyList.h +++ b/layout/style/nsComputedDOMStylePropertyList.h @@ -226,6 +226,7 @@ COMPUTED_STYLE_PROP(scroll_snap_points_x, ScrollSnapPointsX) COMPUTED_STYLE_PROP(scroll_snap_points_y, ScrollSnapPointsY) COMPUTED_STYLE_PROP(scroll_snap_type_x, ScrollSnapTypeX) COMPUTED_STYLE_PROP(scroll_snap_type_y, ScrollSnapTypeY) +COMPUTED_STYLE_PROP(scrollbar_width, ScrollbarWidth) COMPUTED_STYLE_PROP(shape_outside, ShapeOutside) //// COMPUTED_STYLE_PROP(size, Size) COMPUTED_STYLE_PROP(tab_size, TabSize) diff --git a/layout/style/nsDOMCSSAttrDeclaration.cpp b/layout/style/nsDOMCSSAttrDeclaration.cpp index f94998478..652bd4ad1 100644 --- a/layout/style/nsDOMCSSAttrDeclaration.cpp +++ b/layout/style/nsDOMCSSAttrDeclaration.cpp @@ -183,6 +183,12 @@ nsDOMCSSAttributeDeclaration::GetParentObject() return mElement; } +/* virtual */ DocGroup* +nsDOMCSSAttributeDeclaration::GetDocGroup() const +{ + return mElement ? mElement->OwnerDoc()->GetDocGroup() : nullptr; +} + NS_IMETHODIMP nsDOMCSSAttributeDeclaration::SetPropertyValue(const nsCSSPropertyID aPropID, const nsAString& aValue) diff --git a/layout/style/nsDOMCSSAttrDeclaration.h b/layout/style/nsDOMCSSAttrDeclaration.h index 7c0fbacc0..482d665ea 100644 --- a/layout/style/nsDOMCSSAttrDeclaration.h +++ b/layout/style/nsDOMCSSAttrDeclaration.h @@ -35,6 +35,8 @@ public: NS_IMETHOD GetParentRule(nsIDOMCSSRule **aParent) override; virtual nsINode* GetParentObject() override; + typedef mozilla::dom::DocGroup DocGroup; + virtual DocGroup* GetDocGroup() const override; NS_IMETHOD SetPropertyValue(const nsCSSPropertyID aPropID, const nsAString& aValue) override; diff --git a/layout/style/nsDOMCSSDeclaration.cpp b/layout/style/nsDOMCSSDeclaration.cpp index bd6c6069d..51ce8c335 100644 --- a/layout/style/nsDOMCSSDeclaration.cpp +++ b/layout/style/nsDOMCSSDeclaration.cpp @@ -267,7 +267,7 @@ nsDOMCSSDeclaration::GetCSSParsingEnvironmentForRule(css::Rule* aRule, return; } - nsIDocument* document = sheet->GetOwningDocument(); + nsIDocument* document = sheet->GetAssociatedDocument(); aCSSParseEnv.mSheetURI = sheet->GetSheetURI(); aCSSParseEnv.mBaseURI = sheet->GetBaseURI(); aCSSParseEnv.mPrincipal = sheet->Principal(); diff --git a/layout/style/nsHTMLCSSStyleSheet.cpp b/layout/style/nsHTMLCSSStyleSheet.cpp index f5e8cde0b..9b3bd65fb 100644 --- a/layout/style/nsHTMLCSSStyleSheet.cpp +++ b/layout/style/nsHTMLCSSStyleSheet.cpp @@ -1,5 +1,4 @@ /* -*- 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/. */ diff --git a/layout/style/nsICSSDeclaration.h b/layout/style/nsICSSDeclaration.h index ff6ec4a78..fa80c17f5 100644 --- a/layout/style/nsICSSDeclaration.h +++ b/layout/style/nsICSSDeclaration.h @@ -31,6 +31,11 @@ #include "nsCOMPtr.h" class nsINode; +namespace mozilla { +namespace dom { +class DocGroup; +} // namespace dom +} // namespace mozilla // dbeabbfa-6cb3-4f5c-aec2-dd558d9d681f #define NS_ICSSDECLARATION_IID \ @@ -62,6 +67,7 @@ public: const nsAString& aValue) = 0; virtual nsINode *GetParentObject() = 0; + virtual mozilla::dom::DocGroup* GetDocGroup() const = 0; // Also have to declare all the nsIDOMCSSStyleDeclaration methods, // since we want to be able to call them from the WebIDL versions. diff --git a/layout/style/nsLayoutStylesheetCache.cpp b/layout/style/nsLayoutStylesheetCache.cpp index e8c6d09d7..bf87b006c 100644 --- a/layout/style/nsLayoutStylesheetCache.cpp +++ b/layout/style/nsLayoutStylesheetCache.cpp @@ -1,5 +1,4 @@ /* -*- 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/. */ @@ -122,11 +121,6 @@ nsLayoutStylesheetCache::UASheet() StyleSheet* nsLayoutStylesheetCache::HTMLSheet() { - if (!mHTMLSheet) { - LoadSheetURL("resource://gre-resources/html.css", - &mHTMLSheet, eAgentSheetFeatures, eCrash); - } - return mHTMLSheet; } @@ -322,6 +316,8 @@ nsLayoutStylesheetCache::nsLayoutStylesheetCache(StyleBackendType aType) // per-profile, since they're profile-invariant. LoadSheetURL("resource://gre-resources/counterstyles.css", &mCounterStylesSheet, eAgentSheetFeatures, eCrash); + LoadSheetURL("resource://gre-resources/html.css", + &mHTMLSheet, eAgentSheetFeatures, eCrash); LoadSheetURL("chrome://global/content/minimal-xul.css", &mMinimalXULSheet, eAgentSheetFeatures, eCrash); LoadSheetURL("resource://gre-resources/quirk.css", @@ -382,8 +378,6 @@ nsLayoutStylesheetCache::For(StyleBackendType aType) // "layout.css.example-pref.enabled"); Preferences::RegisterCallback(&DependentPrefChanged, "layout.css.grid.enabled"); - Preferences::RegisterCallback(&DependentPrefChanged, - "dom.details_element.enabled"); } return cache; @@ -555,7 +549,6 @@ nsLayoutStylesheetCache::DependentPrefChanged(const char* aPref, void* aData) gStyleCache_Servo ? &gStyleCache_Servo->sheet_ : nullptr); INVALIDATE(mUASheet); // for layout.css.grid.enabled - INVALIDATE(mHTMLSheet); // for dom.details_element.enabled #undef INVALIDATE } diff --git a/layout/style/nsLayoutStylesheetCache.h b/layout/style/nsLayoutStylesheetCache.h index 48391cc7a..70ab5e88d 100644 --- a/layout/style/nsLayoutStylesheetCache.h +++ b/layout/style/nsLayoutStylesheetCache.h @@ -1,5 +1,4 @@ /* -*- 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/. */ diff --git a/layout/style/nsMediaFeatures.cpp b/layout/style/nsMediaFeatures.cpp index f33f8dd33..e44003ce4 100644 --- a/layout/style/nsMediaFeatures.cpp +++ b/layout/style/nsMediaFeatures.cpp @@ -1,5 +1,4 @@ /* -*- 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/. */ diff --git a/layout/style/nsMediaFeatures.h b/layout/style/nsMediaFeatures.h index 76e94837d..f6c4b5806 100644 --- a/layout/style/nsMediaFeatures.h +++ b/layout/style/nsMediaFeatures.h @@ -1,5 +1,4 @@ /* -*- 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/. */ diff --git a/layout/style/nsROCSSPrimitiveValue.cpp b/layout/style/nsROCSSPrimitiveValue.cpp index 2721bd609..e72c16b5f 100644 --- a/layout/style/nsROCSSPrimitiveValue.cpp +++ b/layout/style/nsROCSSPrimitiveValue.cpp @@ -1,5 +1,4 @@ /* -*- 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/. */ diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp index 8b0dd9bbb..04715aa99 100644 --- a/layout/style/nsRuleNode.cpp +++ b/layout/style/nsRuleNode.cpp @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=2 et sw=2 tw=78: */ /* 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/. */ @@ -425,7 +424,7 @@ static nsSize CalcViewportUnitsScale(nsPresContext* aPresContext) nsIScrollableFrame* scrollFrame = aPresContext->PresShell()->GetRootScrollFrameAsScrollable(); if (scrollFrame) { - ScrollbarStyles styles(scrollFrame->GetScrollbarStyles()); + ScrollStyles styles(scrollFrame->GetScrollStyles()); if (styles.mHorizontal == NS_STYLE_OVERFLOW_SCROLL || styles.mVertical == NS_STYLE_OVERFLOW_SCROLL) { @@ -1395,6 +1394,7 @@ struct SetEnumValueHelper DEFINE_ENUM_CLASS_SETTER(StyleFillRule, Nonzero, Evenodd) DEFINE_ENUM_CLASS_SETTER(StyleFloat, None, InlineEnd) DEFINE_ENUM_CLASS_SETTER(StyleFloatEdge, ContentBox, MarginBox) + DEFINE_ENUM_CLASS_SETTER(StyleScrollbarWidth, Auto, None) DEFINE_ENUM_CLASS_SETTER(StyleTextJustify, None, InterCharacter) DEFINE_ENUM_CLASS_SETTER(StyleUserFocus, None, SelectMenu) DEFINE_ENUM_CLASS_SETTER(StyleUserSelect, None, MozText) @@ -5236,6 +5236,14 @@ nsRuleNode::ComputeUserInterfaceData(void* aStartStruct, // caret-color: auto, color, inherit setComplexColor(aRuleData->ValueForCaretColor(), &nsStyleUserInterface::mCaretColor); + + // scrollbar-width: auto, thin, none + SetValue(*aRuleData->ValueForScrollbarWidth(), + ui->mScrollbarWidth, + conditions, + SETVAL_ENUMERATED, + parentUI->mScrollbarWidth, + StyleScrollbarWidth::Auto); COMPUTE_END_INHERITED(UserInterface, ui) } diff --git a/layout/style/nsStyleConsts.h b/layout/style/nsStyleConsts.h index e6a0cc65a..308a66647 100644 --- a/layout/style/nsStyleConsts.h +++ b/layout/style/nsStyleConsts.h @@ -187,6 +187,13 @@ enum class StyleFloatEdge : uint8_t { MarginBox, }; +// scrollbar-width +enum class StyleScrollbarWidth : uint8_t { + Auto, + Thin, + None, +}; + // shape-box for shape-outside enum class StyleShapeOutsideShapeBox : uint8_t { NoBox, diff --git a/layout/style/nsStyleSet.cpp b/layout/style/nsStyleSet.cpp index 414eee4d4..558b9fa7f 100644 --- a/layout/style/nsStyleSet.cpp +++ b/layout/style/nsStyleSet.cpp @@ -734,7 +734,7 @@ nsStyleSet::AddDocStyleSheet(CSSStyleSheet* aSheet, nsIDocument* aDocument) bool present = sheets.RemoveElement(aSheet); - size_t index = aDocument->FindDocStyleSheetInsertionPoint(sheets, aSheet); + size_t index = aDocument->FindDocStyleSheetInsertionPoint(sheets, *aSheet); sheets.InsertElementAt(index, aSheet); if (!present) { diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp index a2b6833ac..acf287ea8 100644 --- a/layout/style/nsStyleStruct.cpp +++ b/layout/style/nsStyleStruct.cpp @@ -1,5 +1,4 @@ /* -*- 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/. */ @@ -3265,7 +3264,7 @@ nsStyleDisplay::CalcDifference(const nsStyleDisplay& aNewData) const if (mOverflowX != aNewData.mOverflowX || mOverflowY != aNewData.mOverflowY) { - hint |= nsChangeHint_CSSOverflowChange; + hint |= nsChangeHint_ScrollbarChange; } /* Note: When mScrollBehavior, mScrollSnapTypeX, mScrollSnapTypeY, @@ -4025,6 +4024,7 @@ nsStyleUserInterface::nsStyleUserInterface(StyleStructContext aContext) , mPointerEvents(NS_STYLE_POINTER_EVENTS_AUTO) , mCursor(NS_STYLE_CURSOR_AUTO) , mCaretColor(StyleComplexColor::Auto()) + , mScrollbarWidth(StyleScrollbarWidth::Auto) { MOZ_COUNT_CTOR(nsStyleUserInterface); } @@ -4037,6 +4037,7 @@ nsStyleUserInterface::nsStyleUserInterface(const nsStyleUserInterface& aSource) , mCursor(aSource.mCursor) , mCursorImages(aSource.mCursorImages) , mCaretColor(aSource.mCaretColor) + , mScrollbarWidth(aSource.mScrollbarWidth) { MOZ_COUNT_CTOR(nsStyleUserInterface); } @@ -4088,6 +4089,13 @@ nsStyleUserInterface::CalcDifference(const nsStyleUserInterface& aNewData) const if (mCaretColor != aNewData.mCaretColor) { hint |= nsChangeHint_RepaintFrame; } + + if (mScrollbarWidth != aNewData.mScrollbarWidth) { + // For scrollbar-width change, we need some special handling similar + // to overflow properties. Specifically, we may need to reconstruct + // the scrollbar or force reflow of the viewport scrollbar. + hint |= nsChangeHint_ScrollbarChange; + } return hint; } diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h index c948d6056..35ff071a5 100644 --- a/layout/style/nsStyleStruct.h +++ b/layout/style/nsStyleStruct.h @@ -1,5 +1,4 @@ /* -*- 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/. */ @@ -3418,6 +3417,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleUserInterface uint8_t mCursor; // [inherited] See nsStyleConsts.h nsTArray<nsCursorImage> mCursorImages; // [inherited] images and coords mozilla::StyleComplexColor mCaretColor; // [inherited] + mozilla::StyleScrollbarWidth mScrollbarWidth; inline uint8_t GetEffectivePointerEvents(nsIFrame* aFrame) const; }; diff --git a/layout/style/nsStyleStructInlines.h b/layout/style/nsStyleStructInlines.h index 9cb5e1a8a..63ad921ed 100644 --- a/layout/style/nsStyleStructInlines.h +++ b/layout/style/nsStyleStructInlines.h @@ -1,4 +1,3 @@ -/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ /* 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/. */ diff --git a/layout/style/nsStyleUtil.cpp b/layout/style/nsStyleUtil.cpp index 5f51192bd..9c3c0f449 100644 --- a/layout/style/nsStyleUtil.cpp +++ b/layout/style/nsStyleUtil.cpp @@ -8,6 +8,7 @@ #include "nsIContent.h" #include "nsCSSProps.h" +#include "nsContentUtils.h" #include "nsRuleNode.h" #include "nsROCSSPrimitiveValue.h" #include "nsStyleStruct.h" @@ -15,7 +16,6 @@ #include "nsIContentSecurityPolicy.h" #include "nsIURI.h" #include "nsPrintfCString.h" -#include "nsContentUtils.h" using namespace mozilla; diff --git a/layout/style/nsTransitionManager.cpp b/layout/style/nsTransitionManager.cpp index a317f9943..027ae8b38 100644 --- a/layout/style/nsTransitionManager.cpp +++ b/layout/style/nsTransitionManager.cpp @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ /* 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/. */ @@ -44,7 +43,6 @@ using mozilla::dom::CSSTransition; using mozilla::dom::KeyframeEffectReadOnly; using namespace mozilla; -using namespace mozilla::dom; using namespace mozilla::css; namespace { @@ -379,7 +377,7 @@ CSSTransition::HasLowerCompositeOrderThan(const CSSTransition& aOther) const } /* static */ Nullable<TimeDuration> -CSSTransition::GetCurrentTimeAt(const DocumentTimeline& aTimeline, +CSSTransition::GetCurrentTimeAt(const dom::DocumentTimeline& aTimeline, const TimeStamp& aBaseTime, const TimeDuration& aStartTime, double aPlaybackRate) @@ -396,7 +394,7 @@ CSSTransition::GetCurrentTimeAt(const DocumentTimeline& aTimeline, } void -CSSTransition::SetEffectFromStyle(AnimationEffectReadOnly* aEffect) +CSSTransition::SetEffectFromStyle(dom::AnimationEffectReadOnly* aEffect) { Animation::SetEffectNoUpdate(aEffect); diff --git a/layout/style/nsTransitionManager.h b/layout/style/nsTransitionManager.h index 1c48cc8cd..af7b6c611 100644 --- a/layout/style/nsTransitionManager.h +++ b/layout/style/nsTransitionManager.h @@ -1,4 +1,3 @@ -/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ /* 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/. */ diff --git a/layout/style/res/forms.css b/layout/style/res/forms.css index e7566e183..db75151d4 100644 --- a/layout/style/res/forms.css +++ b/layout/style/res/forms.css @@ -1100,6 +1100,7 @@ input[type=number]::-moz-number-spin-box { } input[type=number]::-moz-number-spin-up { + writing-mode: horizontal-tb; -moz-appearance: spinner-upbutton; display: block; /* bug 926670 */ flex: none; @@ -1117,6 +1118,7 @@ input[type=number]::-moz-number-spin-up { } input[type=number]::-moz-number-spin-down { + writing-mode: horizontal-tb; -moz-appearance: spinner-downbutton; display: block; /* bug 926670 */ flex: none; diff --git a/layout/style/res/html.css b/layout/style/res/html.css index b975bf0c9..066aab397 100644 --- a/layout/style/res/html.css +++ b/layout/style/res/html.css @@ -7,18 +7,18 @@ /* bidi */ -[dir] { +:-moz-has-dir-attr { unicode-bidi: isolate; } -[dir="rtl"] { +:-moz-dir-attr-rtl { direction: rtl; } -[dir="ltr"] { +:-moz-dir-attr-ltr { direction: ltr; } -bdi:dir(ltr), [dir="auto"]:dir(ltr) { direction: ltr; } -bdi:dir(rtl), [dir="auto"]:dir(rtl) { direction: rtl; } +:-moz-dir-attr-like-auto:dir(ltr) { direction: ltr; } +:-moz-dir-attr-like-auto:dir(rtl) { direction: rtl; } /* To ensure http://www.w3.org/TR/REC-html40/struct/dirlang.html#style-bidi: * @@ -88,10 +88,15 @@ xmp { bdi, output { unicode-bidi: isolate; } -bdo, bdo[dir] { +/* We need the "bdo:-moz-has-dir-attr" bit because "bdo" has lower + specificity than the ":-moz-has-dir-attr" selector above. */ +bdo, bdo:-moz-has-dir-attr { unicode-bidi: isolate-override; } -textarea[dir="auto"], pre[dir="auto"] { unicode-bidi: plaintext; } +textarea:-moz-dir-attr-like-auto, +pre:-moz-dir-attr-like-auto { + unicode-bidi: plaintext; +} /* blocks */ diff --git a/layout/style/res/ua.css b/layout/style/res/ua.css index ab51f67c5..a8425d472 100644 --- a/layout/style/res/ua.css +++ b/layout/style/res/ua.css @@ -474,3 +474,9 @@ div:-moz-native-anonymous.moz-custom-content-container { width: 100%; height: 100%; } + +/* Shadow DOM v1 + * https://drafts.csswg.org/css-scoping/#slots-in-shadow-tree */ +slot { + display: contents; +}
\ No newline at end of file diff --git a/layout/style/test/ListCSSProperties.cpp b/layout/style/test/ListCSSProperties.cpp index 9f727104b..5e0405bb5 100644 --- a/layout/style/test/ListCSSProperties.cpp +++ b/layout/style/test/ListCSSProperties.cpp @@ -1,4 +1,3 @@ -/* vim: set shiftwidth=4 tabstop=8 autoindent cindent expandtab: */ /* 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/. */ diff --git a/layout/style/test/chrome/chrome.ini b/layout/style/test/chrome/chrome.ini index e34fce671..c3e1e5130 100644 --- a/layout/style/test/chrome/chrome.ini +++ b/layout/style/test/chrome/chrome.ini @@ -1,5 +1,4 @@ [DEFAULT] -skip-if = os == 'android' support-files = bug418986-2.js bug535806-css.css @@ -10,6 +9,7 @@ support-files = mismatch.png [test_author_specified_style.html] +[test_bug1346623.html] [test_bug418986-2.xul] [test_bug1157097.html] [test_bug1160724.xul] diff --git a/layout/style/test/chrome/test_bug1346623.html b/layout/style/test/chrome/test_bug1346623.html new file mode 100644 index 000000000..d24d66646 --- /dev/null +++ b/layout/style/test/chrome/test_bug1346623.html @@ -0,0 +1,60 @@ +<!DOCTYPE HTML> +<html> +<head> + <title>Test for bug 1346623</title> + <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> + <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> + <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/> +</head> +<body onload="startTest();"> +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1346623">Mozilla Bug 1346623</a> +<div id="display"> + +</div> +<pre id="test"> +<script type="application/javascript"> + +var Ci = Components.interfaces; +var winUtils = window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils); + +function startTest() { + // load some styles at the agent level + var css = ` + #ac-parent { color: green; } + #ac-child.abc { } + `; + var sheetURL = "data:text/css," + encodeURIComponent(css); + winUtils.loadSheetUsingURIString(sheetURL, winUtils.AGENT_SHEET); + + // add canvas anonymous content + var bq = document.createElement("blockquote"); + bq.id = "ac-parent"; + bq.textContent = "This blockquote text should be green."; + var div = document.createElement("div"); + div.id = "ac-child"; + div.textContent = " This div text should be green."; + bq.appendChild(div); + var ac = document.insertAnonymousContent(bq); + document.body.offsetWidth; + + is(ac.getComputedStylePropertyValue("ac-child", "color"), "rgb(0, 128, 0)", + "color before reframing"); + + // reframe the root + document.documentElement.style.display = "flex"; + document.body.offsetWidth; + + // restyle the div + ac.setAttributeForElement("ac-child", "class", "abc"); + document.body.offsetWidth; + + is(ac.getComputedStylePropertyValue("ac-child", "color"), "rgb(0, 128, 0)", + "color after reframing"); + SimpleTest.finish(); +} + +SimpleTest.waitForExplicitFinish(); +</script> +</pre> +</body> +</html> diff --git a/layout/style/test/descriptor_database.js b/layout/style/test/descriptor_database.js index da672d03b..2af5ef922 100644 --- a/layout/style/test/descriptor_database.js +++ b/layout/style/test/descriptor_database.js @@ -1,5 +1,4 @@ /* -*- tab-width: 4; indent-tabs-mode: nil; js-indent-level: 4 -*- */ -/* vim: set shiftwidth=4 tabstop=4 autoindent cindent noexpandtab: */ /* 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/. */ diff --git a/layout/style/test/flexbox_layout_testcases.js b/layout/style/test/flexbox_layout_testcases.js index 719583630..63adfe04a 100644 --- a/layout/style/test/flexbox_layout_testcases.js +++ b/layout/style/test/flexbox_layout_testcases.js @@ -1,5 +1,4 @@ /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ts=2 sw=2 sts=2 et: */ /* * This Source Code is subject to the terms of the Mozilla Public License diff --git a/layout/style/test/mochitest.ini b/layout/style/test/mochitest.ini index 8182691ca..8b36e3e1e 100644 --- a/layout/style/test/mochitest.ini +++ b/layout/style/test/mochitest.ini @@ -1,4 +1,7 @@ [DEFAULT] +prefs = + dom.animations-api.core.enabled=true + dom.animations-api.timelines.enabled=true support-files = animation_utils.js ccd-quirks.html @@ -41,7 +44,6 @@ support-files = additional_sheets_helper.html support-files = additional_sheets_helper.html [test_all_shorthand.html] [test_animations.html] -skip-if = toolkit == 'android' [test_animations_async_tests.html] support-files = ../../reftests/fonts/Ahem.ttf file_animations_async_tests.html [test_animations_dynamic_changes.html] @@ -85,7 +87,6 @@ support-files = file_animations_with_disabled_properties.html [test_bug373293.html] [test_bug377947.html] [test_bug379440.html] -skip-if = toolkit == 'android' [test_bug379741.html] [test_bug382027.html] [test_bug383075.html] @@ -99,7 +100,6 @@ skip-if = toolkit == 'android' skip-if = true # Bug 701060 [test_bug405818.html] [test_bug412901.html] -skip-if = android_version == '18' # bug 1147986 [test_bug413958.html] [test_bug418986-2.html] [test_bug437915.html] @@ -152,7 +152,6 @@ support-files = file_bug1089417_iframe.html [test_change_hint_optimizations.html] [test_clip-path_polygon.html] [test_compute_data_with_start_struct.html] -skip-if = toolkit == 'android' [test_computed_style.html] [test_computed_style_min_size_auto.html] [test_computed_style_no_pseudo.html] @@ -163,7 +162,6 @@ skip-if = toolkit == 'android' [test_counter_descriptor_storage.html] [test_counter_style.html] [test_css_cross_domain.html] -skip-if = toolkit == 'android' #bug 536603 [test_css_eof_handling.html] [test_css_escape_api.html] [test_css_function_mismatched_parenthesis.html] @@ -205,16 +203,13 @@ support-files = [test_html_attribute_computed_values.html] [test_ident_escaping.html] [test_inherit_computation.html] -skip-if = toolkit == 'android' [test_inherit_storage.html] [test_initial_computation.html] -skip-if = toolkit == 'android' [test_initial_storage.html] [test_keyframes_rules.html] [test_load_events_on_stylesheets.html] [test_logical_properties.html] [test_media_queries.html] -skip-if = android_version == '18' #debug-only failure; timed out #Android 4.3 aws only; bug 1030419 [test_media_queries_dynamic.html] [test_media_queries_dynamic_xbl.html] [test_media_query_list.html] @@ -245,7 +240,6 @@ support-files = redundant_font_download.sjs [test_rule_serialization.html] [test_rules_out_of_sheets.html] [test_selectors.html] -skip-if = toolkit == 'android' #bug 775227 [test_selectors_on_anonymous_content.html] [test_setPropertyWithNull.html] [test_shorthand_property_getters.html] @@ -264,11 +258,9 @@ skip-if = toolkit == 'android' #bug 775227 [test_transitions_computed_value_combinations.html] [test_transitions_events.html] [test_transitions.html] -skip-if = (android_version == '18' && debug) # bug 1159532 [test_transitions_bug537151.html] [test_transitions_dynamic_changes.html] [test_transitions_per_property.html] -skip-if = toolkit == 'android' #bug 775227 [test_transitions_replacement_on_busy_frame.html] support-files = file_transitions_replacement_on_busy_frame.html [test_transitions_step_functions.html] @@ -286,9 +278,7 @@ support-files = unprefixing_service_iframe.html unprefixing_service_utils.js [test_unprefixing_service_prefs.html] support-files = unprefixing_service_iframe.html unprefixing_service_utils.js [test_value_cloning.html] -skip-if = toolkit == 'android' #bug 775227 [test_value_computation.html] -skip-if = toolkit == 'android' [test_value_storage.html] [test_variable_serialization_computed.html] [test_variable_serialization_specified.html] @@ -298,15 +288,10 @@ support-files = support/external-variable-url.css [test_viewport_scrollbar_causing_reflow.html] [test_viewport_units.html] [test_visited_image_loading.html] -skip-if = toolkit == 'android' #TIMED_OUT [test_visited_image_loading_empty.html] -skip-if = toolkit == 'android' #TIMED_OUT [test_visited_lying.html] -skip-if = toolkit == 'android' #TIMED_OUT [test_visited_pref.html] -skip-if = toolkit == 'android' #TIMED_OUT [test_visited_reftests.html] -skip-if = toolkit == 'android' #TIMED_OUT [test_webkit_device_pixel_ratio.html] [test_webkit_flex_display.html] [test_asyncopen2.html] diff --git a/layout/style/test/moz.build b/layout/style/test/moz.build index ca61f607a..4ae0e44b4 100644 --- a/layout/style/test/moz.build +++ b/layout/style/test/moz.build @@ -1,5 +1,4 @@ # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: # 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/. diff --git a/layout/style/test/property_database.js b/layout/style/test/property_database.js index 6b1ef5602..1d5dc989f 100644 --- a/layout/style/test/property_database.js +++ b/layout/style/test/property_database.js @@ -1,5 +1,4 @@ /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ts=2 sw=2 sts=2 et: */ /* 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/. */ @@ -7945,6 +7944,18 @@ for (var prop in gCSSProperties) { } } +if (IsCSSPropertyPrefEnabled("layout.css.scrollbar-width.enabled")) { + gCSSProperties["scrollbar-width"] = { + domProp: "scrollbarWidth", + inherited: false, + type: CSS_TYPE_LONGHAND, + initial_values: [ "auto" ], + other_values: [ "none", "thin" ], + invalid_values: [ "1px" ] + }; +} + + if (false) { // TODO These properties are chrome-only, and are not exposed via CSSOM. // We may still want to find a way to test them. See bug 1206999. diff --git a/layout/style/test/test_cascade.html b/layout/style/test/test_cascade.html index 0a5d27a8b..b2836d25c 100644 --- a/layout/style/test/test_cascade.html +++ b/layout/style/test/test_cascade.html @@ -1,5 +1,4 @@ <!DOCTYPE HTML> -<!-- vim: set shiftwidth=4 tabstop=8 autoindent expandtab: --> <!-- 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/. --> diff --git a/layout/style/test/test_pseudoelement_state.html b/layout/style/test/test_pseudoelement_state.html index ad4bf5242..bdc4dc8f2 100644 --- a/layout/style/test/test_pseudoelement_state.html +++ b/layout/style/test/test_pseudoelement_state.html @@ -8,8 +8,6 @@ <iframe src="data:text/html,<!DOCTYPE html><style></style><div></div>"></iframe> <script> -var gIsAndroid = navigator.appVersion.indexOf("Android") != -1; - var gTests = [ // Interact with the ::-moz-progress-bar. { markup: '<progress value="75" max="100"></progress>', @@ -124,29 +122,23 @@ function runTests() { is(countPixelDifferences(canvas1, canvas2), 0, "hover subtest #" + aIndex + ", number of different pixels"); is(getComputedStyle(div.firstChild, test.pseudoelement).backgroundColor, "rgb(0, 128, 0)", "hover subtest #" + aIndex + ", computed style"); - if (!gIsAndroid) { - style.textContent = test.common_style + test.active_test_style; - synthesizeMouseAtCenter(div.lastChild, { type: 'mousedown' }, iframe.contentWindow); - } + style.textContent = test.common_style + test.active_test_style; + synthesizeMouseAtCenter(div.lastChild, { type: 'mousedown' }, iframe.contentWindow); } function runTestPart4(aIndex) { - if (!gIsAndroid) { - var test = gTests[aIndex]; - canvas1 = SpecialPowers.snapshotWindow(iframe.contentWindow, false); - synthesizeMouseAtCenter(div.lastChild, { type: 'mouseup' }, iframe.contentWindow); - style.textContent = test.common_style + test.active_reference_style; - } + var test = gTests[aIndex]; + canvas1 = SpecialPowers.snapshotWindow(iframe.contentWindow, false); + synthesizeMouseAtCenter(div.lastChild, { type: 'mouseup' }, iframe.contentWindow); + style.textContent = test.common_style + test.active_reference_style; } function runTestPart5(aIndex) { - if (!gIsAndroid) { - var test = gTests[aIndex]; - canvas2 = SpecialPowers.snapshotWindow(iframe.contentWindow, false); - ok(canvas1.width == canvas2.width && canvas1.height == canvas2.height, "active subtest #" + aIndex + ", canvas sizes equal"); - is(countPixelDifferences(canvas1, canvas2), 0, "active subtest #" + aIndex + ", number of different pixels"); - is(getComputedStyle(div.firstChild, test.pseudoelement).backgroundColor, "rgb(0, 255, 0)", "active subtest #" + aIndex + ", computed style"); - } + var test = gTests[aIndex]; + canvas2 = SpecialPowers.snapshotWindow(iframe.contentWindow, false); + ok(canvas1.width == canvas2.width && canvas1.height == canvas2.height, "active subtest #" + aIndex + ", canvas sizes equal"); + is(countPixelDifferences(canvas1, canvas2), 0, "active subtest #" + aIndex + ", number of different pixels"); + is(getComputedStyle(div.firstChild, test.pseudoelement).backgroundColor, "rgb(0, 255, 0)", "active subtest #" + aIndex + ", computed style"); } for (var i = 0; i < gTests.length; i++) { diff --git a/layout/style/test/test_rule_insertion.html b/layout/style/test/test_rule_insertion.html index a55ec08c5..90886973a 100644 --- a/layout/style/test/test_rule_insertion.html +++ b/layout/style/test/test_rule_insertion.html @@ -99,9 +99,7 @@ var innerRuleInfo = [ if (aException) { return false; } - if (navigator.oscpu.match(/Linux/) || - navigator.oscpu.match(/Android/) || - SpecialPowers.Services.appinfo.name == "B2G") { + if (navigator.oscpu.match(/Linux/)) { return true; } return Math.abs(width - (aApplied ? monospaceWidth : serifWidth)) <= 1; // bug 769194 prevents local() diff --git a/layout/style/test/test_value_storage.html b/layout/style/test/test_value_storage.html index 5e7fa6b69..1ca3bd510 100644 --- a/layout/style/test/test_value_storage.html +++ b/layout/style/test/test_value_storage.html @@ -91,24 +91,6 @@ var gComputedStyle = window.getComputedStyle(gElement, ""); var gPrereqDeclaration = document.getElementById("prereqsheet").sheet.cssRules[0].style; -// On Android, avoid most 'TEST-PASS' logging by overriding -// SimpleTest.is/isnot, to improve performance -if (navigator.appVersion.indexOf("Android") >= 0) { - is = function is(a, b, name) - { - var pass = Object.is(a, b); - if (!pass) - SimpleTest.is(a, b, name); - } - - isnot = function isnot(a, b, name) - { - var pass = !Object.is(a, b); - if (!pass) - SimpleTest.isnot(a, b, name); - } -} - // Returns true if propA and propB are equivalent, considering aliasing. // (i.e. if one is an alias of the other, or if they're both aliases of // the same 3rd property) |