Commit cc8a860d authored by hyatt's avatar hyatt

Add support for a new property for custom highlighting. This patch just

        adds support for the parsing of the property.  It doesn't do anything yet.

        Reviewed by beth

        * css/CSSComputedStyleDeclaration.cpp:
        (WebCore::):
        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
        * css/CSSPropertyNames.in:
        * css/cssparser.cpp:
        (WebCore::CSSParser::parseValue):
        * css/cssstyleselector.cpp:
        (WebCore::CSSStyleSelector::applyProperty):
        * rendering/render_style.cpp:
        (WebCore::StyleCSS3InheritedData::StyleCSS3InheritedData):
        (WebCore::StyleCSS3InheritedData::operator==):
        (WebCore::RenderStyle::diff):
        * rendering/render_style.h:
        (WebCore::RenderStyle::highlight):
        (WebCore::RenderStyle::setHighlight):
        (WebCore::RenderStyle::initialHighlight):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@14763 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 2e86f848
2006-06-07 David Hyatt <hyatt@apple.com>
Add support for a new property for custom highlighting. This patch just
adds support for the parsing of the property. It doesn't do anything yet.
Reviewed by beth
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::):
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
* css/CSSPropertyNames.in:
* css/cssparser.cpp:
(WebCore::CSSParser::parseValue):
* css/cssstyleselector.cpp:
(WebCore::CSSStyleSelector::applyProperty):
* rendering/render_style.cpp:
(WebCore::StyleCSS3InheritedData::StyleCSS3InheritedData):
(WebCore::StyleCSS3InheritedData::operator==):
(WebCore::RenderStyle::diff):
* rendering/render_style.h:
(WebCore::RenderStyle::highlight):
(WebCore::RenderStyle::setHighlight):
(WebCore::RenderStyle::initialHighlight):
2006-06-07 Mitz Pettel <opendarwin.org@mitzpettel.com>
Fix suggested by Rob Buis. Reviewed by Darin.
......
......@@ -94,6 +94,7 @@ static const int computedProperties[] = {
CSS_PROP_FONT_VARIANT,
CSS_PROP_FONT_WEIGHT,
CSS_PROP_HEIGHT,
CSS_PROP__WEBKIT_HIGHLIGHT,
CSS_PROP_LEFT,
CSS_PROP_LETTER_SPACING,
CSS_PROP__WEBKIT_LINE_BREAK,
......@@ -707,6 +708,12 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
}
case CSS_PROP_HEIGHT:
return new CSSPrimitiveValue(renderer->contentHeight(), CSSPrimitiveValue::CSS_PX);
case CSS_PROP__WEBKIT_HIGHLIGHT: {
if (style->highlight() == nullAtom)
return new CSSPrimitiveValue(CSS_VAL_NONE);
else
return new CSSPrimitiveValue(style->highlight(), CSSPrimitiveValue::CSS_STRING);
}
case CSS_PROP_LEFT:
return getPositionOffsetValue(renderer, CSS_PROP_LEFT);
case CSS_PROP_LETTER_SPACING:
......
......@@ -71,6 +71,7 @@ font-style
font-variant
font-weight
height
-webkit-highlight
left
letter-spacing
-webkit-line-clamp
......
......@@ -483,13 +483,6 @@ bool CSSParser::parseValue(int propId, bool important)
return parseShape(propId, important);
break;
#if __APPLE__
case CSS_PROP__WEBKIT_DASHBOARD_REGION: // <dashboard-region> | <dashboard-region>
if (value->unit == Value::Function || id == CSS_VAL_NONE)
return parseDashboardRegions(propId, important);
break;
#endif
/* Start of supported CSS properties with validation. This is needed for parseShorthand to work
* correctly and allows optimization in WebCore::applyRule(..)
*/
......@@ -737,25 +730,6 @@ bool CSSParser::parseValue(int propId, bool important)
valid_primitive = true;
break;
case CSS_PROP__WEBKIT_FONT_SIZE_DELTA: // <length>
valid_primitive = validUnit(value, FLength, strict);
break;
case CSS_PROP__WEBKIT_NBSP_MODE: // normal | space
if (id == CSS_VAL_NORMAL || id == CSS_VAL_SPACE)
valid_primitive = true;
break;
case CSS_PROP__WEBKIT_LINE_BREAK: // normal | after-white-space
if (id == CSS_VAL_NORMAL || id == CSS_VAL_AFTER_WHITE_SPACE)
valid_primitive = true;
break;
case CSS_PROP__WEBKIT_MATCH_NEAREST_MAIL_BLOCKQUOTE_COLOR: // normal | match
if (id == CSS_VAL_NORMAL || id == CSS_VAL_MATCH)
valid_primitive = true;
break;
case CSS_PROP_TEXT_INDENT: // <length> | <percentage> | inherit
case CSS_PROP_PADDING_TOP: //// <padding-width> | inherit
case CSS_PROP_PADDING_RIGHT: // Which is defined as
......@@ -1131,6 +1105,38 @@ bool CSSParser::parseValue(int propId, bool important)
if (id == CSS_VAL_LOGICAL || id == CSS_VAL_VISUAL)
valid_primitive = true;
break;
case CSS_PROP__WEBKIT_FONT_SIZE_DELTA: // <length>
valid_primitive = validUnit(value, FLength, strict);
break;
case CSS_PROP__WEBKIT_NBSP_MODE: // normal | space
if (id == CSS_VAL_NORMAL || id == CSS_VAL_SPACE)
valid_primitive = true;
break;
case CSS_PROP__WEBKIT_LINE_BREAK: // normal | after-white-space
if (id == CSS_VAL_NORMAL || id == CSS_VAL_AFTER_WHITE_SPACE)
valid_primitive = true;
break;
case CSS_PROP__WEBKIT_MATCH_NEAREST_MAIL_BLOCKQUOTE_COLOR: // normal | match
if (id == CSS_VAL_NORMAL || id == CSS_VAL_MATCH)
valid_primitive = true;
break;
case CSS_PROP__WEBKIT_HIGHLIGHT:
if (id == CSS_VAL_NONE || value->unit == CSSPrimitiveValue::CSS_STRING)
valid_primitive = true;
break;
#if __APPLE__
case CSS_PROP__WEBKIT_DASHBOARD_REGION: // <dashboard-region> | <dashboard-region>
if (value->unit == Value::Function || id == CSS_VAL_NONE)
return parseDashboardRegions(propId, important);
break;
#endif
// End Apple-specific properties
/* shorthand properties */
case CSS_PROP_BACKGROUND:
......
......@@ -3849,6 +3849,14 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
style->setLineClamp((int)primitiveValue->getFloatValue(CSSPrimitiveValue::CSS_PERCENTAGE));
break;
}
case CSS_PROP__WEBKIT_HIGHLIGHT: {
HANDLE_INHERIT_AND_INITIAL(highlight, Highlight);
if (primitiveValue->getIdent() == CSS_VAL_NONE)
style->setHighlight(nullAtom);
else
style->setHighlight(primitiveValue->getStringValue());
break;
}
case CSS_PROP__WEBKIT_TEXT_SIZE_ADJUST: {
HANDLE_INHERIT_AND_INITIAL(textSizeAdjust, TextSizeAdjust)
if (!primitiveValue || !primitiveValue->getIdent()) return;
......
......@@ -451,6 +451,7 @@ StyleCSS3InheritedData::StyleCSS3InheritedData()
StyleCSS3InheritedData::StyleCSS3InheritedData(const StyleCSS3InheritedData& o)
: Shared<StyleCSS3InheritedData>()
, textShadow(o.textShadow ? new ShadowData(*o.textShadow) : 0)
, highlight(o.highlight)
, userModify(o.userModify)
, wordWrap(o.wordWrap)
, nbspMode(o.nbspMode)
......@@ -469,6 +470,7 @@ bool StyleCSS3InheritedData::operator==(const StyleCSS3InheritedData& o) const
{
return userModify == o.userModify
&& shadowDataEquivalent(o)
&& highlight == o.highlight
&& wordWrap == o.wordWrap
&& nbspMode == o.nbspMode
&& khtmlLineBreak == o.khtmlLineBreak
......@@ -756,7 +758,7 @@ RenderStyle::Diff RenderStyle::diff( const RenderStyle *other ) const
#if SVG_SUPPORT
// This is horribly inefficient. Eventually we'll have to integrate
// this more directly by calling: Diff svgDiff = svgStyle->diff(other)
// and then checking svgDiff and returning from the appropraite places below.
// and then checking svgDiff and returning from the appropriate places below.
if (m_svgStyle != other->m_svgStyle)
return Layout;
#endif
......@@ -793,6 +795,7 @@ RenderStyle::Diff RenderStyle::diff( const RenderStyle *other ) const
css3NonInheritedData->marginBottomCollapse != other->css3NonInheritedData->marginBottomCollapse ||
*css3NonInheritedData->flexibleBox.get() != *other->css3NonInheritedData->flexibleBox.get() ||
(css3NonInheritedData->lineClamp != other->css3NonInheritedData->lineClamp) ||
(css3InheritedData->highlight != other->css3InheritedData->highlight) ||
(css3InheritedData->textSizeAdjust != other->css3InheritedData->textSizeAdjust) ||
(css3InheritedData->wordWrap != other->css3InheritedData->wordWrap) ||
(css3InheritedData->nbspMode != other->css3InheritedData->nbspMode) ||
......
......@@ -757,6 +757,7 @@ public:
bool shadowDataEquivalent(const StyleCSS3InheritedData& o) const;
ShadowData* textShadow; // Our text shadow information for shadowed text drawing.
AtomicString highlight; // Apple-specific extension for custom highlight rendering.
unsigned userModify : 2; // EUserModify (editing)
unsigned wordWrap : 1; // EWordWrap
unsigned nbspMode : 1; // ENBSPMode
......@@ -1337,6 +1338,7 @@ public:
ENBSPMode nbspMode() const { return static_cast<ENBSPMode>(css3InheritedData->nbspMode); }
EKHTMLLineBreak khtmlLineBreak() const { return static_cast<EKHTMLLineBreak>(css3InheritedData->khtmlLineBreak); }
EMatchNearestMailBlockquoteColor matchNearestMailBlockquoteColor() const { return static_cast<EMatchNearestMailBlockquoteColor>(css3NonInheritedData->matchNearestMailBlockquoteColor); }
const AtomicString& highlight() const { return css3InheritedData->highlight; }
EResize resize() const { return static_cast<EResize>(css3InheritedData->resize); }
// End CSS3 Getters
......@@ -1555,6 +1557,7 @@ public:
void setNBSPMode(ENBSPMode b) { SET_VAR(css3InheritedData, nbspMode, b); }
void setKHTMLLineBreak(EKHTMLLineBreak b) { SET_VAR(css3InheritedData, khtmlLineBreak, b); }
void setMatchNearestMailBlockquoteColor(EMatchNearestMailBlockquoteColor c) { SET_VAR(css3NonInheritedData, matchNearestMailBlockquoteColor, c); }
void setHighlight(const AtomicString& h) { SET_VAR(css3InheritedData, highlight, h); }
void setResize(EResize r) { SET_VAR(css3InheritedData, resize, r); }
// End CSS3 Setters
......@@ -1679,6 +1682,7 @@ public:
static ENBSPMode initialNBSPMode() { return NBNORMAL; }
static EKHTMLLineBreak initialKHTMLLineBreak() { return LBNORMAL; }
static EMatchNearestMailBlockquoteColor initialMatchNearestMailBlockquoteColor() { return BCNORMAL; }
static const AtomicString& initialHighlight() { return nullAtom; }
static EResize initialResize() { return RESIZE_NONE; }
static EAppearance initialAppearance() { return NoAppearance; }
static bool initialVisuallyOrdered() { return false; }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment