mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-29 10:32:23 +00:00
import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1230398 - [css-align] Don't output 'unsafe' in serialization because it's the default. r=dholbert (08d36e767d) - Bug 1234707: Make nsDOMCSSValueList::AppendCSSValue() take an already_AddRefed arg (instead of a raw pointer, usually with refcount of 0). r=heycam (739fa75d70) - Bug 1234676 part 1: Give nsComputedDOMStyle a private typedef for mozilla::dom::CSSValue. r=heycam (6371627bf3) - Bug 1234676 part 2: Make nsComputedDOMStyle getters return an already_AddRefed value, instead of a raw pointer with refcount of 0. r=heycam (e196aa9692) - Bug 1234676 part 3: Remove some now-unneeded local RefPtr variables. r=heycam (b780ed3246) - Bug 1234676 part 4: Remove now-obsolete comment. r=heycam (2d982ed55b) - Bug 1234676 part 5: Update indentation & rewrap some nsComputedDOMStyle function-decls. rs=heycam (0b02962fac) - Bug 1233106 part 1 - [css-align] Update align-/justify-* properties to the current CSS Align spec (adding 'normal' keyword, dropping 'auto' in some cases etc). r=dholbert (8558089c51) - Bug 1233106 part 2 - [css-align] Updated tests due to changes to align-/justify-* properties. (c407114303) - Bug 1118820 - Follow-up: disable the grid-repeat-auto-fill-fit-006.html reftest for now since it triggers a leak: bug 1234644. r=me (8802927b37) - Bug 1234644 - [css-grid] Avoid calling GetROCSSValueList() when we don't need the allocated object. r=dholbert (e8b4f7295a) - Bug 1230172. Update CSS.escape to never throw and instead replace U+0000 with U+FFFD, per recent spec change. r=dbaron (c66008388e) - Bug 1234659: Attempt to work around randomorange in test_bug332655-2.html by using an unthemed <input> widget. rs=jfkthame (84fa36d569) - Bug 1234535 - Avoid spurious null dereference complaint from Coverity. r=froydnj (804bdb1189) - Bug 1235737: Soften some MOZ_CRASH statements in flexbox layout code to MOZ_ASSERT_UNREACHABLE, which they were originally intended as anyway. r=mats (0a66b12c46) - Bug 1229932 - check that offsets to canvas fillText() are finite. r=jmuizelaar (cfa2fd240e) - Bug 1233613 - Add crashtest. r=mt (b49c56d5df) - Bug 1229983 - verify that paths are finite in DrawTargetSkia::Stroke/Fill to handle Canvas paths containing infs. r=jmuizelaar (79f3b8f225) - Bug 1233632 - Moz2Dify GetBlurAndSpreadRadius(). r=dholbert. (868800f95f) - Bug 1194856 - Load noscript.css and noframes.css from data: URLs in release builds. r=dbaron (7c009bcac2) - Bug 1234758 - Fix errors in preference style sheet focus ring rules. r=dholbert (501f4088cc) - Bug 1234773 - Build and parse preference style sheet as a single string. r=dholbert (82b848cb6a) - Bug 1234773 - Followup assertion. (aa916f246b)
This commit is contained in:
@@ -193,13 +193,7 @@ nsLayoutStylesheetCache::NoScriptSheet()
|
||||
EnsureGlobal();
|
||||
|
||||
if (!gStyleCache->mNoScriptSheet) {
|
||||
// If you update the data: URL, also update noscript.css (See bug 1194856.)
|
||||
LoadSheetURL(
|
||||
#ifdef RELEASE_BUILD
|
||||
"data:text/css,noscript { display%3A none !important%3B }",
|
||||
#else
|
||||
"resource://gre-resources/noscript.css",
|
||||
#endif
|
||||
LoadSheetURL("resource://gre-resources/noscript.css",
|
||||
gStyleCache->mNoScriptSheet, eAgentSheetFeatures);
|
||||
}
|
||||
|
||||
@@ -212,14 +206,7 @@ nsLayoutStylesheetCache::NoFramesSheet()
|
||||
EnsureGlobal();
|
||||
|
||||
if (!gStyleCache->mNoFramesSheet) {
|
||||
// If you update the data: URL, also update noframes.css (See bug 1194856.)
|
||||
LoadSheetURL(
|
||||
#ifdef RELEASE_BUILD
|
||||
"data:text/css,noframes { display%3A block%3B } "
|
||||
"frame%2C frameset%2C iframe { display%3A none !important%3B }",
|
||||
#else
|
||||
"resource://gre-resources/noframes.css",
|
||||
#endif
|
||||
LoadSheetURL("resource://gre-resources/noframes.css",
|
||||
gStyleCache->mNoFramesSheet, eAgentSheetFeatures);
|
||||
}
|
||||
|
||||
@@ -817,25 +804,6 @@ nsLayoutStylesheetCache::InvalidatePreferenceSheets()
|
||||
gStyleCache->mChromePreferenceSheet = nullptr;
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
nsLayoutStylesheetCache::AppendPreferenceRule(CSSStyleSheet* aSheet,
|
||||
const nsAString& aString)
|
||||
{
|
||||
uint32_t result;
|
||||
aSheet->InsertRuleInternal(aString, aSheet->StyleRuleCount(), &result);
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
nsLayoutStylesheetCache::AppendPreferenceColorRule(CSSStyleSheet* aSheet,
|
||||
const char* aString,
|
||||
nscolor aColor)
|
||||
{
|
||||
nsAutoString rule;
|
||||
rule.AppendPrintf(
|
||||
aString, NS_GET_R(aColor), NS_GET_G(aColor), NS_GET_B(aColor));
|
||||
AppendPreferenceRule(aSheet, rule);
|
||||
}
|
||||
|
||||
void
|
||||
nsLayoutStylesheetCache::BuildPreferenceSheet(RefPtr<CSSStyleSheet>& aSheet,
|
||||
nsPresContext* aPresContext)
|
||||
@@ -849,29 +817,37 @@ nsLayoutStylesheetCache::BuildPreferenceSheet(RefPtr<CSSStyleSheet>& aSheet,
|
||||
aSheet->SetURIs(uri, uri, uri);
|
||||
aSheet->SetComplete();
|
||||
|
||||
AppendPreferenceRule(aSheet,
|
||||
NS_LITERAL_STRING("@namespace url(http://www.w3.org/1999/xhtml);"));
|
||||
AppendPreferenceRule(aSheet,
|
||||
NS_LITERAL_STRING("@namespace svg url(http://www.w3.org/2000/svg);"));
|
||||
static const uint32_t kPreallocSize = 1024;
|
||||
|
||||
nsString sheetText;
|
||||
sheetText.SetCapacity(kPreallocSize);
|
||||
|
||||
#define NS_GET_R_G_B(color_) \
|
||||
NS_GET_R(color_), NS_GET_G(color_), NS_GET_B(color_)
|
||||
|
||||
sheetText.AppendLiteral(
|
||||
"@namespace url(http://www.w3.org/1999/xhtml);\n"
|
||||
"@namespace svg url(http://www.w3.org/2000/svg);\n");
|
||||
|
||||
// Rules for link styling.
|
||||
nscolor linkColor = aPresContext->DefaultLinkColor();
|
||||
nscolor activeColor = aPresContext->DefaultActiveLinkColor();
|
||||
nscolor visitedColor = aPresContext->DefaultVisitedLinkColor();
|
||||
|
||||
AppendPreferenceColorRule(aSheet,
|
||||
"*|*:link { color: #%02x%02x%02x; }",
|
||||
aPresContext->DefaultLinkColor());
|
||||
AppendPreferenceColorRule(aSheet,
|
||||
"*|*:-moz-any-link:active { color: #%02x%02x%02x; }",
|
||||
aPresContext->DefaultActiveLinkColor());
|
||||
AppendPreferenceColorRule(aSheet,
|
||||
"*|*:visited { color: #%02x%02x%02x; }",
|
||||
aPresContext->DefaultVisitedLinkColor());
|
||||
sheetText.AppendPrintf(
|
||||
"*|*:link { color: #%02x%02x%02x; }\n"
|
||||
"*|*:-moz-any-link:active { color: #%02x%02x%02x; }\n"
|
||||
"*|*:visited { color: #%02x%02x%02x; }\n",
|
||||
NS_GET_R_G_B(linkColor),
|
||||
NS_GET_R_G_B(activeColor),
|
||||
NS_GET_R_G_B(visitedColor));
|
||||
|
||||
AppendPreferenceRule(aSheet,
|
||||
aPresContext->GetCachedBoolPref(kPresContext_UnderlineLinks) ?
|
||||
NS_LITERAL_STRING(
|
||||
"*|*:-moz-any-link:not(svg|a) { text-decoration: underline; }") :
|
||||
NS_LITERAL_STRING(
|
||||
"*|*:-moz-any-link{ text-decoration: none; }"));
|
||||
bool underlineLinks =
|
||||
aPresContext->GetCachedBoolPref(kPresContext_UnderlineLinks);
|
||||
sheetText.AppendPrintf(
|
||||
"*|*:-moz-any-link%s { text-decoration: %s; }\n",
|
||||
underlineLinks ? ":not(svg|a)" : "",
|
||||
underlineLinks ? "underline" : "none");
|
||||
|
||||
// Rules for focus styling.
|
||||
|
||||
@@ -883,54 +859,52 @@ nsLayoutStylesheetCache::BuildPreferenceSheet(RefPtr<CSSStyleSheet>& aSheet,
|
||||
if (focusRingWidth != 1) {
|
||||
// If the focus ring width is different from the default, fix buttons
|
||||
// with rings.
|
||||
nsString rule;
|
||||
rule.AppendPrintf(
|
||||
sheetText.AppendPrintf(
|
||||
"button::-moz-focus-inner, input[type=\"reset\"]::-moz-focus-inner, "
|
||||
"input[type=\"button\"]::-moz-focus-inner, "
|
||||
"input[type=\"submit\"]::-moz-focus-inner { "
|
||||
"padding: 1px 2px 1px 2px; "
|
||||
"border: %d %s transparent !important; }",
|
||||
"border: %dpx %s transparent !important; }\n",
|
||||
focusRingWidth,
|
||||
focusRingWidth == 0 ? (const char*) "solid" : (const char*) "dotted");
|
||||
AppendPreferenceRule(aSheet, rule);
|
||||
focusRingStyle == 0 ? "solid" : "dotted");
|
||||
|
||||
// NS_LITERAL_STRING doesn't work with concatenated string literals, hence
|
||||
// the newline escaping.
|
||||
AppendPreferenceRule(aSheet, NS_LITERAL_STRING("\
|
||||
button:focus::-moz-focus-inner, \
|
||||
input[type=\"reset\"]:focus::-moz-focus-inner, \
|
||||
input[type=\"button\"]:focus::-moz-focus-inner, \
|
||||
input[type=\"submit\"]:focus::-moz-focus-inner { \
|
||||
border-color: ButtonText !important; }"));
|
||||
sheetText.AppendLiteral(
|
||||
"button:focus::-moz-focus-inner, "
|
||||
"input[type=\"reset\"]:focus::-moz-focus-inner, "
|
||||
"input[type=\"button\"]:focus::-moz-focus-inner, "
|
||||
"input[type=\"submit\"]:focus::-moz-focus-inner { "
|
||||
"border-color: ButtonText !important; }\n");
|
||||
}
|
||||
|
||||
nsString rule;
|
||||
if (focusRingOnAnything) {
|
||||
rule.AppendLiteral(":focus");
|
||||
} else {
|
||||
rule.AppendLiteral("*|*:link:focus, *|*:visited:focus");
|
||||
}
|
||||
rule.AppendPrintf(" { outline: %dpx ", focusRingWidth);
|
||||
if (focusRingStyle == 0) { // solid
|
||||
rule.AppendLiteral("solid -moz-mac-focusring !important; "
|
||||
"-moz-outline-radius: 3px; outline-offset: 1px; }");
|
||||
} else {
|
||||
rule.AppendLiteral("dotted WindowText !important; }");
|
||||
}
|
||||
AppendPreferenceRule(aSheet, rule);
|
||||
sheetText.AppendPrintf(
|
||||
"%s { outline: %dpx %s !important; %s}\n",
|
||||
focusRingOnAnything ?
|
||||
":focus" :
|
||||
"*|*:link:focus, *|*:visited:focus",
|
||||
focusRingWidth,
|
||||
focusRingStyle == 0 ? // solid
|
||||
"solid -moz-mac-focusring" : "dotted WindowText",
|
||||
focusRingStyle == 0 ? // solid
|
||||
"-moz-outline-radius: 3px; outline-offset: 1px; " : "");
|
||||
}
|
||||
|
||||
if (aPresContext->GetUseFocusColors()) {
|
||||
nsString rule;
|
||||
nscolor focusText = aPresContext->FocusTextColor();
|
||||
nscolor focusBG = aPresContext->FocusBackgroundColor();
|
||||
rule.AppendPrintf(
|
||||
sheetText.AppendPrintf(
|
||||
"*:focus, *:focus > font { color: #%02x%02x%02x !important; "
|
||||
"background-color: #%02x%02x%02x !important; }",
|
||||
NS_GET_R(focusText), NS_GET_G(focusText), NS_GET_B(focusText),
|
||||
NS_GET_R(focusBG), NS_GET_G(focusBG), NS_GET_B(focusBG));
|
||||
AppendPreferenceRule(aSheet, rule);
|
||||
"background-color: #%02x%02x%02x !important; }\n",
|
||||
NS_GET_R_G_B(focusText),
|
||||
NS_GET_R_G_B(focusBG));
|
||||
}
|
||||
|
||||
NS_ASSERTION(sheetText.Length() <= kPreallocSize,
|
||||
"kPreallocSize should be big enough to build preference style "
|
||||
"sheet without reallocation");
|
||||
|
||||
aSheet->ReparseSheet(sheetText);
|
||||
|
||||
#undef NS_GET_R_G_B
|
||||
}
|
||||
|
||||
mozilla::StaticRefPtr<nsLayoutStylesheetCache>
|
||||
|
||||
Reference in New Issue
Block a user