📄 cssparser.cpp
字号:
case CSSPropertyOverflow: { ShorthandScope scope(this, propId); if (num != 1 || !parseValue(CSSPropertyOverflowX, important)) return false; CSSValue* value = m_parsedProperties[m_numParsedProperties - 1]->value(); addProperty(CSSPropertyOverflowY, value, important); return true; } case CSSPropertyOverflowX: case CSSPropertyOverflowY: // visible | hidden | scroll | auto | marquee | overlay | inherit if (id == CSSValueVisible || id == CSSValueHidden || id == CSSValueScroll || id == CSSValueAuto || id == CSSValueOverlay || id == CSSValueWebkitMarquee) valid_primitive = true; break; case CSSPropertyListStylePosition: // inside | outside | inherit if (id == CSSValueInside || id == CSSValueOutside) valid_primitive = true; break; case CSSPropertyListStyleType: // disc | circle | square | decimal | decimal-leading-zero | lower-roman | // upper-roman | lower-greek | lower-alpha | lower-latin | upper-alpha | // upper-latin | hebrew | armenian | georgian | cjk-ideographic | hiragana | // katakana | hiragana-iroha | katakana-iroha | none | inherit if ((id >= CSSValueDisc && id <= CSSValueKatakanaIroha) || id == CSSValueNone) valid_primitive = true; break; case CSSPropertyDisplay: // inline | block | list-item | run-in | inline-block | table | // inline-table | table-row-group | table-header-group | table-footer-group | table-row | // table-column-group | table-column | table-cell | table-caption | box | inline-box | none | inherit if ((id >= CSSValueInline && id <= CSSValueWebkitInlineBox) || id == CSSValueNone) valid_primitive = true; break; case CSSPropertyDirection: // ltr | rtl | inherit if (id == CSSValueLtr || id == CSSValueRtl) valid_primitive = true; break; case CSSPropertyTextTransform: // capitalize | uppercase | lowercase | none | inherit if ((id >= CSSValueCapitalize && id <= CSSValueLowercase) || id == CSSValueNone) valid_primitive = true; break; case CSSPropertyFloat: // left | right | none | inherit + center for buggy CSS if (id == CSSValueLeft || id == CSSValueRight || id == CSSValueNone || id == CSSValueCenter) valid_primitive = true; break; case CSSPropertyClear: // none | left | right | both | inherit if (id == CSSValueNone || id == CSSValueLeft || id == CSSValueRight|| id == CSSValueBoth) valid_primitive = true; break; case CSSPropertyTextAlign: // left | right | center | justify | webkit_left | webkit_right | webkit_center | start | end | <string> | inherit if ((id >= CSSValueWebkitAuto && id <= CSSValueWebkitCenter) || id == CSSValueStart || id == CSSValueEnd || value->unit == CSSPrimitiveValue::CSS_STRING) valid_primitive = true; break; case CSSPropertyOutlineStyle: // (<border-style> except hidden) | auto | inherit if (id == CSSValueAuto || id == CSSValueNone || (id >= CSSValueInset && id <= CSSValueDouble)) valid_primitive = true; break; case CSSPropertyBorderTopStyle: //// <border-style> | inherit case CSSPropertyBorderRightStyle: // Defined as: none | hidden | dotted | dashed | case CSSPropertyBorderBottomStyle: // solid | double | groove | ridge | inset | outset case CSSPropertyBorderLeftStyle: case CSSPropertyWebkitColumnRuleStyle: if (id >= CSSValueNone && id <= CSSValueDouble) valid_primitive = true; break; case CSSPropertyFontWeight: // normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | inherit return parseFontWeight(important); case CSSPropertyBorderSpacing: { const int properties[2] = { CSSPropertyWebkitBorderHorizontalSpacing, CSSPropertyWebkitBorderVerticalSpacing }; if (num == 1) { ShorthandScope scope(this, CSSPropertyBorderSpacing); if (!parseValue(properties[0], important)) return false; CSSValue* value = m_parsedProperties[m_numParsedProperties-1]->value(); addProperty(properties[1], value, important); return true; } else if (num == 2) { ShorthandScope scope(this, CSSPropertyBorderSpacing); if (!parseValue(properties[0], important) || !parseValue(properties[1], important)) return false; return true; } return false; } case CSSPropertyWebkitBorderHorizontalSpacing: case CSSPropertyWebkitBorderVerticalSpacing: valid_primitive = validUnit(value, FLength|FNonNeg, m_strict); break; case CSSPropertyOutlineColor: // <color> | invert | inherit // Outline color has "invert" as additional keyword. // Also, we want to allow the special focus color even in strict parsing mode. if (propId == CSSPropertyOutlineColor && (id == CSSValueInvert || id == CSSValueWebkitFocusRingColor)) { valid_primitive = true; break; } /* nobreak */ case CSSPropertyBackgroundColor: // <color> | inherit case CSSPropertyBorderTopColor: // <color> | inherit case CSSPropertyBorderRightColor: // <color> | inherit case CSSPropertyBorderBottomColor: // <color> | inherit case CSSPropertyBorderLeftColor: // <color> | inherit case CSSPropertyColor: // <color> | inherit case CSSPropertyTextLineThroughColor: // CSS3 text decoration colors case CSSPropertyTextUnderlineColor: case CSSPropertyTextOverlineColor: case CSSPropertyWebkitColumnRuleColor: case CSSPropertyWebkitTextFillColor: case CSSPropertyWebkitTextStrokeColor: if (id == CSSValueWebkitText) valid_primitive = true; // Always allow this, even when strict parsing is on, // since we use this in our UA sheets. else if (id == CSSValueCurrentcolor) valid_primitive = true; else if (id >= CSSValueAqua && id <= CSSValueWindowtext || id == CSSValueMenu || (id >= CSSValueWebkitFocusRingColor && id < CSSValueWebkitText && !m_strict)) { valid_primitive = true; } else { parsedValue = parseColor(); if (parsedValue) m_valueList->next(); } break; case CSSPropertyCursor: { // [<uri>,]* [ auto | crosshair | default | pointer | progress | move | e-resize | ne-resize | // nw-resize | n-resize | se-resize | sw-resize | s-resize | w-resize | ew-resize | // ns-resize | nesw-resize | nwse-resize | col-resize | row-resize | text | wait | help | // vertical-text | cell | context-menu | alias | copy | no-drop | not-allowed | -webkit-zoom-in // -webkit-zoom-in | -webkit-zoom-out | all-scroll | -webkit-grab | -webkit-grabbing ] ] | inherit RefPtr<CSSValueList> list; while (value && value->unit == CSSPrimitiveValue::CSS_URI) { if (!list) list = CSSValueList::createCommaSeparated(); String uri = parseURL(value->string); Vector<int> coords; value = m_valueList->next(); while (value && value->unit == CSSPrimitiveValue::CSS_NUMBER) { coords.append(int(value->fValue)); value = m_valueList->next(); } IntPoint hotspot; int nrcoords = coords.size(); if (nrcoords > 0 && nrcoords != 2) { if (m_strict) // only support hotspot pairs in strict mode return false; } else if (m_strict && nrcoords == 2) hotspot = IntPoint(coords[0], coords[1]); if (m_strict || coords.size() == 0) { if (!uri.isNull() && m_styleSheet) list->append(CSSCursorImageValue::create(m_styleSheet->completeURL(uri), hotspot)); } if ((m_strict && !value) || (value && !(value->unit == CSSParserValue::Operator && value->iValue == ','))) return false; value = m_valueList->next(); // comma } if (list) { if (!value) { // no value after url list (MSIE 5 compatibility) if (list->length() != 1) return false; } else if (!m_strict && value->id == CSSValueHand) // MSIE 5 compatibility :/ list->append(CSSPrimitiveValue::createIdentifier(CSSValuePointer)); else if (value && ((value->id >= CSSValueAuto && value->id <= CSSValueWebkitGrabbing) || value->id == CSSValueCopy || value->id == CSSValueNone)) list->append(CSSPrimitiveValue::createIdentifier(value->id)); m_valueList->next(); parsedValue = list.release(); break; } id = value->id; if (!m_strict && value->id == CSSValueHand) { // MSIE 5 compatibility :/ id = CSSValuePointer; valid_primitive = true; } else if ((value->id >= CSSValueAuto && value->id <= CSSValueWebkitGrabbing) || value->id == CSSValueCopy || value->id == CSSValueNone) valid_primitive = true; break; } case CSSPropertyBackgroundAttachment: case CSSPropertyWebkitBackgroundClip: case CSSPropertyWebkitBackgroundComposite: case CSSPropertyBackgroundImage: case CSSPropertyWebkitBackgroundOrigin: case CSSPropertyBackgroundPosition: case CSSPropertyBackgroundPositionX: case CSSPropertyBackgroundPositionY: case CSSPropertyWebkitBackgroundSize: case CSSPropertyBackgroundRepeat: case CSSPropertyWebkitMaskAttachment: case CSSPropertyWebkitMaskClip: case CSSPropertyWebkitMaskComposite: case CSSPropertyWebkitMaskImage: case CSSPropertyWebkitMaskOrigin: case CSSPropertyWebkitMaskPosition: case CSSPropertyWebkitMaskPositionX: case CSSPropertyWebkitMaskPositionY: case CSSPropertyWebkitMaskSize: case CSSPropertyWebkitMaskRepeat: { RefPtr<CSSValue> val1; RefPtr<CSSValue> val2; int propId1, propId2; if (parseFillProperty(propId, propId1, propId2, val1, val2)) { addProperty(propId1, val1.release(), important); if (val2) addProperty(propId2, val2.release(), important); return true; } return false; } case CSSPropertyListStyleImage: // <uri> | none | inherit if (id == CSSValueNone) { parsedValue = CSSImageValue::create(); m_valueList->next(); } else if (value->unit == CSSPrimitiveValue::CSS_URI) { // ### allow string in non strict mode? String uri = parseURL(value->string); if (!uri.isNull() && m_styleSheet) { parsedValue = CSSImageValue::create(m_styleSheet->completeURL(uri)); m_valueList->next(); } } else if (value->unit == CSSParserValue::Function && equalIgnoringCase(value->function->name, "-webkit-gradient(")) { if (parseGradient(parsedValue)) m_valueList->next(); else return false; } break; case CSSPropertyWebkitTextStrokeWidth: case CSSPropertyOutlineWidth: // <border-width> | inherit case CSSPropertyBorderTopWidth: //// <border-width> | inherit case CSSPropertyBorderRightWidth: // Which is defined as case CSSPropertyBorderBottomWidth: // thin | medium | thick | <length> case CSSPropertyBorderLeftWidth: case CSSPropertyWebkitColumnRuleWidth: if (id == CSSValueThin || id == CSSValueMedium || id == CSSValueThick) valid_primitive = true; else valid_primitive = validUnit(value, FLength, m_strict); break; case CSSPropertyLetterSpacing: // normal | <length> | inherit case CSSPropertyWordSpacing: // normal | <length> | inherit if (id == CSSValueNormal) valid_primitive = true; else valid_primitive = validUnit(value, FLength, m_strict); break; case CSSPropertyWordBreak: // normal | break-all | break-word (this is a custom extension) if (id == CSSValueNormal || id == CSSValueBreakAll || id == CSSValueBreakWord) valid_primitive = true; break; case CSSPropertyWordWrap: // normal | break-word if (id == CSSValueNormal || id == CSSValueBreakWord) valid_primitive = true; break; case CSSPropertyTextIndent: // <length> | <percentage> | inherit case CSSPropertyPaddingTop: //// <padding-width> | inherit case CSSPropertyPaddingRight: // Which is defined as case CSSPropertyPaddingBottom: // <length> | <percentage> case CSSPropertyPaddingLeft: //// case CSSPropertyWebkitPaddingStart: valid_primitive = (!id && validUnit(value, FLength|FPercent, m_strict)); break; case CSSPropertyMaxHeight: // <length> | <percentage> | none | inherit case CSSPropertyMaxWidth: // <length> | <percentage> | none | inherit if (id == CSSValueNone || id == CSSValueIntrinsic || id == CSSValueMinIntrinsic) { valid_primitive = true; break; } /* nobreak */ case CSSPropertyMinHeight: // <length> | <percentage> | inherit case CSSPropertyMinWidth: // <length> | <percentage> | inherit if (id == CSSValueIntrinsic || id == CSSValueMinIntrinsic) valid_primitive = true; else valid_primitive = (!id && validUnit(value, FLength|FPercent|FNonNeg, m_strict)); break; case CSSPropertyFontSize: // <absolute-size> | <relative-size> | <length> | <percentage> | inherit if (id >= CSSValueXxSmall && id <= CSSValueLarger) valid_primitive = true; else valid_primitive = (validUnit(value, FLength|FPercent|FNonNeg, m_strict)); break; case CSSPropertyFontStyle: // normal | italic | oblique | inherit return parseFontStyle(important); case CSSPropertyFontVariant: // normal | small-caps | inherit return parseFontVariant(important); case CSSPropertyVerticalAlign: // baseline | sub | super | top | text-top | middle | bottom | text-bottom | // <percentage> | <length> | inherit if (id >= CSSValueBaseline && id <= CSSValueWebkitBaselineMiddle) valid_primitive = true; else valid_primitive = (!id && validUnit(value, FLength|FPercent, m_strict)); break; case CSSPropertyHeight: // <length> | <percentage> | auto | inherit case CSSPropertyWidth: // <length> | <percentage> | auto | inherit if (id == CSSValueAuto || id == CSSValueIntrinsic || id == CSSValueMinIntrinsic) valid_primitive = true; else // ### handle multilength case where we allow relative units valid_primitive = (!id && validUnit(value, FLength|FPercent|FNonNeg, m_strict)); break;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -