gecko_dev_content.patch (bluegriffon-3.0.1) | : | gecko_dev_content.patch (bluegriffon-3.1) | ||
---|---|---|---|---|
skipping to change at line 1436 | skipping to change at line 1436 | |||
@@ -836,6 +837,8 @@ CSSEditUtils::GenerateCSSDeclarationsFromHTMLStyle( | @@ -836,6 +837,8 @@ CSSEditUtils::GenerateCSSDeclarationsFromHTMLStyle( | |||
equivTable = underlineEquivTable; | equivTable = underlineEquivTable; | |||
} else if (nsGkAtoms::strike == aHTMLProperty) { | } else if (nsGkAtoms::strike == aHTMLProperty) { | |||
equivTable = strikeEquivTable; | equivTable = strikeEquivTable; | |||
+ } else if (nsGkAtoms::nobr == aHTMLProperty) { | + } else if (nsGkAtoms::nobr == aHTMLProperty) { | |||
+ equivTable = nowrapEquivTable; | + equivTable = nowrapEquivTable; | |||
} else if (nsGkAtoms::tt == aHTMLProperty) { | } else if (nsGkAtoms::tt == aHTMLProperty) { | |||
equivTable = ttEquivTable; | equivTable = ttEquivTable; | |||
} else if (aAttribute) { | } else if (aAttribute) { | |||
diff --git a/editor/libeditor/EditorBase.cpp b/editor/libeditor/EditorBase.cpp | diff --git a/editor/libeditor/EditorBase.cpp b/editor/libeditor/EditorBase.cpp | |||
index a845b69aabd2..a7b278c9ed3f 100644 | index a845b69aabd2..4c120782e3f1 100644 | |||
--- a/editor/libeditor/EditorBase.cpp | --- a/editor/libeditor/EditorBase.cpp | |||
+++ b/editor/libeditor/EditorBase.cpp | +++ b/editor/libeditor/EditorBase.cpp | |||
@@ -104,6 +104,7 @@ | @@ -104,6 +104,7 @@ | |||
#include "nsThreadUtils.h" // for nsRunnable | #include "nsThreadUtils.h" // for nsRunnable | |||
#include "nsTransactionManager.h" // for nsTransactionManager | #include "nsTransactionManager.h" // for nsTransactionManager | |||
#include "prtime.h" // for PR_Now | #include "prtime.h" // for PR_Now | |||
+#include "nsIEditorMouseObserver.h" | +#include "nsIEditorMouseObserver.h" | |||
class nsIOutputStream; | class nsIOutputStream; | |||
class nsIParserService; | class nsIParserService; | |||
skipping to change at line 1549 | skipping to change at line 1549 | |||
RefPtr<nsDOMAttributeMap> destAttributes = aDest->Attributes(); | RefPtr<nsDOMAttributeMap> destAttributes = aDest->Attributes(); | |||
- while (RefPtr<Attr> attr = destAttributes->Item(0)) { | - while (RefPtr<Attr> attr = destAttributes->Item(0)) { | |||
+ uint32_t destCount = destAttributes->Length(); | + uint32_t destCount = destAttributes->Length(); | |||
+ for (int32_t i = destCount - 1; i >= 0; i--) { | + for (int32_t i = destCount - 1; i >= 0; i--) { | |||
+ RefPtr<Attr> attr = destAttributes->Item(i); | + RefPtr<Attr> attr = destAttributes->Item(i); | |||
+ nsAutoString value; | + nsAutoString value; | |||
+ attr->GetValue(value); | + attr->GetValue(value); | |||
if (destInBody) { | if (destInBody) { | |||
RemoveAttribute(aDest, attr->NodeInfo()->NameAtom()); | RemoveAttribute(aDest, attr->NodeInfo()->NameAtom()); | |||
} else { | } else { | |||
@@ -2780,6 +2839,35 @@ struct SavedRange final | @@ -2313,8 +2372,18 @@ EditorBase::CloneAttributes(Element* aDest, | |||
uint32_t sourceCount = sourceAttributes->Length(); | ||||
for (uint32_t i = 0; i < sourceCount; i++) { | ||||
RefPtr<Attr> attr = sourceAttributes->Item(i); | ||||
- nsAutoString value; | ||||
+ nsAutoString name, value; | ||||
+ attr->NodeInfo()->NameAtom()->ToString(name); | ||||
attr->GetValue(value); | ||||
+ if (name.EqualsLiteral("xmlns")) { | ||||
+ // BLUEGRIFFON: make sure we don't copy a xmlns attribute we don't need b | ||||
ecause | ||||
+ // already there... This is needed because BlueGriffon deals with xhtml w | ||||
hile | ||||
+ // Gecko deals only with html | ||||
+ nsAutoString namespaceURI; | ||||
+ aDest->GetNamespaceURI(namespaceURI); | ||||
+ if (value.Equals(namespaceURI)) | ||||
+ continue; | ||||
+ } | ||||
if (destInBody) { | ||||
SetAttributeOrEquivalent(aDest, attr->NodeInfo()->NameAtom(), value, | ||||
false); | ||||
@@ -2780,6 +2849,35 @@ struct SavedRange final | ||||
int32_t mEndOffset; | int32_t mEndOffset; | |||
}; | }; | |||
+nsresult | +nsresult | |||
+EditorBase::RemoveNonCopyableAttributes(nsIDOMElement * aElement) | +EditorBase::RemoveNonCopyableAttributes(nsIDOMElement * aElement) | |||
+{ | +{ | |||
+ NS_ENSURE_TRUE(aElement, NS_ERROR_NULL_POINTER); | + NS_ENSURE_TRUE(aElement, NS_ERROR_NULL_POINTER); | |||
+ nsresult res = NS_OK; | + nsresult res = NS_OK; | |||
+ | + | |||
+ nsCOMPtr<nsIDOMMozNamedAttrMap> attributes; | + nsCOMPtr<nsIDOMMozNamedAttrMap> attributes; | |||
skipping to change at line 1585 | skipping to change at line 1605 | |||
+ } | + } | |||
+ } | + } | |||
+ } | + } | |||
+ } | + } | |||
+ return res; | + return res; | |||
+} | +} | |||
+ | + | |||
nsresult | nsresult | |||
EditorBase::SplitNodeImpl(nsIContent& aExistingRightNode, | EditorBase::SplitNodeImpl(nsIContent& aExistingRightNode, | |||
int32_t aOffset, | int32_t aOffset, | |||
@@ -3870,6 +3958,11 @@ EditorBase::SplitNodeDeep(nsIContent& aNode, | @@ -3870,6 +3968,11 @@ EditorBase::SplitNodeDeep(nsIContent& aNode, | |||
nsCOMPtr<nsIContent> newLeftNode = SplitNode(nodeToSplit, offset, rv); | nsCOMPtr<nsIContent> newLeftNode = SplitNode(nodeToSplit, offset, rv); | |||
NS_ENSURE_TRUE(!NS_FAILED(rv.StealNSResult()), -1); | NS_ENSURE_TRUE(!NS_FAILED(rv.StealNSResult()), -1); | |||
+ nsCOMPtr<nsIDOMElement> elt = do_QueryInterface(nodeToSplit); | + nsCOMPtr<nsIDOMElement> elt = do_QueryInterface(nodeToSplit); | |||
+ if (elt) { | + if (elt) { | |||
+ RemoveNonCopyableAttributes(elt); | + RemoveNonCopyableAttributes(elt); | |||
+ } | + } | |||
+ | + | |||
rightNode = nodeToSplit; | rightNode = nodeToSplit; | |||
leftNode = newLeftNode; | leftNode = newLeftNode; | |||
skipping to change at line 2553 | skipping to change at line 2573 | |||
+++ b/layout/forms/nsColorControlFrame.cpp | +++ b/layout/forms/nsColorControlFrame.cpp | |||
@@ -101,6 +101,8 @@ nsColorControlFrame::UpdateColor() | @@ -101,6 +101,8 @@ nsColorControlFrame::UpdateColor() | |||
nsAutoString color; | nsAutoString color; | |||
HTMLInputElement* elt = HTMLInputElement::FromContent(mContent); | HTMLInputElement* elt = HTMLInputElement::FromContent(mContent); | |||
elt->GetValue(color, CallerType::System); | elt->GetValue(color, CallerType::System); | |||
+ if (color.IsEmpty()) | + if (color.IsEmpty()) | |||
+ return NS_OK; | + return NS_OK; | |||
MOZ_ASSERT(!color.IsEmpty(), | MOZ_ASSERT(!color.IsEmpty(), | |||
"Content node's GetValue() should return a valid color string " | "Content node's GetValue() should return a valid color string " | |||
"(the default color, in case no valid color is set)"); | "(the default color, in case no valid color is set)"); | |||
diff --git a/layout/style/Loader.cpp b/layout/style/Loader.cpp | diff --git a/layout/style/Declaration.cpp b/layout/style/Declaration.cpp | |||
index 16ab5429facb..4f29dc1537dc 100644 | index f08ab15f4e5a..96dd9ae4f29f 100644 | |||
+++ b/layout/style/Loader.cpp | --- a/layout/style/Declaration.cpp | |||
@@ -1129,7 +1129,8 @@ Loader::CreateSheet(nsIURI* aURI, | @@ -662,10 +662,7 @@ Declaration::GetPropertyValueInternal( | |||
#endif | nsCSSCompressedDataBlock *data = importantCount ? mImportantData : mData; | |||
switch (aProperty) { | ||||
bool fromCompleteSheets = false; | case eCSSProperty_margin: | |||
- if (!sheet) { | - case eCSSProperty_padding: | |||
+ //XXX BlueGriffon forces reload of stylesheets each time we need them | - case eCSSProperty_border_color: | |||
+ if (false /*!sheet*/) { | - case eCSSProperty_border_style: | |||
// Then our per-document complete sheets. | - case eCSSProperty_border_width: { | |||
URIPrincipalReferrerPolicyAndCORSModeHashKey key(aURI, aLoaderPrincipal, | + case eCSSProperty_padding: { | |||
aCORSMode, aReferrerPolicy); | const nsCSSPropertyID* subprops = | |||
nsCSSProps::SubpropertyEntryFor(aProperty); | ||||
MOZ_ASSERT(nsCSSProps::GetStringValue(subprops[0]).Find("-top") != | ||||
@@ -743,6 +740,9 @@ Declaration::GetPropertyValueInternal( | ||||
// If we have a non-default value for any of the properties that | ||||
// this shorthand sets but cannot specify, we have to return the | ||||
// empty string. | ||||
+ /* BLUEGRIFFON: 'border' should not reset 'border-image' | ||||
+ * Cf. https://lists.w3.org/Archives/Public/www-style/2017Nov/0018.html | ||||
+ | ||||
if (data->ValueFor(eCSSProperty_border_image_source)->GetUnit() != | ||||
eCSSUnit_None || | ||||
!data->HasDefaultBorderImageSlice() || | ||||
@@ -759,6 +759,7 @@ Declaration::GetPropertyValueInternal( | ||||
eCSSUnit_None) { | ||||
break; | ||||
} | ||||
+ */ | ||||
const nsCSSPropertyID* subproptables[3] = { | ||||
nsCSSProps::SubpropertyEntryFor(eCSSProperty_border_color), | ||||
@@ -783,7 +784,57 @@ Declaration::GetPropertyValueInternal( | ||||
} | ||||
// tweak aProperty and fall through | ||||
aProperty = eCSSProperty_border_top; | ||||
- MOZ_FALLTHROUGH; | ||||
+ const nsCSSPropertyID* subprops = | ||||
+ nsCSSProps::SubpropertyEntryFor(aProperty); | ||||
+ MOZ_ASSERT(StringEndsWith(nsCSSProps::GetStringValue(subprops[2]), | ||||
+ NS_LITERAL_CSTRING("-color")), | ||||
+ "third subprop must be the color property"); | ||||
+ | ||||
+ bool ok = AppendValueToString(subprops[0], aValue, aSerialization); | ||||
+ if (ok) { | ||||
+ aValue.Append(u' '); | ||||
+ ok = AppendValueToString(subprops[1], aValue, aSerialization); | ||||
+ if (ok) { | ||||
+ const nsCSSValue *colorValue = data->ValueFor(subprops[2]); | ||||
+ bool isCurrentColor = | ||||
+ colorValue->GetUnit() == eCSSUnit_EnumColor && | ||||
+ colorValue->GetIntValue() == NS_COLOR_CURRENTCOLOR; | ||||
+ | ||||
+ // Don't output a third value when it's currentcolor. | ||||
+ if (!isCurrentColor) { | ||||
+ aValue.Append(u' '); | ||||
+ ok = AppendValueToString(subprops[2], aValue, aSerialization); | ||||
+ } | ||||
+ } | ||||
+ } | ||||
+ | ||||
+ if (!ok) { | ||||
+ aValue.Truncate(); | ||||
+ } | ||||
+ break; | ||||
+ } | ||||
+ case eCSSProperty_border_color: | ||||
+ case eCSSProperty_border_style: | ||||
+ case eCSSProperty_border_width: { | ||||
+ const nsCSSPropertyID* subprops = | ||||
+ nsCSSProps::SubpropertyEntryFor(aProperty); | ||||
+ MOZ_ASSERT(nsCSSProps::GetStringValue(subprops[0]).Find("-top") != | ||||
+ kNotFound, "first subprop must be top"); | ||||
+ MOZ_ASSERT(nsCSSProps::GetStringValue(subprops[1]).Find("-right") != | ||||
+ kNotFound, "second subprop must be right"); | ||||
+ MOZ_ASSERT(nsCSSProps::GetStringValue(subprops[2]).Find("-bottom") != | ||||
+ kNotFound, "third subprop must be bottom"); | ||||
+ MOZ_ASSERT(nsCSSProps::GetStringValue(subprops[3]).Find("-left") != | ||||
+ kNotFound, "fourth subprop must be left"); | ||||
+ const nsCSSValue* vals[4] = { | ||||
+ data->ValueFor(subprops[0]), | ||||
+ data->ValueFor(subprops[1]), | ||||
+ data->ValueFor(subprops[2]), | ||||
+ data->ValueFor(subprops[3]) | ||||
+ }; | ||||
+ nsCSSValue::AppendSidesShorthandToString(subprops, vals, aValue, | ||||
+ aSerialization); | ||||
+ break; | ||||
} | ||||
case eCSSProperty_border_top: | ||||
case eCSSProperty_border_right: | ||||
diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp | diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp | |||
index 73b94dff9ce2..48eb879ac7fd 100644 | index 73b94dff9ce2..7c4dba950471 100644 | |||
--- a/layout/style/nsCSSParser.cpp | --- a/layout/style/nsCSSParser.cpp | |||
+++ b/layout/style/nsCSSParser.cpp | +++ b/layout/style/nsCSSParser.cpp | |||
@@ -63,6 +63,8 @@ | @@ -13452,6 +13452,9 @@ CSSParserImpl::ParseBorderSide(const nsCSSPropertyID aPr | |||
#include "mozilla/dom/URL.h" | opIDs[], | |||
#include "gfxFontFamilyList.h" | AppendValue(kBorderColorIDs[index], values[2]); | |||
} | ||||
+#define BG_CONSOLE_SHOW_INVALID_VARIABLES "bluegriffon.console.showInvalidVaria | ||||
bles" | + /* BLUEGRIFFON: 'border' should not reset 'border-image' | |||
+ | + * Cf. https://lists.w3.org/Archives/Public/www-style/2017Nov/0018.html | |||
using namespace mozilla; | + | |||
using namespace mozilla::css; | static const nsCSSPropertyID kBorderColorsProps[] = { | |||
eCSSProperty__moz_border_top_colors, | ||||
@@ -2983,7 +2985,7 @@ CSSParserImpl::ParsePropertyWithVariableReferences( | eCSSProperty__moz_border_right_colors, | |||
nsCSSTokenSerializationType firstToken, lastToken; | @@ -13482,6 +13485,7 @@ CSSParserImpl::ParseBorderSide(const nsCSSPropertyID aPr | |||
valid = ResolveValueWithVariableReferences(aVariables, expandedValue, | opIDs[], | |||
firstToken, lastToken); | NS_FOR_CSS_SIDES(side) { | |||
- if (!valid) { | AppendValue(kBorderColorsProps[side], extraValue); | |||
+ if (!valid && Preferences::GetBool(BG_CONSOLE_SHOW_INVALID_VARIABLES)) { | } | |||
NS_ConvertASCIItoUTF16 propName(nsCSSProps::GetStringValue(aPropertyID)); | + */ | |||
REPORT_UNEXPECTED(PEInvalidVariableReference); | } | |||
REPORT_UNEXPECTED_P(PEValueParsingError, propName); | else { | |||
// Just set our one side | ||||
diff --git a/layout/style/nsCSSProps.cpp b/layout/style/nsCSSProps.cpp | ||||
index cd182af443a5..7ad249ad1b2a 100644 | ||||
--- a/layout/style/nsCSSProps.cpp | ||||
@@ -2694,6 +2694,10 @@ static const nsCSSPropertyID gBorderSubpropTable[] = { | ||||
eCSSProperty_border_right_color, | ||||
eCSSProperty_border_bottom_color, | ||||
eCSSProperty_border_left_color, | ||||
+ | ||||
+ /* BLUEGRIFFON: 'border' should not reset 'border-image' | ||||
+ * Cf. https://lists.w3.org/Archives/Public/www-style/2017Nov/0018.html | ||||
+ | ||||
eCSSProperty__moz_border_top_colors, | ||||
eCSSProperty__moz_border_right_colors, | ||||
eCSSProperty__moz_border_bottom_colors, | ||||
@@ -2703,6 +2707,7 @@ static const nsCSSPropertyID gBorderSubpropTable[] = { | ||||
eCSSProperty_border_image_width, | ||||
eCSSProperty_border_image_outset, | ||||
eCSSProperty_border_image_repeat, | ||||
+ */ | ||||
eCSSProperty_UNKNOWN | ||||
}; | ||||
diff --git a/layout/style/nsCSSValue.cpp b/layout/style/nsCSSValue.cpp | diff --git a/layout/style/nsCSSValue.cpp b/layout/style/nsCSSValue.cpp | |||
index 01988185438c..4e86eec920f9 100644 | index 01988185438c..cb36695039dd 100644 | |||
--- a/layout/style/nsCSSValue.cpp | --- a/layout/style/nsCSSValue.cpp | |||
+++ b/layout/style/nsCSSValue.cpp | +++ b/layout/style/nsCSSValue.cpp | |||
@@ -1668,6 +1668,17 @@ nsCSSValue::AppendToString(nsCSSPropertyID aProperty, nsA | @@ -1182,20 +1182,26 @@ nsCSSValue::AppendSidesShorthandToString(const nsCSSProp | |||
String& aResult, | ertyID aProperties[], | |||
const nsCSSValue& value3 = *aValues[2]; | ||||
const nsCSSValue& value4 = *aValues[3]; | ||||
+ nsAutoString valueString1, valueString2, valueString3, valueString4; | ||||
+ value1.AppendToString(aProperties[0], valueString1, aSerialization); | ||||
+ value2.AppendToString(aProperties[1], valueString2, aSerialization); | ||||
+ value3.AppendToString(aProperties[2], valueString3, aSerialization); | ||||
+ value4.AppendToString(aProperties[3], valueString4, aSerialization); | ||||
+ | ||||
MOZ_ASSERT(value1.GetUnit() != eCSSUnit_Null, "null value 1"); | ||||
- value1.AppendToString(aProperties[0], aString, aSerialization); | ||||
- if (value1 != value2 || value1 != value3 || value1 != value4) { | ||||
+ aString.Append(valueString1); | ||||
+ if (valueString1 != valueString2 || valueString1 != valueString3 || valueStri | ||||
ng1 != valueString4) { | ||||
aString.Append(char16_t(' ')); | ||||
MOZ_ASSERT(value2.GetUnit() != eCSSUnit_Null, "null value 2"); | ||||
- value2.AppendToString(aProperties[1], aString, aSerialization); | ||||
- if (value1 != value3 || value2 != value4) { | ||||
+ aString.Append(valueString2); | ||||
+ if (valueString1 != valueString3 || valueString2 != valueString4) { | ||||
aString.Append(char16_t(' ')); | ||||
MOZ_ASSERT(value3.GetUnit() != eCSSUnit_Null, "null value 3"); | ||||
- value3.AppendToString(aProperties[2], aString, aSerialization); | ||||
- if (value2 != value4) { | ||||
+ aString.Append(valueString3); | ||||
+ if (valueString2 != valueString4) { | ||||
aString.Append(char16_t(' ')); | ||||
MOZ_ASSERT(value4.GetUnit() != eCSSUnit_Null, "null value 4"); | ||||
- value4.AppendToString(aProperties[3], aString, aSerialization); | ||||
+ aString.Append(valueString4); | ||||
} | ||||
} | ||||
} | ||||
@@ -1668,6 +1674,17 @@ nsCSSValue::AppendToString(nsCSSPropertyID aProperty, nsA | ||||
String& aResult, | ||||
} | } | |||
} | } | |||
else if (IsNumericColorUnit(unit)) { | else if (IsNumericColorUnit(unit)) { | |||
+ bool outputCssNames = false; | + bool outputCssNames = false; | |||
+ nsXPIDLCString colorOutputType; | + nsXPIDLCString colorOutputType; | |||
+ nsresult rv; | + nsresult rv; | |||
+ nsCOMPtr<nsIPrefBranch> prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTI D, &rv); | + nsCOMPtr<nsIPrefBranch> prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTI D, &rv); | |||
+ if (NS_SUCCEEDED(rv) && prefBranch) { | + if (NS_SUCCEEDED(rv) && prefBranch) { | |||
+ prefBranch->GetBoolPref("bluegriffon.css.colors.names.enabled", &outputCs sNames); | + prefBranch->GetBoolPref("bluegriffon.css.colors.names.enabled", &outputCs sNames); | |||
+ prefBranch->GetCharPref("bluegriffon.css.colors.type", getter_Copies(colo rOutputType)); | + prefBranch->GetCharPref("bluegriffon.css.colors.type", getter_Copies(colo rOutputType)); | |||
+ } | + } | |||
+ bool serializeName = false; | + bool serializeName = false; | |||
+ bool forceHexSerialization = false; | + bool forceHexSerialization = false; | |||
+ | + | |||
if (aSerialization == eNormalized || | if (aSerialization == eNormalized || | |||
unit == eCSSUnit_RGBColor || | unit == eCSSUnit_RGBColor || | |||
unit == eCSSUnit_RGBAColor) { | unit == eCSSUnit_RGBAColor) { | |||
@@ -1686,21 +1697,52 @@ nsCSSValue::AppendToString(nsCSSPropertyID aProperty, ns AString& aResult, | @@ -1686,21 +1703,52 @@ nsCSSValue::AppendToString(nsCSSPropertyID aProperty, ns AString& aResult, | |||
if (showAlpha) { | if (showAlpha) { | |||
aResult.AppendLiteral("rgba("); | aResult.AppendLiteral("rgba("); | |||
} else { | } else { | |||
- aResult.AppendLiteral("rgb("); | - aResult.AppendLiteral("rgb("); | |||
+ if (outputCssNames) { | + if (outputCssNames) { | |||
+ nsAutoString nameToSerialize; | + nsAutoString nameToSerialize; | |||
+ serializeName = NS_RGBToColorName(color, nameToSerialize); | + serializeName = NS_RGBToColorName(color, nameToSerialize); | |||
+ if (serializeName) { | + if (serializeName) { | |||
+ aResult.Append(nameToSerialize); | + aResult.Append(nameToSerialize); | |||
+ } | + } | |||
End of changes. 10 change blocks. | ||||
40 lines changed or deleted | 199 lines changed or added |