diff --git a/application/basilisk/base/content/tabbrowser.css b/application/basilisk/base/content/tabbrowser.css index 9085304f6c..2d9b7dd903 100644 --- a/application/basilisk/base/content/tabbrowser.css +++ b/application/basilisk/base/content/tabbrowser.css @@ -39,12 +39,24 @@ display: -moz-box; } -.tab-label[pinned] { +.tab-label { + white-space: nowrap; +} + +.tab-label-container { + overflow: hidden; +} + +.tab-label-container[pinned] { width: 0; - margin-left: 0 !important; - margin-right: 0 !important; - padding-left: 0 !important; - padding-right: 0 !important; +} + +.tab-label-container[textoverflow]:not([pinned]) { + mask-image: linear-gradient(to left, transparent, black 1em); +} + +.tab-label-container[textoverflow]:not([pinned]):-moz-locale-dir(rtl) { + mask-image: linear-gradient(to right, transparent, black 1em); } .tab-stack { diff --git a/application/basilisk/base/content/tabbrowser.xml b/application/basilisk/base/content/tabbrowser.xml index 973415935c..9b4743a541 100644 --- a/application/basilisk/base/content/tabbrowser.xml +++ b/application/basilisk/base/content/tabbrowser.xml @@ -1400,8 +1400,7 @@ @@ -1411,7 +1410,6 @@ - + + + .toolbarbutton-menu-dropmarker { .tab-label { margin-top: 1px; margin-bottom: 0; + -moz-box-flex: 1; text-align: center; } @@ -2503,7 +2504,7 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker { opacity: 0.9999; } -.tab-label:not([selected="true"]) { +.tab-label-container:not([selected="true"]) { opacity: .7; } @@ -2529,7 +2530,7 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker { border-width: 0 11px; } -.tabbrowser-tab:focus > .tab-stack > .tab-content > .tab-label:not([pinned]), +.tabbrowser-tab:focus > .tab-stack > .tab-content > .tab-label-container:not([pinned]), .tabbrowser-tab:focus > .tab-stack > .tab-content > .tab-icon-image[pinned], .tabbrowser-tab:focus > .tab-stack > .tab-content > .tab-throbber[pinned] { box-shadow: @focusRingShadow@; diff --git a/application/basilisk/themes/shared/tabs.inc.css b/application/basilisk/themes/shared/tabs.inc.css index c505416e46..a69e9f4d58 100644 --- a/application/basilisk/themes/shared/tabs.inc.css +++ b/application/basilisk/themes/shared/tabs.inc.css @@ -192,7 +192,7 @@ } .tab-close-button { - margin-inline-start: 4px; + margin-inline-start: 2px; margin-inline-end: -2px; padding: 0; } diff --git a/application/palemoon/app/profile/palemoon.js b/application/palemoon/app/profile/palemoon.js index 687d79e626..e9324df95d 100644 --- a/application/palemoon/app/profile/palemoon.js +++ b/application/palemoon/app/profile/palemoon.js @@ -479,6 +479,10 @@ pref("browser.tabs.delayHidingAudioPlayingIconMS", 3000); // window is enabled. pref("browser.tabs.allowTabDetach", true); +// Whether to fade tab labels instead of using ellipses when cutting off +// long page titles. +pref("browser.tabs.fadeLabels", true); + pref("browser.allTabs.previews", true); pref("browser.allTabs.hidePinnedTabs", false); pref("browser.ctrlTab.previews", true); diff --git a/application/palemoon/base/content/browser.css b/application/palemoon/base/content/browser.css index af15a0e55f..9051d31f1b 100644 --- a/application/palemoon/base/content/browser.css +++ b/application/palemoon/base/content/browser.css @@ -82,6 +82,16 @@ tabbrowser { transition: transform 200ms ease-out; } +@supports -moz-bool-pref("browser.tabs.fadeLabels") { + .tabbrowser-tab .tab-text[_is_cropped] { + mask-image: linear-gradient(to left, transparent, black 2em); + } + + .tabbrowser-tab .tab-text[_is_cropped]:-moz-locale-dir(rtl) { + mask-image: linear-gradient(to right, transparent, black 2em); + } +} + #alltabs-popup { -moz-binding: url("chrome://browser/content/tabbrowser.xml#tabbrowser-alltabs-popup"); } diff --git a/application/palemoon/base/content/tabbrowser.xml b/application/palemoon/base/content/tabbrowser.xml index 35760e66c0..29c80e6a7f 100644 --- a/application/palemoon/base/content/tabbrowser.xml +++ b/application/palemoon/base/content/tabbrowser.xml @@ -1260,7 +1260,11 @@ @@ -1300,6 +1304,10 @@ title = this.mStringBundle.getString("tabs.emptyTabTitle"); } + if (Services.prefs.getBoolPref("browser.tabs.fadeLabels")) { + crop = "clip"; + } + if (aTab.label == title && aTab.crop == crop) return false; @@ -1527,7 +1535,11 @@ else t.setAttribute("label", aURI); - t.setAttribute("crop", "end"); + if (Services.prefs.getBoolPref("browser.tabs.fadeLabels")) { + t.setAttribute("crop", "clip"); + } else { + t.setAttribute("crop", "end"); + } t.setAttribute("validate", "never"); //PMed t.setAttribute("onerror", "this.removeAttribute('image');"); @@ -3611,7 +3623,11 @@ var tab = this.firstChild; tab.setAttribute("label", this.tabbrowser.mStringBundle.getString("tabs.emptyTabTitle")); - tab.setAttribute("crop", "end"); + if (Services.prefs.getBoolPref("browser.tabs.fadeLabels")) { + tab.setAttribute("crop", "clip"); + } else { + tab.setAttribute("crop", "end"); + } tab.setAttribute("onerror", "this.removeAttribute('image');"); this.adjustTabstrip(); diff --git a/application/palemoon/branding/shared/pref/uaoverrides.inc b/application/palemoon/branding/shared/pref/uaoverrides.inc index aa2cdc56da..ae541965e7 100644 --- a/application/palemoon/branding/shared/pref/uaoverrides.inc +++ b/application/palemoon/branding/shared/pref/uaoverrides.inc @@ -4,7 +4,7 @@ #define GRE_VERSION @MOZILLA_UAVERSION_U@ #define GRE_VERSION_SLICE Goanna/@GRE_VERSION@ -#define GRE_DATE_SLICE Goanna/20170101 +#define GRE_DATE_SLICE Goanna/20230101 #define PM_SLICE PaleMoon/@MOZ_APP_VERSION@ #define GK_VERSION @MOZILLA_COMPATVERSION_U@ @@ -23,9 +23,6 @@ pref("@GUAO_PREF@.aol.com","Mozilla/5.0 (%OS_SLICE% rv:@GK_VERSION@) @GK_SLICE@ pref("@GUAO_PREF@.bing.com","Mozilla/5.0 (%OS_SLICE% rv:@GK_VERSION@) @GK_SLICE@ @FX_SLICE@ (Pale Moon)"); pref("@GUAO_PREF@.chase.com","Mozilla/5.0 (%OS_SLICE% rv:79.0) @GK_SLICE@ Firefox/79.0"); pref("@GUAO_PREF@.dropbox.com","Mozilla/5.0 (%OS_SLICE% rv:68.9) @GK_SLICE@ Firefox/68.9 (Pale Moon)"); -pref("@GUAO_PREF@.google.com","Mozilla/5.0 (%OS_SLICE% rv:71.0) @GK_SLICE@ Firefox/71.0 @PM_SLICE@"); -pref("@GUAO_PREF@.googlevideos.com","Mozilla/5.0 (%OS_SLICE% rv:38.9) @GK_SLICE@ @GRE_VERSION_SLICE@ Firefox/38.9 @PM_SLICE@"); -pref("@GUAO_PREF@.gstatic.com","Mozilla/5.0 (%OS_SLICE% rv:71.0) @GK_SLICE@ Firefox/71.0 @PM_SLICE@"); pref("@GUAO_PREF@.kroger.com","Mozilla/5.0 (%OS_SLICE% rv:86.0) @GK_SLICE@ Firefox/86.0 (Pale Moon)"); pref("@GUAO_PREF@.live.com","Mozilla/5.0 (%OS_SLICE% rv:@GK_VERSION@) @GK_SLICE@ @FX_SLICE@ (Pale Moon)"); pref("@GUAO_PREF@.msn.com","Mozilla/5.0 (%OS_SLICE% rv:@GK_VERSION@) @GK_SLICE@ @FX_SLICE@ (Pale Moon)"); @@ -41,8 +38,6 @@ pref("@GUAO_PREF@.calendar.yahoo.com","Mozilla/5.0 (%OS_SLICE% rv:@GK_VERSION@) pref("@GUAO_PREF@.www.amazon.com","Mozilla/5.0 (%OS_SLICE% rv:45.9) @GK_SLICE@ Firefox/45.9 (Pale Moon)"); // Soundcloud uses Firefox-exclusive combinations of code. Never pass Firefox slice. pref("@GUAO_PREF@.soundcloud.com","Mozilla/5.0 (%OS_SLICE% rv:@GRE_VERSION@) @GRE_DATE_SLICE@ @PM_SLICE@"); -// Daily motion only likes strict Firefox UAs -pref("@GUAO_PREF@.dailymotion.com","Mozilla/5.0 (%OS_SLICE% rv:52.0) @GK_SLICE@ Firefox/52.0"); pref("@GUAO_PREF@.players.brightcove.net","Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko"); // Google fonts serves physically different fonts to later Firefox versions that render incorrectly unless on Gecko pref("@GUAO_PREF@.fonts.googleapis.com", "Mozilla/5.0 (%OS_SLICE% rv:61.9) Gecko/20100101 Firefox/61.9"); @@ -67,13 +62,12 @@ pref("@GUAO_PREF@.citi.com","Mozilla/5.0 (%OS_SLICE% rv:68.0) @GK_SLICE@ Firefox pref("@GUAO_PREF@.facebook.com","Mozilla/5.0 (%OS_SLICE% rv:68.0) @GK_SLICE@ Firefox/68.0 @PM_SLICE@"); pref("@GUAO_PREF@.netflix.com","Mozilla/5.0 (Windows NT 6.1; rv:45.9) @GK_SLICE@ Firefox/45.9"); pref("@GUAO_PREF@.netflximg.net","Mozilla/5.0 (Windows NT 6.1; rv:45.9) @GK_SLICE@ Firefox/45.9"); -pref("@GUAO_PREF@.mewe.com", "Mozilla/5.0 (%OS_SLICE% rv:102.0) Gecko/20100101 Firefox/102.0"); +pref("@GUAO_PREF@.mewe.com", "Mozilla/5.0 (%OS_SLICE% rv:@GK_VERSION@) @GK_SLICE@ @FX_SLICE@"); // UA-sniffing domains that are "app/vendor-specific" and do not like Pale Moon pref("@GUAO_PREF@.web.whatsapp.com","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"); -pref("@GUAO_PREF@.youtube.com","Mozilla/5.0 (%OS_SLICE% rv:60.0) @GK_SLICE@ Firefox/60.0"); -pref("@GUAO_PREF@.studio.youtube.com","Mozilla/5.0 (%OS_SLICE% rv:68.0) @GK_SLICE@ @GRE_VERSION_SLICE@ Firefox/68.0 @PM_SLICE@"); -pref("@GUAO_PREF@.gaming.youtube.com","Mozilla/5.0 (%OS_SLICE% rv:71.0) @GK_SLICE@ Firefox/71.0"); +pref("@GUAO_PREF@.youtube.com","Mozilla/5.0 (%OS_SLICE% rv:@GK_VERSION@) @GK_SLICE@ @FX_SLICE@"); +pref("@GUAO_PREF@.studio.youtube.com","Mozilla/5.0 (%OS_SLICE% rv:@GK_VERSION@) @GK_SLICE@ @GRE_VERSION_SLICE@ @FX_SLICE@ @PM_SLICE@"); // The following domains do not like the Goanna slice pref("@GUAO_PREF@.hitbox.tv","Mozilla/5.0 (%OS_SLICE% rv:@GK_VERSION@) @GK_SLICE@ @FX_SLICE@"); diff --git a/application/palemoon/components/sessionstore/SessionStore.jsm b/application/palemoon/components/sessionstore/SessionStore.jsm index 084af92240..3609037d93 100644 --- a/application/palemoon/components/sessionstore/SessionStore.jsm +++ b/application/palemoon/components/sessionstore/SessionStore.jsm @@ -3045,6 +3045,9 @@ var SessionStoreInternal = { tab.label = activePageData.url; tab.crop = "center"; } + if (this._prefBranch.getBoolPref("tabs.fadeLabels")) { + tab.crop = "clip"; + } } } diff --git a/dom/base/CustomElementRegistry.cpp b/dom/base/CustomElementRegistry.cpp index b97115e7c4..fdf90401ed 100644 --- a/dom/base/CustomElementRegistry.cpp +++ b/dom/base/CustomElementRegistry.cpp @@ -416,6 +416,95 @@ CustomElementRegistry::EnqueueLifecycleCallback(nsIDocument::ElementCallbackType reactionsStack->EnqueueCallbackReaction(aCustomElement, Move(callback)); } +namespace { + +class CandidateFinder +{ +public: + CandidateFinder(nsTArray&& aCandidates, nsIDocument* aDoc); + nsTArray> OrderedCandidates(); + +private: + bool Traverse(Element* aRoot, nsTArray>& aOrderedElements); + + nsCOMPtr mDoc; + nsInterfaceHashtable, Element> mCandidates; +}; + +CandidateFinder::CandidateFinder(nsTArray&& aCandidates, + nsIDocument* aDoc) + : mDoc(aDoc) + , mCandidates(aCandidates.Length()) +{ + MOZ_ASSERT(mDoc); + for (auto& candidate : aCandidates) { + nsCOMPtr elem = do_QueryReferent(candidate); + if (!elem) { + continue; + } + + Element* key = elem.get(); + mCandidates.Put(key, elem.forget()); + } +} + +nsTArray> +CandidateFinder::OrderedCandidates() +{ + if (mCandidates.Count() == 1) { + // Fast path for one candidate. + for (auto iter = mCandidates.Iter(); !iter.Done(); iter.Next()) { + nsTArray> rval({ Move(iter.Data()) }); + iter.Remove(); + return rval; + } + } + + nsTArray> orderedElements(mCandidates.Count()); + for (Element* child = mDoc->GetFirstElementChild(); child; child = child->GetNextElementSibling()) { + if (!Traverse(child->AsElement(), orderedElements)) { + break; + } + } + + return orderedElements; +} + +bool +CandidateFinder::Traverse(Element* aRoot, nsTArray>& aOrderedElements) +{ + nsCOMPtr elem = mCandidates.Get(aRoot); + if (elem) { + mCandidates.Remove(aRoot); + aOrderedElements.AppendElement(Move(elem)); + if (mCandidates.Count() == 0) { + return false; + } + } + + if (ShadowRoot* root = aRoot->GetShadowRoot()) { + // First iterate the children of the shadow root if aRoot is a shadow host. + for (Element* child = root->GetFirstElementChild(); child; + child = child->GetNextElementSibling()) { + if (!Traverse(child, aOrderedElements)) { + return false; + } + } + } + + // Iterate the explicit children of aRoot. + for (Element* child = aRoot->GetFirstElementChild(); child; + child = child->GetNextElementSibling()) { + if (!Traverse(child, aOrderedElements)) { + return false; + } + } + + return true; +} + +} + void CustomElementRegistry::UpgradeCandidates(nsIAtom* aKey, CustomElementDefinition* aDefinition, @@ -427,18 +516,13 @@ CustomElementRegistry::UpgradeCandidates(nsIAtom* aKey, return; } - // TODO: Bug 1326028 - Upgrade custom element in shadow-including tree order nsAutoPtr> candidates; mCandidatesMap.RemoveAndForget(aKey, candidates); if (candidates) { CustomElementReactionsStack* reactionsStack = docGroup->CustomElementReactionsStack(); - for (size_t i = 0; i < candidates->Length(); ++i) { - nsCOMPtr elem = do_QueryReferent(candidates->ElementAt(i)); - if (!elem) { - continue; - } - + CandidateFinder finder(Move(*candidates), mWindow->GetExtantDoc()); + for (auto& elem : finder.OrderedCandidates()) { reactionsStack->EnqueueUpgradeReaction(elem, aDefinition); } } diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index ff92947a3c..9ac61802d9 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -1239,8 +1239,11 @@ pref("privacy.trackingprotection.pbmode.enabled", false); pref("dom.event.contextmenu.enabled", true); pref("dom.event.clipboardevents.enabled", true); +// TODO: merge these two prefs! // Enable Google WebComponents? pref("dom.webcomponents.enabled", true); +// Whether WC getRootNode is available +pref("dom.getRootNode.enabled", true); pref("javascript.enabled", true); // Enable Array.prototype.values @@ -4614,9 +4617,6 @@ pref("dom.push.http2.reset_retry_count_after_ms", 60000); pref("dom.push.http2.maxRetries", 2); pref("dom.push.http2.retryInterval", 5000); -// Whether WC getRootNode is available -pref("dom.getRootNode.enabled", false); - // WebNetworkStats pref("dom.mozNetworkStats.enabled", false); diff --git a/xpcom/glue/nsInterfaceHashtable.h b/xpcom/glue/nsInterfaceHashtable.h index 54a5b79cd6..cdd36924ec 100644 --- a/xpcom/glue/nsInterfaceHashtable.h +++ b/xpcom/glue/nsInterfaceHashtable.h @@ -52,6 +52,21 @@ public: * @return The entry, or nullptr if not found. Do not release this pointer! */ Interface* GetWeak(KeyType aKey, bool* aFound = nullptr) const; + + /** + * Allows inserting a value into the hashtable, moving its owning reference + * count into the hashtable, avoiding an AddRef. + */ + void Put(KeyType aKey, already_AddRefed&& aData) + { + if (!Put(aKey, mozilla::Move(aData), mozilla::fallible)) { + NS_ABORT_OOM(this->mTable.EntrySize() * this->mTable.EntryCount()); + } + } + + MOZ_MUST_USE bool Put(KeyType aKey, already_AddRefed&& aData, + const mozilla::fallible_t&); + using base_type::Put; }; template @@ -138,4 +153,19 @@ nsInterfaceHashtable::GetWeak(KeyType aKey, return nullptr; } +template +bool +nsInterfaceHashtable::Put(KeyType aKey, + already_AddRefed&& aValue, + const mozilla::fallible_t&) +{ + typename base_type::EntryType* ent = this->PutEntry(aKey); + if (!ent) { + return false; + } + + ent->mData = aValue; + return true; +} + #endif // nsInterfaceHashtable_h__