jdk/src/share/classes/javax/swing/text/html/StyleSheet.java
changeset 21278 ef8a3a2a72f2
parent 20169 d7fa6d7586c9
child 22260 c9185e010e03
equal deleted inserted replaced
21277:bd380b80f9ea 21278:ef8a3a2a72f2
   103  * defined by an element are not well defined. For example, the html
   103  * defined by an element are not well defined. For example, the html
   104  * <code>&lt;body bgcolor=red&gt;</code> makes the body have a red
   104  * <code>&lt;body bgcolor=red&gt;</code> makes the body have a red
   105  * background. But if the html file also contains the CSS rule
   105  * background. But if the html file also contains the CSS rule
   106  * <code>body { background: blue }</code> it becomes less clear as to
   106  * <code>body { background: blue }</code> it becomes less clear as to
   107  * what color the background of the body should be. The current
   107  * what color the background of the body should be. The current
   108  * implemention gives visual attributes defined in the element the
   108  * implementation gives visual attributes defined in the element the
   109  * highest precedence, that is they are always checked before any styles.
   109  * highest precedence, that is they are always checked before any styles.
   110  * Therefore, in the previous example the background would have a
   110  * Therefore, in the previous example the background would have a
   111  * red color as the body element defines the background color to be red.
   111  * red color as the body element defines the background color to be red.
   112  * <p>
   112  * <p>
   113  * As already mentioned this supports CSS. We don't support the full CSS
   113  * As already mentioned this supports CSS. We don't support the full CSS
   936     }
   936     }
   937 
   937 
   938     /**
   938     /**
   939      * Sets the base font size from the passed in String. The string
   939      * Sets the base font size from the passed in String. The string
   940      * can either identify a specific font size, with legal values between
   940      * can either identify a specific font size, with legal values between
   941      * 1 and 7, or identifiy a relative font size such as +1 or -2.
   941      * 1 and 7, or identify a relative font size such as +1 or -2.
   942      */
   942      */
   943     public void setBaseFontSize(String size) {
   943     public void setBaseFontSize(String size) {
   944         css.setBaseFontSize(size);
   944         css.setBaseFontSize(size);
   945     }
   945     }
   946 
   946 
  1033         }
  1033         }
  1034         rule.addAttributes(declaration);
  1034         rule.addAttributes(declaration);
  1035     }
  1035     }
  1036 
  1036 
  1037     //
  1037     //
  1038     // The following gaggle of methods is used in maintaing the rules from
  1038     // The following gaggle of methods is used in maintaining the rules from
  1039     // the sheet.
  1039     // the sheet.
  1040     //
  1040     //
  1041 
  1041 
  1042     /**
  1042     /**
  1043      * Updates the attributes of the rules to reference any related
  1043      * Updates the attributes of the rules to reference any related
  2957                     }
  2957                     }
  2958                 }
  2958                 }
  2959                 return true;
  2959                 return true;
  2960             }
  2960             }
  2961             if (thisDotIndex != -1) {
  2961             if (thisDotIndex != -1) {
  2962                 // Reciever references a class, just check element name.
  2962                 // Receiver references a class, just check element name.
  2963                 return (((thisDotIndex - thisCurrent) == (sLast - sCurrent)) &&
  2963                 return (((thisDotIndex - thisCurrent) == (sLast - sCurrent)) &&
  2964                         selector.regionMatches(sCurrent, name, thisCurrent,
  2964                         selector.regionMatches(sCurrent, name, thisCurrent,
  2965                                                thisDotIndex - thisCurrent));
  2965                                                thisDotIndex - thisCurrent));
  2966             }
  2966             }
  2967             if (thisPoundIndex != -1) {
  2967             if (thisPoundIndex != -1) {
  2968                 // Reciever references an id, just check element name.
  2968                 // Receiver references an id, just check element name.
  2969                 return (((thisPoundIndex - thisCurrent) ==(sLast - sCurrent))&&
  2969                 return (((thisPoundIndex - thisCurrent) ==(sLast - sCurrent))&&
  2970                         selector.regionMatches(sCurrent, name, thisCurrent,
  2970                         selector.regionMatches(sCurrent, name, thisCurrent,
  2971                                                thisPoundIndex - thisCurrent));
  2971                                                thisPoundIndex - thisCurrent));
  2972             }
  2972             }
  2973             // Fail through, no classes or ides, just check string.
  2973             // Fail through, no classes or ides, just check string.
  2975                     selector.regionMatches(sCurrent, name, thisCurrent,
  2975                     selector.regionMatches(sCurrent, name, thisCurrent,
  2976                                            thisLast - thisCurrent));
  2976                                            thisLast - thisCurrent));
  2977         }
  2977         }
  2978 
  2978 
  2979         /**
  2979         /**
  2980          * Similiar to String.indexOf, but allows an upper bound
  2980          * Similar to String.indexOf, but allows an upper bound
  2981          * (this is slower in that it will still check string starting at
  2981          * (this is slower in that it will still check string starting at
  2982          * start.
  2982          * start.
  2983          */
  2983          */
  2984         int boundedIndexOf(String string, char search, int start,
  2984         int boundedIndexOf(String string, char search, int start,
  2985                            int end) {
  2985                            int end) {