-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
415 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
111 changes: 111 additions & 0 deletions
111
ph-css/src/main/java/com/helger/css/decl/CSSSelectorMemberPseudoHas.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
/* | ||
* Copyright (C) 2014-2024 Philip Helger (www.helger.com) | ||
* philip[at]helger[dot]com | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.helger.css.decl; | ||
|
||
import javax.annotation.Nonnegative; | ||
import javax.annotation.Nonnull; | ||
import javax.annotation.Nullable; | ||
import javax.annotation.concurrent.NotThreadSafe; | ||
|
||
import com.helger.commons.ValueEnforcer; | ||
import com.helger.commons.annotation.Nonempty; | ||
import com.helger.commons.hashcode.HashCodeGenerator; | ||
import com.helger.commons.string.ToStringGenerator; | ||
import com.helger.css.CSSSourceLocation; | ||
import com.helger.css.ECSSVersion; | ||
import com.helger.css.ICSSSourceLocationAware; | ||
import com.helger.css.ICSSVersionAware; | ||
import com.helger.css.ICSSWriterSettings; | ||
|
||
/** | ||
* Represents a single, simple CSS selector as used for the ":has()" CSS pseudo | ||
* element.<br> | ||
* | ||
* @author Philip Helger | ||
* @since 7.0.3 | ||
*/ | ||
@NotThreadSafe | ||
public class CSSSelectorMemberPseudoHas implements ICSSSelectorMember, ICSSVersionAware, ICSSSourceLocationAware | ||
{ | ||
private final CSSSelector m_aSelector; | ||
private CSSSourceLocation m_aSourceLocation; | ||
|
||
public CSSSelectorMemberPseudoHas (@Nonnull final CSSSelector aSelector) | ||
{ | ||
ValueEnforcer.notNull (aSelector, "Selector"); | ||
m_aSelector = aSelector; | ||
} | ||
|
||
@Nonnull | ||
public final CSSSelector getSelector () | ||
{ | ||
return m_aSelector; | ||
} | ||
|
||
@Nonnull | ||
@Nonempty | ||
public String getAsCSSString (@Nonnull final ICSSWriterSettings aSettings, @Nonnegative final int nIndentLevel) | ||
{ | ||
aSettings.checkVersionRequirements (this); | ||
|
||
final StringBuilder aSB = new StringBuilder (":has("); | ||
aSB.append (m_aSelector.getAsCSSString (aSettings, 0)); | ||
return aSB.append (')').toString (); | ||
} | ||
|
||
@Nonnull | ||
public ECSSVersion getMinimumCSSVersion () | ||
{ | ||
return ECSSVersion.CSS30; | ||
} | ||
|
||
@Nullable | ||
public final CSSSourceLocation getSourceLocation () | ||
{ | ||
return m_aSourceLocation; | ||
} | ||
|
||
public final void setSourceLocation (@Nullable final CSSSourceLocation aSourceLocation) | ||
{ | ||
m_aSourceLocation = aSourceLocation; | ||
} | ||
|
||
@Override | ||
public boolean equals (final Object o) | ||
{ | ||
if (o == this) | ||
return true; | ||
if (o == null || !getClass ().equals (o.getClass ())) | ||
return false; | ||
final CSSSelectorMemberPseudoHas rhs = (CSSSelectorMemberPseudoHas) o; | ||
return m_aSelector.equals (rhs.m_aSelector); | ||
} | ||
|
||
@Override | ||
public int hashCode () | ||
{ | ||
return new HashCodeGenerator (this).append (m_aSelector).getHashCode (); | ||
} | ||
|
||
@Override | ||
public String toString () | ||
{ | ||
return new ToStringGenerator (null).append ("Selector", m_aSelector) | ||
.appendIfNotNull ("SourceLocation", m_aSourceLocation) | ||
.getToString (); | ||
} | ||
} |
111 changes: 111 additions & 0 deletions
111
ph-css/src/main/java/com/helger/css/decl/CSSSelectorMemberPseudoIs.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
/* | ||
* Copyright (C) 2014-2024 Philip Helger (www.helger.com) | ||
* philip[at]helger[dot]com | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.helger.css.decl; | ||
|
||
import javax.annotation.Nonnegative; | ||
import javax.annotation.Nonnull; | ||
import javax.annotation.Nullable; | ||
import javax.annotation.concurrent.NotThreadSafe; | ||
|
||
import com.helger.commons.ValueEnforcer; | ||
import com.helger.commons.annotation.Nonempty; | ||
import com.helger.commons.hashcode.HashCodeGenerator; | ||
import com.helger.commons.string.ToStringGenerator; | ||
import com.helger.css.CSSSourceLocation; | ||
import com.helger.css.ECSSVersion; | ||
import com.helger.css.ICSSSourceLocationAware; | ||
import com.helger.css.ICSSVersionAware; | ||
import com.helger.css.ICSSWriterSettings; | ||
|
||
/** | ||
* Represents a single, simple CSS selector as used for the ":is()" CSS pseudo | ||
* element.<br> | ||
* | ||
* @author Philip Helger | ||
* @since 7.0.3 | ||
*/ | ||
@NotThreadSafe | ||
public class CSSSelectorMemberPseudoIs implements ICSSSelectorMember, ICSSVersionAware, ICSSSourceLocationAware | ||
{ | ||
private final CSSSelector m_aSelector; | ||
private CSSSourceLocation m_aSourceLocation; | ||
|
||
public CSSSelectorMemberPseudoIs (@Nonnull final CSSSelector aSelector) | ||
{ | ||
ValueEnforcer.notNull (aSelector, "Selector"); | ||
m_aSelector = aSelector; | ||
} | ||
|
||
@Nonnull | ||
public final CSSSelector getSelector () | ||
{ | ||
return m_aSelector; | ||
} | ||
|
||
@Nonnull | ||
@Nonempty | ||
public String getAsCSSString (@Nonnull final ICSSWriterSettings aSettings, @Nonnegative final int nIndentLevel) | ||
{ | ||
aSettings.checkVersionRequirements (this); | ||
|
||
final StringBuilder aSB = new StringBuilder (":is("); | ||
aSB.append (m_aSelector.getAsCSSString (aSettings, 0)); | ||
return aSB.append (')').toString (); | ||
} | ||
|
||
@Nonnull | ||
public ECSSVersion getMinimumCSSVersion () | ||
{ | ||
return ECSSVersion.CSS30; | ||
} | ||
|
||
@Nullable | ||
public final CSSSourceLocation getSourceLocation () | ||
{ | ||
return m_aSourceLocation; | ||
} | ||
|
||
public final void setSourceLocation (@Nullable final CSSSourceLocation aSourceLocation) | ||
{ | ||
m_aSourceLocation = aSourceLocation; | ||
} | ||
|
||
@Override | ||
public boolean equals (final Object o) | ||
{ | ||
if (o == this) | ||
return true; | ||
if (o == null || !getClass ().equals (o.getClass ())) | ||
return false; | ||
final CSSSelectorMemberPseudoIs rhs = (CSSSelectorMemberPseudoIs) o; | ||
return m_aSelector.equals (rhs.m_aSelector); | ||
} | ||
|
||
@Override | ||
public int hashCode () | ||
{ | ||
return new HashCodeGenerator (this).append (m_aSelector).getHashCode (); | ||
} | ||
|
||
@Override | ||
public String toString () | ||
{ | ||
return new ToStringGenerator (null).append ("Selector", m_aSelector) | ||
.appendIfNotNull ("SourceLocation", m_aSourceLocation) | ||
.getToString (); | ||
} | ||
} |
111 changes: 111 additions & 0 deletions
111
ph-css/src/main/java/com/helger/css/decl/CSSSelectorMemberPseudoWhere.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
/* | ||
* Copyright (C) 2014-2024 Philip Helger (www.helger.com) | ||
* philip[at]helger[dot]com | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.helger.css.decl; | ||
|
||
import javax.annotation.Nonnegative; | ||
import javax.annotation.Nonnull; | ||
import javax.annotation.Nullable; | ||
import javax.annotation.concurrent.NotThreadSafe; | ||
|
||
import com.helger.commons.ValueEnforcer; | ||
import com.helger.commons.annotation.Nonempty; | ||
import com.helger.commons.hashcode.HashCodeGenerator; | ||
import com.helger.commons.string.ToStringGenerator; | ||
import com.helger.css.CSSSourceLocation; | ||
import com.helger.css.ECSSVersion; | ||
import com.helger.css.ICSSSourceLocationAware; | ||
import com.helger.css.ICSSVersionAware; | ||
import com.helger.css.ICSSWriterSettings; | ||
|
||
/** | ||
* Represents a single, simple CSS selector as used for the ":has()" CSS pseudo | ||
* element.<br> | ||
* | ||
* @author Philip Helger | ||
* @since 7.0.3 | ||
*/ | ||
@NotThreadSafe | ||
public class CSSSelectorMemberPseudoWhere implements ICSSSelectorMember, ICSSVersionAware, ICSSSourceLocationAware | ||
{ | ||
private final CSSSelector m_aSelector; | ||
private CSSSourceLocation m_aSourceLocation; | ||
|
||
public CSSSelectorMemberPseudoWhere (@Nonnull final CSSSelector aSelector) | ||
{ | ||
ValueEnforcer.notNull (aSelector, "Selector"); | ||
m_aSelector = aSelector; | ||
} | ||
|
||
@Nonnull | ||
public final CSSSelector getSelector () | ||
{ | ||
return m_aSelector; | ||
} | ||
|
||
@Nonnull | ||
@Nonempty | ||
public String getAsCSSString (@Nonnull final ICSSWriterSettings aSettings, @Nonnegative final int nIndentLevel) | ||
{ | ||
aSettings.checkVersionRequirements (this); | ||
|
||
final StringBuilder aSB = new StringBuilder (":where("); | ||
aSB.append (m_aSelector.getAsCSSString (aSettings, 0)); | ||
return aSB.append (')').toString (); | ||
} | ||
|
||
@Nonnull | ||
public ECSSVersion getMinimumCSSVersion () | ||
{ | ||
return ECSSVersion.CSS30; | ||
} | ||
|
||
@Nullable | ||
public final CSSSourceLocation getSourceLocation () | ||
{ | ||
return m_aSourceLocation; | ||
} | ||
|
||
public final void setSourceLocation (@Nullable final CSSSourceLocation aSourceLocation) | ||
{ | ||
m_aSourceLocation = aSourceLocation; | ||
} | ||
|
||
@Override | ||
public boolean equals (final Object o) | ||
{ | ||
if (o == this) | ||
return true; | ||
if (o == null || !getClass ().equals (o.getClass ())) | ||
return false; | ||
final CSSSelectorMemberPseudoWhere rhs = (CSSSelectorMemberPseudoWhere) o; | ||
return m_aSelector.equals (rhs.m_aSelector); | ||
} | ||
|
||
@Override | ||
public int hashCode () | ||
{ | ||
return new HashCodeGenerator (this).append (m_aSelector).getHashCode (); | ||
} | ||
|
||
@Override | ||
public String toString () | ||
{ | ||
return new ToStringGenerator (null).append ("Selector", m_aSelector) | ||
.appendIfNotNull ("SourceLocation", m_aSourceLocation) | ||
.getToString (); | ||
} | ||
} |
Oops, something went wrong.