cursor:none and content:none

This commit is contained in:
Ryan Nematz 2016-06-24 05:05:39 -04:00
parent 70a63e3fce
commit a67087fae8
5 changed files with 23 additions and 5 deletions

View File

@ -5210,7 +5210,8 @@ PRBool CSSParserImpl::ParseContent(nsresult& aErrorCode)
// XXX Rewrite to make it look more like ParseCursor or ParseCounterData? // XXX Rewrite to make it look more like ParseCursor or ParseCounterData?
nsCSSValue value; nsCSSValue value;
if (ParseVariant(aErrorCode, value, if (ParseVariant(aErrorCode, value,
VARIANT_CONTENT | VARIANT_INHERIT | VARIANT_NORMAL, VARIANT_CONTENT | VARIANT_INHERIT | VARIANT_NORMAL |
VARIANT_NONE,
nsCSSProps::kContentKTable)) { nsCSSProps::kContentKTable)) {
nsCSSValueList* listHead = new nsCSSValueList(); nsCSSValueList* listHead = new nsCSSValueList();
nsCSSValueList* list = listHead; nsCSSValueList* list = listHead;
@ -5229,7 +5230,8 @@ PRBool CSSParserImpl::ParseContent(nsresult& aErrorCode)
} }
if (eCSSUnit_Inherit == value.GetUnit() || if (eCSSUnit_Inherit == value.GetUnit() ||
eCSSUnit_Initial == value.GetUnit() || eCSSUnit_Initial == value.GetUnit() ||
eCSSUnit_Normal == value.GetUnit()) { eCSSUnit_Normal == value.GetUnit() ||
eCSSUnit_None == value.GetUnit()) {
// This only matters the first time through the loop. // This only matters the first time through the loop.
return PR_FALSE; return PR_FALSE;
} }

View File

@ -4186,14 +4186,15 @@ nsRuleNode::ComputeContentData(nsStyleStruct* aStartStruct,
parentContent = parentContext->GetStyleContent(); parentContent = parentContext->GetStyleContent();
PRBool inherited = aInherited; PRBool inherited = aInherited;
// content: [string, url, counter, attr, enum]+, normal, inherit // content: [string, url, counter, attr, enum]+, normal, none, inherit
PRUint32 count; PRUint32 count;
nsAutoString buffer; nsAutoString buffer;
nsCSSValueList* contentValue = contentData.mContent; nsCSSValueList* contentValue = contentData.mContent;
if (contentValue) { if (contentValue) {
if (eCSSUnit_Normal == contentValue->mValue.GetUnit() || if (eCSSUnit_Normal == contentValue->mValue.GetUnit() ||
eCSSUnit_None == contentValue->mValue.GetUnit() ||
eCSSUnit_Initial == contentValue->mValue.GetUnit()) { eCSSUnit_Initial == contentValue->mValue.GetUnit()) {
// "normal" and "initial" both mean no content // "normal", "none", and "initial" all mean no content
content->AllocateContents(0); content->AllocateContents(0);
} }
else if (eCSSUnit_Inherit == contentValue->mValue.GetUnit()) { else if (eCSSUnit_Inherit == contentValue->mValue.GetUnit()) {

View File

@ -1,4 +1,12 @@
/* RetroZilla 3.0 Test Page Stylesheet */ /* RetroZilla 3.0 Test Page Stylesheet */
#bug346690 { #bug346690 {
cursor: none; cursor: none;
}
.bug378535:before {
content: "Read this - ";
}
.bug378535#hometown:before {
content: none;
} }

View File

@ -14,5 +14,10 @@
<h3>cursor:none</h3> <h3>cursor:none</h3>
<img src="test-image.gif" id="bug346690"> <img src="test-image.gif" id="bug346690">
<hr> <hr>
<h2>content:none (bug 378535)</h2>
<p class="bug378535">My name is Donald</p>
<p class="bug378535" id="hometown">I live in Ducksburg</p>
<hr>
</body> </body>
</html> </html>

View File

@ -2777,7 +2777,9 @@ NS_METHOD nsWindow::SetCursor(nsCursor aCursor)
case eCursor_ew_resize: case eCursor_ew_resize:
newCursor = ::LoadCursor(NULL, IDC_SIZEWE); newCursor = ::LoadCursor(NULL, IDC_SIZEWE);
break; break;
case eCursor_none:
newCursor = ::LoadCursor(nsToolkit::mDllInstance, MAKEINTRESOURCE(IDC_NONE));
break;
default: default:
NS_ERROR("Invalid cursor type"); NS_ERROR("Invalid cursor type");
break; break;