summaryrefslogtreecommitdiffstats
path: root/WebCore/css
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/css')
-rw-r--r--WebCore/css/CSSComputedStyleDeclaration.cpp176
-rw-r--r--WebCore/css/CSSComputedStyleDeclaration.h2
-rw-r--r--WebCore/css/CSSGrammar.y33
-rw-r--r--WebCore/css/CSSHelper.h17
-rw-r--r--WebCore/css/CSSMutableStyleDeclaration.h2
-rw-r--r--WebCore/css/CSSParser.cpp129
-rw-r--r--WebCore/css/CSSParser.h15
-rw-r--r--WebCore/css/CSSPrimitiveValueMappings.h55
-rw-r--r--WebCore/css/CSSProperty.cpp264
-rw-r--r--WebCore/css/CSSProperty.h3
-rw-r--r--WebCore/css/CSSPropertyNames.in20
-rw-r--r--WebCore/css/CSSPropertySourceData.cpp135
-rw-r--r--WebCore/css/CSSPropertySourceData.h90
-rw-r--r--WebCore/css/CSSStyleSelector.cpp139
-rw-r--r--WebCore/css/CSSStyleSelector.h8
-rw-r--r--WebCore/css/CSSValueKeywords.in14
-rw-r--r--WebCore/css/SVGCSSComputedStyleDeclaration.cpp2
-rw-r--r--WebCore/css/SVGCSSParser.cpp2
-rw-r--r--WebCore/css/SVGCSSValueKeywords.in9
-rw-r--r--WebCore/css/mediaControlsQuickTime.css2
20 files changed, 937 insertions, 180 deletions
diff --git a/WebCore/css/CSSComputedStyleDeclaration.cpp b/WebCore/css/CSSComputedStyleDeclaration.cpp
index d5330c6..369ece9 100644
--- a/WebCore/css/CSSComputedStyleDeclaration.cpp
+++ b/WebCore/css/CSSComputedStyleDeclaration.cpp
@@ -162,6 +162,7 @@ static const int computedProperties[] = {
CSSPropertyWebkitBackgroundComposite,
CSSPropertyWebkitBackgroundOrigin,
CSSPropertyWebkitBackgroundSize,
+ CSSPropertyWebkitBlockFlow,
CSSPropertyWebkitBorderFit,
CSSPropertyWebkitBorderHorizontalSpacing,
CSSPropertyWebkitBorderImage,
@@ -347,7 +348,17 @@ static PassRefPtr<CSSValue> valueForNinePieceImage(const NinePieceImage& image)
return CSSBorderImageValue::create(imageValue, rect, valueForRepeatRule(image.horizontalRule()), valueForRepeatRule(image.verticalRule()));
}
-static PassRefPtr<CSSValue> valueForReflection(const StyleReflection* reflection)
+inline static PassRefPtr<CSSPrimitiveValue> zoomAdjustedPixelValue(int value, const RenderStyle* style)
+{
+ return CSSPrimitiveValue::create(adjustForAbsoluteZoom(value, style), CSSPrimitiveValue::CSS_PX);
+}
+
+inline static PassRefPtr<CSSPrimitiveValue> zoomAdjustedNumberValue(double value, const RenderStyle* style)
+{
+ return CSSPrimitiveValue::create(value / style->effectiveZoom(), CSSPrimitiveValue::CSS_NUMBER);
+}
+
+static PassRefPtr<CSSValue> valueForReflection(const StyleReflection* reflection, const RenderStyle* style)
{
if (!reflection)
return CSSPrimitiveValue::createIdentifier(CSSValueNone);
@@ -356,7 +367,7 @@ static PassRefPtr<CSSValue> valueForReflection(const StyleReflection* reflection
if (reflection->offset().isPercent())
offset = CSSPrimitiveValue::create(reflection->offset().percent(), CSSPrimitiveValue::CSS_PERCENTAGE);
else
- offset = CSSPrimitiveValue::create(reflection->offset().value(), CSSPrimitiveValue::CSS_PX);
+ offset = zoomAdjustedPixelValue(reflection->offset().value(), style);
return CSSReflectValue::create(reflection->direction(), offset.release(), valueForNinePieceImage(reflection->mask()));
}
@@ -384,8 +395,11 @@ static PassRefPtr<CSSValue> getPositionOffsetValue(RenderStyle* style, int prope
return 0;
}
- if (style->position() == AbsolutePosition || style->position() == FixedPosition)
+ if (style->position() == AbsolutePosition || style->position() == FixedPosition) {
+ if (l.type() == WebCore::Fixed)
+ return zoomAdjustedPixelValue(l.value(), style);
return CSSPrimitiveValue::create(l);
+ }
if (style->position() == RelativePosition)
// FIXME: It's not enough to simply return "auto" values for one offset if the other side is defined.
@@ -404,22 +418,22 @@ PassRefPtr<CSSPrimitiveValue> CSSComputedStyleDeclaration::currentColorOrValidCo
return CSSPrimitiveValue::createColor(color.rgb());
}
-static PassRefPtr<CSSValue> getBorderRadiusCornerValue(LengthSize radius)
+static PassRefPtr<CSSValue> getBorderRadiusCornerValue(LengthSize radius, const RenderStyle* style)
{
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
if (radius.width() == radius.height()) {
if (radius.width().type() == Percent)
return CSSPrimitiveValue::create(radius.width().percent(), CSSPrimitiveValue::CSS_PERCENTAGE);
- return CSSPrimitiveValue::create(radius.width().value(), CSSPrimitiveValue::CSS_PX);
+ return zoomAdjustedPixelValue(radius.width().value(), style);
}
if (radius.width().type() == Percent)
list->append(CSSPrimitiveValue::create(radius.width().percent(), CSSPrimitiveValue::CSS_PERCENTAGE));
else
- list->append(CSSPrimitiveValue::create(radius.width().value(), CSSPrimitiveValue::CSS_PX));
+ list->append(zoomAdjustedPixelValue(radius.width().value(), style));
if (radius.height().type() == Percent)
list->append(CSSPrimitiveValue::create(radius.height().percent(), CSSPrimitiveValue::CSS_PERCENTAGE));
else
- list->append(CSSPrimitiveValue::create(radius.height().value(), CSSPrimitiveValue::CSS_PX));
+ list->append(zoomAdjustedPixelValue(radius.height().value(), style));
return list.release();
}
@@ -458,8 +472,8 @@ static PassRefPtr<CSSValue> computedTransform(RenderObject* renderer, const Rend
transformVal->append(CSSPrimitiveValue::create(transform.b(), CSSPrimitiveValue::CSS_NUMBER));
transformVal->append(CSSPrimitiveValue::create(transform.c(), CSSPrimitiveValue::CSS_NUMBER));
transformVal->append(CSSPrimitiveValue::create(transform.d(), CSSPrimitiveValue::CSS_NUMBER));
- transformVal->append(CSSPrimitiveValue::create(transform.e(), CSSPrimitiveValue::CSS_NUMBER));
- transformVal->append(CSSPrimitiveValue::create(transform.f(), CSSPrimitiveValue::CSS_NUMBER));
+ transformVal->append(zoomAdjustedNumberValue(transform.e(), style));
+ transformVal->append(zoomAdjustedNumberValue(transform.f(), style));
} else {
transformVal = WebKitCSSTransformValue::create(WebKitCSSTransformValue::Matrix3DTransformOperation);
@@ -478,9 +492,9 @@ static PassRefPtr<CSSValue> computedTransform(RenderObject* renderer, const Rend
transformVal->append(CSSPrimitiveValue::create(transform.m33(), CSSPrimitiveValue::CSS_NUMBER));
transformVal->append(CSSPrimitiveValue::create(transform.m34(), CSSPrimitiveValue::CSS_NUMBER));
- transformVal->append(CSSPrimitiveValue::create(transform.m41(), CSSPrimitiveValue::CSS_NUMBER));
- transformVal->append(CSSPrimitiveValue::create(transform.m42(), CSSPrimitiveValue::CSS_NUMBER));
- transformVal->append(CSSPrimitiveValue::create(transform.m43(), CSSPrimitiveValue::CSS_NUMBER));
+ transformVal->append(zoomAdjustedNumberValue(transform.m41(), style));
+ transformVal->append(zoomAdjustedNumberValue(transform.m42(), style));
+ transformVal->append(zoomAdjustedNumberValue(transform.m43(), style));
transformVal->append(CSSPrimitiveValue::create(transform.m44(), CSSPrimitiveValue::CSS_NUMBER));
}
@@ -534,12 +548,12 @@ static PassRefPtr<CSSValue> getTimingFunctionValue(const AnimationList* animList
}
} else {
// Note that initialAnimationTimingFunction() is used for both transitions and animations
- const TimingFunction* tf = Animation::initialAnimationTimingFunction().get();
+ RefPtr<TimingFunction> tf = Animation::initialAnimationTimingFunction();
if (tf->isCubicBezierTimingFunction()) {
- const CubicBezierTimingFunction* ctf = static_cast<const CubicBezierTimingFunction*>(tf);
+ const CubicBezierTimingFunction* ctf = static_cast<const CubicBezierTimingFunction*>(tf.get());
list->append(CSSCubicBezierTimingFunctionValue::create(ctf->x1(), ctf->y1(), ctf->x2(), ctf->y2()));
} else if (tf->isStepsTimingFunction()) {
- const StepsTimingFunction* stf = static_cast<const StepsTimingFunction*>(tf);
+ const StepsTimingFunction* stf = static_cast<const StepsTimingFunction*>(tf.get());
list->append(CSSStepsTimingFunctionValue::create(stf->numberOfSteps(), stf->stepAtStart()));
} else {
list->append(CSSLinearTimingFunctionValue::create());
@@ -603,7 +617,8 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getFontSizeCSSValuePreferringK
if (int keywordSize = style->fontDescription().keywordSize())
return CSSPrimitiveValue::createIdentifier(cssIdentifierForFontSizeKeyword(keywordSize));
- return CSSPrimitiveValue::create(style->fontDescription().computedPixelSize(), CSSPrimitiveValue::CSS_PX);
+
+ return zoomAdjustedPixelValue(style->fontDescription().computedPixelSize(), style.get());
}
bool CSSComputedStyleDeclaration::useFixedFontDefaultSize() const
@@ -618,7 +633,7 @@ bool CSSComputedStyleDeclaration::useFixedFontDefaultSize() const
return style->fontDescription().useFixedDefaultSize();
}
-PassRefPtr<CSSValue> CSSComputedStyleDeclaration::valueForShadow(const ShadowData* shadow, int id) const
+PassRefPtr<CSSValue> CSSComputedStyleDeclaration::valueForShadow(const ShadowData* shadow, int id, RenderStyle* style) const
{
if (!shadow)
return CSSPrimitiveValue::createIdentifier(CSSValueNone);
@@ -627,10 +642,10 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::valueForShadow(const ShadowDat
RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
for (const ShadowData* s = shadow; s; s = s->next()) {
- RefPtr<CSSPrimitiveValue> x = CSSPrimitiveValue::create(s->x(), CSSPrimitiveValue::CSS_PX);
- RefPtr<CSSPrimitiveValue> y = CSSPrimitiveValue::create(s->y(), CSSPrimitiveValue::CSS_PX);
- RefPtr<CSSPrimitiveValue> blur = CSSPrimitiveValue::create(s->blur(), CSSPrimitiveValue::CSS_PX);
- RefPtr<CSSPrimitiveValue> spread = propertyID == CSSPropertyTextShadow ? 0 : CSSPrimitiveValue::create(s->spread(), CSSPrimitiveValue::CSS_PX);
+ RefPtr<CSSPrimitiveValue> x = zoomAdjustedPixelValue(s->x(), style);
+ RefPtr<CSSPrimitiveValue> y = zoomAdjustedPixelValue(s->y(), style);
+ RefPtr<CSSPrimitiveValue> blur = zoomAdjustedPixelValue(s->blur(), style);
+ RefPtr<CSSPrimitiveValue> spread = propertyID == CSSPropertyTextShadow ? 0 : zoomAdjustedPixelValue(s->spread(), style);
RefPtr<CSSPrimitiveValue> style = propertyID == CSSPropertyTextShadow || s->style() == Normal ? 0 : CSSPrimitiveValue::createIdentifier(CSSValueInset);
RefPtr<CSSPrimitiveValue> color = CSSPrimitiveValue::createColor(s->color().rgb());
list->prepend(ShadowValue::create(x.release(), y.release(), blur.release(), spread.release(), style.release(), color.release()));
@@ -738,10 +753,14 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
if (!style)
return 0;
+<<<<<<< HEAD
propertyID = CSSProperty::resolveDirectionAwareProperty(propertyID, style->direction());
#ifdef ANDROID_LAYOUT
const Settings * settings = node->document()->frame() ? node->document()->frame()->settings() : 0;
#endif
+=======
+ propertyID = CSSProperty::resolveDirectionAwareProperty(propertyID, style->direction(), style->blockFlow());
+>>>>>>> webkit.org at r67908
switch (static_cast<CSSPropertyID>(propertyID)) {
case CSSPropertyInvalid:
@@ -797,14 +816,14 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
return CSSPrimitiveValue::createIdentifier(CSSValueSeparate);
case CSSPropertyBorderSpacing: {
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
- list->append(CSSPrimitiveValue::create(style->horizontalBorderSpacing(), CSSPrimitiveValue::CSS_PX));
- list->append(CSSPrimitiveValue::create(style->verticalBorderSpacing(), CSSPrimitiveValue::CSS_PX));
+ list->append(zoomAdjustedPixelValue(style->horizontalBorderSpacing(), style.get()));
+ list->append(zoomAdjustedPixelValue(style->verticalBorderSpacing(), style.get()));
return list.release();
}
case CSSPropertyWebkitBorderHorizontalSpacing:
- return CSSPrimitiveValue::create(style->horizontalBorderSpacing(), CSSPrimitiveValue::CSS_PX);
+ return zoomAdjustedPixelValue(style->horizontalBorderSpacing(), style.get());
case CSSPropertyWebkitBorderVerticalSpacing:
- return CSSPrimitiveValue::create(style->verticalBorderSpacing(), CSSPrimitiveValue::CSS_PX);
+ return zoomAdjustedPixelValue(style->verticalBorderSpacing(), style.get());
case CSSPropertyBorderTopColor:
return m_allowVisitedStyle ? CSSPrimitiveValue::createColor(style->visitedDependentColor(CSSPropertyBorderTopColor).rgb()) : currentColorOrValidColor(style.get(), style->borderTopColor());
case CSSPropertyBorderRightColor:
@@ -822,13 +841,13 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
case CSSPropertyBorderLeftStyle:
return CSSPrimitiveValue::create(style->borderLeftStyle());
case CSSPropertyBorderTopWidth:
- return CSSPrimitiveValue::create(style->borderTopWidth(), CSSPrimitiveValue::CSS_PX);
+ return zoomAdjustedPixelValue(style->borderTopWidth(), style.get());
case CSSPropertyBorderRightWidth:
- return CSSPrimitiveValue::create(style->borderRightWidth(), CSSPrimitiveValue::CSS_PX);
+ return zoomAdjustedPixelValue(style->borderRightWidth(), style.get());
case CSSPropertyBorderBottomWidth:
- return CSSPrimitiveValue::create(style->borderBottomWidth(), CSSPrimitiveValue::CSS_PX);
+ return zoomAdjustedPixelValue(style->borderBottomWidth(), style.get());
case CSSPropertyBorderLeftWidth:
- return CSSPrimitiveValue::create(style->borderLeftWidth(), CSSPrimitiveValue::CSS_PX);
+ return zoomAdjustedPixelValue(style->borderLeftWidth(), style.get());
case CSSPropertyBottom:
return getPositionOffsetValue(style.get(), CSSPropertyBottom);
case CSSPropertyWebkitBoxAlign:
@@ -854,9 +873,9 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
return CSSPrimitiveValue::create(boxPack);
}
case CSSPropertyWebkitBoxReflect:
- return valueForReflection(style->boxReflect());
+ return valueForReflection(style->boxReflect(), style.get());
case CSSPropertyWebkitBoxShadow:
- return valueForShadow(style->boxShadow(), propertyID);
+ return valueForShadow(style->boxShadow(), propertyID, style.get());
case CSSPropertyCaptionSide:
return CSSPrimitiveValue::create(style->captionSide());
case CSSPropertyClear:
@@ -876,7 +895,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
case CSSPropertyWebkitColumnRuleStyle:
return CSSPrimitiveValue::create(style->columnRuleStyle());
case CSSPropertyWebkitColumnRuleWidth:
- return CSSPrimitiveValue::create(style->columnRuleWidth(), CSSPrimitiveValue::CSS_PX);
+ return zoomAdjustedPixelValue(style->columnRuleWidth(), style.get());
case CSSPropertyWebkitColumnSpan:
if (style->columnSpan())
return CSSPrimitiveValue::createIdentifier(CSSValueAll);
@@ -928,7 +947,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
return list.release();
}
case CSSPropertyFontSize:
- return CSSPrimitiveValue::create(style->fontDescription().computedPixelSize(), CSSPrimitiveValue::CSS_PX);
+ return zoomAdjustedPixelValue(style->fontDescription().computedPixelSize(), style.get());
case CSSPropertyFontStyle:
if (style->fontDescription().italic())
return CSSPrimitiveValue::createIdentifier(CSSValueItalic);
@@ -962,7 +981,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
return CSSPrimitiveValue::createIdentifier(CSSValueNormal);
case CSSPropertyHeight:
if (renderer)
- return CSSPrimitiveValue::create(sizingBox(renderer).height(), CSSPrimitiveValue::CSS_PX);
+ return zoomAdjustedPixelValue(sizingBox(renderer).height(), style.get());
return CSSPrimitiveValue::create(style->height());
case CSSPropertyWebkitHighlight:
if (style->highlight() == nullAtom)
@@ -987,7 +1006,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
case CSSPropertyLetterSpacing:
if (!style->letterSpacing())
return CSSPrimitiveValue::createIdentifier(CSSValueNormal);
- return CSSPrimitiveValue::create(style->letterSpacing(), CSSPrimitiveValue::CSS_PX);
+ return zoomAdjustedPixelValue(style->letterSpacing(), style.get());
case CSSPropertyWebkitLineClamp:
if (style->lineClamp().isNone())
return CSSPrimitiveValue::createIdentifier(CSSValueNone);
@@ -1001,8 +1020,8 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
// for how high to be in pixels does include things like minimum font size and the zoom factor.
// On the other hand, since font-size doesn't include the zoom factor, we really can't do
// that here either.
- return CSSPrimitiveValue::create(static_cast<int>(length.percent() * style->fontDescription().specifiedSize()) / 100, CSSPrimitiveValue::CSS_PX);
- return CSSPrimitiveValue::create(length.value(), CSSPrimitiveValue::CSS_PX);
+ return zoomAdjustedPixelValue(static_cast<int>(length.percent() * style->fontDescription().specifiedSize()) / 100, style.get());
+ return zoomAdjustedPixelValue(length.value(), style.get());
}
case CSSPropertyListStyleImage:
if (style->listStyleImage())
@@ -1015,22 +1034,22 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
case CSSPropertyMarginTop:
if (renderer && renderer->isBox())
// FIXME: Supposed to return the percentage if percentage was specified.
- return CSSPrimitiveValue::create(toRenderBox(renderer)->marginTop(), CSSPrimitiveValue::CSS_PX);
+ return zoomAdjustedPixelValue(toRenderBox(renderer)->marginTop(), style.get());
return CSSPrimitiveValue::create(style->marginTop());
case CSSPropertyMarginRight:
if (renderer && renderer->isBox())
// FIXME: Supposed to return the percentage if percentage was specified.
- return CSSPrimitiveValue::create(toRenderBox(renderer)->marginRight(), CSSPrimitiveValue::CSS_PX);
+ return zoomAdjustedPixelValue(toRenderBox(renderer)->marginRight(), style.get());
return CSSPrimitiveValue::create(style->marginRight());
case CSSPropertyMarginBottom:
if (renderer && renderer->isBox())
// FIXME: Supposed to return the percentage if percentage was specified.
- return CSSPrimitiveValue::create(toRenderBox(renderer)->marginBottom(), CSSPrimitiveValue::CSS_PX);
+ return zoomAdjustedPixelValue(toRenderBox(renderer)->marginBottom(), style.get());
return CSSPrimitiveValue::create(style->marginBottom());
case CSSPropertyMarginLeft:
if (renderer && renderer->isBox())
// FIXME: Supposed to return the percentage if percentage was specified.
- return CSSPrimitiveValue::create(toRenderBox(renderer)->marginLeft(), CSSPrimitiveValue::CSS_PX);
+ return zoomAdjustedPixelValue(toRenderBox(renderer)->marginLeft(), style.get());
return CSSPrimitiveValue::create(style->marginLeft());
case CSSPropertyWebkitMarqueeDirection:
return CSSPrimitiveValue::create(style->marqueeDirection());
@@ -1109,7 +1128,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
return CSSPrimitiveValue::createIdentifier(CSSValueAuto);
return CSSPrimitiveValue::create(style->outlineStyle());
case CSSPropertyOutlineWidth:
- return CSSPrimitiveValue::create(style->outlineWidth(), CSSPrimitiveValue::CSS_PX);
+ return zoomAdjustedPixelValue(style->outlineWidth(), style.get());
case CSSPropertyOverflow:
return CSSPrimitiveValue::create(max(style->overflowX(), style->overflowY()));
case CSSPropertyOverflowX:
@@ -1122,19 +1141,19 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
return CSSPrimitiveValue::create(style->overflowY());
case CSSPropertyPaddingTop:
if (renderer && renderer->isBox())
- return CSSPrimitiveValue::create(toRenderBox(renderer)->paddingTop(false), CSSPrimitiveValue::CSS_PX);
+ return zoomAdjustedPixelValue(toRenderBox(renderer)->paddingTop(false), style.get());
return CSSPrimitiveValue::create(style->paddingTop());
case CSSPropertyPaddingRight:
if (renderer && renderer->isBox())
- return CSSPrimitiveValue::create(toRenderBox(renderer)->paddingRight(false), CSSPrimitiveValue::CSS_PX);
+ return zoomAdjustedPixelValue(toRenderBox(renderer)->paddingRight(false), style.get());
return CSSPrimitiveValue::create(style->paddingRight());
case CSSPropertyPaddingBottom:
if (renderer && renderer->isBox())
- return CSSPrimitiveValue::create(toRenderBox(renderer)->paddingBottom(false), CSSPrimitiveValue::CSS_PX);
+ return zoomAdjustedPixelValue(toRenderBox(renderer)->paddingBottom(false), style.get());
return CSSPrimitiveValue::create(style->paddingBottom());
case CSSPropertyPaddingLeft:
if (renderer && renderer->isBox())
- return CSSPrimitiveValue::create(toRenderBox(renderer)->paddingLeft(false), CSSPrimitiveValue::CSS_PX);
+ return zoomAdjustedPixelValue(toRenderBox(renderer)->paddingLeft(false), style.get());
return CSSPrimitiveValue::create(style->paddingLeft());
case CSSPropertyPageBreakAfter:
return CSSPrimitiveValue::create(style->pageBreakAfter());
@@ -1168,7 +1187,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
case CSSPropertyTextIndent:
return CSSPrimitiveValue::create(style->textIndent());
case CSSPropertyTextShadow:
- return valueForShadow(style->textShadow(), propertyID);
+ return valueForShadow(style->textShadow(), propertyID, style.get());
case CSSPropertyTextRendering:
return CSSPrimitiveValue::create(style->fontDescription().textRenderingMode());
case CSSPropertyTextOverflow:
@@ -1184,7 +1203,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
case CSSPropertyWebkitTextStrokeColor:
return currentColorOrValidColor(style.get(), style->textStrokeColor());
case CSSPropertyWebkitTextStrokeWidth:
- return CSSPrimitiveValue::create(style->textStrokeWidth(), CSSPrimitiveValue::CSS_PX);
+ return zoomAdjustedPixelValue(style->textStrokeWidth(), style.get());
case CSSPropertyTextTransform:
return CSSPrimitiveValue::create(style->textTransform());
case CSSPropertyTop:
@@ -1243,12 +1262,12 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
return CSSPrimitiveValue::create(style->widows(), CSSPrimitiveValue::CSS_NUMBER);
case CSSPropertyWidth:
if (renderer)
- return CSSPrimitiveValue::create(sizingBox(renderer).width(), CSSPrimitiveValue::CSS_PX);
+ return zoomAdjustedPixelValue(sizingBox(renderer).width(), style.get());
return CSSPrimitiveValue::create(style->width());
case CSSPropertyWordBreak:
return CSSPrimitiveValue::create(style->wordBreak());
case CSSPropertyWordSpacing:
- return CSSPrimitiveValue::create(style->wordSpacing(), CSSPrimitiveValue::CSS_PX);
+ return zoomAdjustedPixelValue(style->wordSpacing(), style.get());
case CSSPropertyWordWrap:
return CSSPrimitiveValue::create(style->wordWrap());
case CSSPropertyWebkitLineBreak:
@@ -1287,10 +1306,10 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
region->m_label = styleRegion.label;
LengthBox offset = styleRegion.offset;
- region->setTop(CSSPrimitiveValue::create(offset.top().value(), CSSPrimitiveValue::CSS_PX));
- region->setRight(CSSPrimitiveValue::create(offset.right().value(), CSSPrimitiveValue::CSS_PX));
- region->setBottom(CSSPrimitiveValue::create(offset.bottom().value(), CSSPrimitiveValue::CSS_PX));
- region->setLeft(CSSPrimitiveValue::create(offset.left().value(), CSSPrimitiveValue::CSS_PX));
+ region->setTop(zoomAdjustedPixelValue(offset.top().value(), style.get()));
+ region->setRight(zoomAdjustedPixelValue(offset.right().value(), style.get()));
+ region->setBottom(zoomAdjustedPixelValue(offset.bottom().value(), style.get()));
+ region->setLeft(zoomAdjustedPixelValue(offset.left().value(), style.get()));
region->m_isRectangle = (styleRegion.type == StyleDashboardRegion::Rectangle);
region->m_isCircle = (styleRegion.type == StyleDashboardRegion::Circle);
@@ -1392,6 +1411,8 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
return CSSPrimitiveValue::create(style->appearance());
case CSSPropertyWebkitBackfaceVisibility:
return CSSPrimitiveValue::createIdentifier((style->backfaceVisibility() == BackfaceVisibilityHidden) ? CSSValueHidden : CSSValueVisible);
+ case CSSPropertyWebkitBlockFlow:
+ return CSSPrimitiveValue::create(style->blockFlow());
case CSSPropertyWebkitBorderImage:
return valueForNinePieceImage(style->borderImage());
case CSSPropertyWebkitMaskBoxImage:
@@ -1411,8 +1432,8 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
if (renderer) {
IntRect box = sizingBox(renderer);
- list->append(CSSPrimitiveValue::create(style->perspectiveOriginX().calcMinValue(box.width()), CSSPrimitiveValue::CSS_PX));
- list->append(CSSPrimitiveValue::create(style->perspectiveOriginY().calcMinValue(box.height()), CSSPrimitiveValue::CSS_PX));
+ list->append(zoomAdjustedPixelValue(style->perspectiveOriginX().calcMinValue(box.width()), style.get()));
+ list->append(zoomAdjustedPixelValue(style->perspectiveOriginY().calcMinValue(box.height()), style.get()));
}
else {
list->append(CSSPrimitiveValue::create(style->perspectiveOriginX()));
@@ -1429,21 +1450,21 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
case CSSPropertyWebkitUserSelect:
return CSSPrimitiveValue::create(style->userSelect());
case CSSPropertyBorderBottomLeftRadius:
- return getBorderRadiusCornerValue(style->borderBottomLeftRadius());
+ return getBorderRadiusCornerValue(style->borderBottomLeftRadius(), style.get());
case CSSPropertyBorderBottomRightRadius:
- return getBorderRadiusCornerValue(style->borderBottomRightRadius());
+ return getBorderRadiusCornerValue(style->borderBottomRightRadius(), style.get());
case CSSPropertyBorderTopLeftRadius:
- return getBorderRadiusCornerValue(style->borderTopLeftRadius());
+ return getBorderRadiusCornerValue(style->borderTopLeftRadius(), style.get());
case CSSPropertyBorderTopRightRadius:
- return getBorderRadiusCornerValue(style->borderTopRightRadius());
+ return getBorderRadiusCornerValue(style->borderTopRightRadius(), style.get());
case CSSPropertyClip: {
if (!style->hasClip())
return CSSPrimitiveValue::createIdentifier(CSSValueAuto);
RefPtr<Rect> rect = Rect::create();
- rect->setTop(CSSPrimitiveValue::create(style->clip().top().value(), CSSPrimitiveValue::CSS_PX));
- rect->setRight(CSSPrimitiveValue::create(style->clip().right().value(), CSSPrimitiveValue::CSS_PX));
- rect->setBottom(CSSPrimitiveValue::create(style->clip().bottom().value(), CSSPrimitiveValue::CSS_PX));
- rect->setLeft(CSSPrimitiveValue::create(style->clip().left().value(), CSSPrimitiveValue::CSS_PX));
+ rect->setTop(zoomAdjustedPixelValue(style->clip().top().value(), style.get()));
+ rect->setRight(zoomAdjustedPixelValue(style->clip().right().value(), style.get()));
+ rect->setBottom(zoomAdjustedPixelValue(style->clip().bottom().value(), style.get()));
+ rect->setLeft(zoomAdjustedPixelValue(style->clip().left().value(), style.get()));
return CSSPrimitiveValue::create(rect.release());
}
case CSSPropertyWebkitTransform:
@@ -1452,15 +1473,15 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
if (renderer) {
IntRect box = sizingBox(renderer);
- list->append(CSSPrimitiveValue::create(style->transformOriginX().calcMinValue(box.width()), CSSPrimitiveValue::CSS_PX));
- list->append(CSSPrimitiveValue::create(style->transformOriginY().calcMinValue(box.height()), CSSPrimitiveValue::CSS_PX));
+ list->append(zoomAdjustedPixelValue(style->transformOriginX().calcMinValue(box.width()), style.get()));
+ list->append(zoomAdjustedPixelValue(style->transformOriginY().calcMinValue(box.height()), style.get()));
if (style->transformOriginZ() != 0)
- list->append(CSSPrimitiveValue::create(style->transformOriginZ(), CSSPrimitiveValue::CSS_PX));
+ list->append(zoomAdjustedPixelValue(style->transformOriginZ(), style.get()));
} else {
list->append(CSSPrimitiveValue::create(style->transformOriginX()));
list->append(CSSPrimitiveValue::create(style->transformOriginY()));
if (style->transformOriginZ() != 0)
- list->append(CSSPrimitiveValue::create(style->transformOriginZ(), CSSPrimitiveValue::CSS_PX));
+ list->append(zoomAdjustedPixelValue(style->transformOriginZ(), style.get()));
}
return list.release();
}
@@ -1511,6 +1532,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
case CSSPropertyListStyle:
case CSSPropertyMargin:
case CSSPropertyPadding:
+ case CSSPropertyWebkitWritingMode:
break;
/* Unimplemented CSS 3 properties (including CSS3 shorthand properties) */
@@ -1540,10 +1562,28 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
case CSSPropertyWebkitBorderStartColor:
case CSSPropertyWebkitBorderStartStyle:
case CSSPropertyWebkitBorderStartWidth:
+ case CSSPropertyWebkitBorderAfter:
+ case CSSPropertyWebkitBorderAfterColor:
+ case CSSPropertyWebkitBorderAfterStyle:
+ case CSSPropertyWebkitBorderAfterWidth:
+ case CSSPropertyWebkitBorderBefore:
+ case CSSPropertyWebkitBorderBeforeColor:
+ case CSSPropertyWebkitBorderBeforeStyle:
+ case CSSPropertyWebkitBorderBeforeWidth:
case CSSPropertyWebkitMarginEnd:
case CSSPropertyWebkitMarginStart:
+ case CSSPropertyWebkitMarginAfter:
+ case CSSPropertyWebkitMarginBefore:
case CSSPropertyWebkitPaddingEnd:
case CSSPropertyWebkitPaddingStart:
+ case CSSPropertyWebkitPaddingAfter:
+ case CSSPropertyWebkitPaddingBefore:
+ case CSSPropertyWebkitLogicalWidth:
+ case CSSPropertyWebkitLogicalHeight:
+ case CSSPropertyWebkitMinLogicalWidth:
+ case CSSPropertyWebkitMinLogicalHeight:
+ case CSSPropertyWebkitMaxLogicalWidth:
+ case CSSPropertyWebkitMaxLogicalHeight:
ASSERT_NOT_REACHED();
break;
diff --git a/WebCore/css/CSSComputedStyleDeclaration.h b/WebCore/css/CSSComputedStyleDeclaration.h
index d4b7df2..718eb2d 100644
--- a/WebCore/css/CSSComputedStyleDeclaration.h
+++ b/WebCore/css/CSSComputedStyleDeclaration.h
@@ -74,7 +74,7 @@ private:
virtual String removeProperty(int propertyID, ExceptionCode&);
virtual void setProperty(int propertyId, const String& value, bool important, ExceptionCode&);
- PassRefPtr<CSSValue> valueForShadow(const ShadowData*, int) const;
+ PassRefPtr<CSSValue> valueForShadow(const ShadowData*, int, RenderStyle*) const;
PassRefPtr<CSSPrimitiveValue> currentColorOrValidColor(RenderStyle*, const Color&) const;
RefPtr<Node> m_node;
diff --git a/WebCore/css/CSSGrammar.y b/WebCore/css/CSSGrammar.y
index 86a2f7c..c55f998 100644
--- a/WebCore/css/CSSGrammar.y
+++ b/WebCore/css/CSSGrammar.y
@@ -314,7 +314,7 @@ webkit_keyframe_rule:
;
webkit_decls:
- WEBKIT_DECLS_SYM '{' maybe_space declaration_list '}' {
+ WEBKIT_DECLS_SYM '{' maybe_space_before_declaration declaration_list '}' {
/* can be empty */
}
;
@@ -903,8 +903,15 @@ unary_operator:
| '+' { $$ = 1; }
;
+maybe_space_before_declaration:
+ maybe_space {
+ CSSParser* p = static_cast<CSSParser*>(parser);
+ p->markPropertyStart();
+ }
+ ;
+
ruleset:
- selector_list '{' maybe_space declaration_list closing_brace {
+ selector_list '{' maybe_space_before_declaration declaration_list closing_brace {
CSSParser* p = static_cast<CSSParser*>(parser);
$$ = p->createStyleRule($1);
}
@@ -1355,6 +1362,8 @@ declaration_list:
decl_list:
declaration ';' maybe_space {
+ CSSParser* p = static_cast<CSSParser*>(parser);
+ p->markPropertyStart();
$$ = $1;
}
| declaration invalid_block_list maybe_space {
@@ -1364,12 +1373,16 @@ decl_list:
$$ = false;
}
| error ';' maybe_space {
+ CSSParser* p = static_cast<CSSParser*>(parser);
+ p->markPropertyStart();
$$ = false;
}
| error invalid_block_list error ';' maybe_space {
$$ = false;
}
| decl_list declaration ';' maybe_space {
+ CSSParser* p = static_cast<CSSParser*>(parser);
+ p->markPropertyStart();
$$ = $1;
if ($2)
$$ = $2;
@@ -1386,15 +1399,21 @@ declaration:
property ':' maybe_space expr prio {
$$ = false;
CSSParser* p = static_cast<CSSParser*>(parser);
+ bool isPropertyParsed = false;
if ($1 && $4) {
p->m_valueList = p->sinkFloatingValueList($4);
int oldParsedProperties = p->m_numParsedProperties;
$$ = p->parseValue($1, $5);
- if (!$$)
+ if (!$$) {
+ if (static_cast<int>(p->m_numParsedProperties) == oldParsedProperties)
+ isPropertyParsed = true;
p->rollbackLastProperties(p->m_numParsedProperties - oldParsedProperties);
+ } else
+ isPropertyParsed = true;
delete p->m_valueList;
p->m_valueList = 0;
}
+ p->markPropertyEnd($5, isPropertyParsed);
}
|
variable_reference maybe_space {
@@ -1417,11 +1436,15 @@ declaration:
/* The default movable type template has letter-spacing: .none; Handle this by looking for
error tokens at the start of an expr, recover the expr and then treat as an error, cleaning
up and deleting the shifted expr. */
+ CSSParser* p = static_cast<CSSParser*>(parser);
+ p->markPropertyEnd(false, false);
$$ = false;
}
|
property ':' maybe_space expr prio error {
/* When we encounter something like p {color: red !important fail;} we should drop the declaration */
+ CSSParser* p = static_cast<CSSParser*>(parser);
+ p->markPropertyEnd(false, false);
$$ = false;
}
|
@@ -1432,11 +1455,15 @@ declaration:
|
property ':' maybe_space {
/* div { font-family: } Just reduce away this property with no value. */
+ CSSParser* p = static_cast<CSSParser*>(parser);
+ p->markPropertyEnd(false, false);
$$ = false;
}
|
property ':' maybe_space error {
/* if we come across rules with invalid values like this case: p { weight: *; }, just discard the rule */
+ CSSParser* p = static_cast<CSSParser*>(parser);
+ p->markPropertyEnd(false, false);
$$ = false;
}
|
diff --git a/WebCore/css/CSSHelper.h b/WebCore/css/CSSHelper.h
index 331815e..ffd9166 100644
--- a/WebCore/css/CSSHelper.h
+++ b/WebCore/css/CSSHelper.h
@@ -26,17 +26,14 @@
namespace WebCore {
- // Used in many inappropriate contexts throughout WebCore. We'll have to examine and test
- // each call site to find out whether it needs the various things this function does. That
- // includes trimming leading and trailing control characters (including whitespace), removing
- // url() or URL() if it surrounds the entire string, removing matching quote marks if present,
- // and stripping all characters in the range U+0000-U+000C. Probably no caller needs this.
- String deprecatedParseURL(const String&);
+// Used in many inappropriate contexts throughout WebCore. Most callers should be using
+// stripLeadingAndTrailingHTMLSpaces instead.
+String deprecatedParseURL(const String&);
- // We always assume 96 CSS pixels in a CSS inch. This is the cold hard truth of the Web.
- // At high DPI, we may scale a CSS pixel, but the ratio of the CSS pixel to the so-called
- // "absolute" CSS length units like inch and pt is always fixed and never changes.
- const float cssPixelsPerInch = 96;
+// We always assume 96 CSS pixels in a CSS inch. This is the cold hard truth of the Web.
+// At high DPI, we may scale a CSS pixel, but the ratio of the CSS pixel to the so-called
+// "absolute" CSS length units like inch and pt is always fixed and never changes.
+const float cssPixelsPerInch = 96;
} // namespace WebCore
diff --git a/WebCore/css/CSSMutableStyleDeclaration.h b/WebCore/css/CSSMutableStyleDeclaration.h
index f7759f4..d629bcf 100644
--- a/WebCore/css/CSSMutableStyleDeclaration.h
+++ b/WebCore/css/CSSMutableStyleDeclaration.h
@@ -83,6 +83,8 @@ public:
void setNode(Node* node) { m_node = node; }
+ Node* node() const { return m_node; }
+
virtual bool isMutableStyleDeclaration() const { return true; }
virtual String cssText() const;
diff --git a/WebCore/css/CSSParser.cpp b/WebCore/css/CSSParser.cpp
index 8398bd0..d4fb713 100644
--- a/WebCore/css/CSSParser.cpp
+++ b/WebCore/css/CSSParser.cpp
@@ -44,6 +44,7 @@
#include "CSSPrimitiveValue.h"
#include "CSSProperty.h"
#include "CSSPropertyNames.h"
+#include "CSSPropertySourceData.h"
#include "CSSQuirkPrimitiveValue.h"
#include "CSSReflectValue.h"
#include "CSSRuleList.h"
@@ -151,7 +152,10 @@ CSSParser::CSSParser(bool strictParsing)
, m_defaultNamespace(starAtom)
, m_ruleBodyStartOffset(0)
, m_ruleBodyEndOffset(0)
- , m_ruleRanges(0)
+ , m_propertyStartOffset(UINT_MAX)
+ , m_propertyEndOffset(UINT_MAX)
+ , m_ruleRangeMap(0)
+ , m_currentStyleData(0)
, m_data(0)
, yy_start(1)
, m_lineNumber(0)
@@ -163,6 +167,7 @@ CSSParser::CSSParser(bool strictParsing)
#if YYDEBUG > 0
cssyydebug = 1;
#endif
+ CSSPropertySourceData::init();
}
CSSParser::~CSSParser()
@@ -225,19 +230,22 @@ void CSSParser::setupParser(const char* prefix, const String& string, const char
resetRuleBodyMarks();
}
-void CSSParser::parseSheet(CSSStyleSheet* sheet, const String& string, int startLineNumber, StyleRuleRanges* ruleRangeMap)
+void CSSParser::parseSheet(CSSStyleSheet* sheet, const String& string, int startLineNumber, StyleRuleRangeMap* ruleRangeMap)
{
#ifdef ANDROID_INSTRUMENT
android::TimeCounter::start(android::TimeCounter::CSSParseTimeCounter);
#endif
m_styleSheet = sheet;
m_defaultNamespace = starAtom; // Reset the default namespace.
- m_ruleRanges = ruleRangeMap;
+ m_ruleRangeMap = ruleRangeMap;
+ if (ruleRangeMap)
+ m_currentStyleData = CSSStyleSourceData::create();
m_lineNumber = startLineNumber;
setupParser("", string, "");
cssyyparse(this);
- m_ruleRanges = 0;
+ m_ruleRangeMap = 0;
+ m_currentStyleData = 0;
m_rule = 0;
#ifdef ANDROID_INSTRUMENT
android::TimeCounter::record(android::TimeCounter::CSSParseTimeCounter, __FUNCTION__);
@@ -367,13 +375,20 @@ void CSSParser::parseSelector(const String& string, Document* doc, CSSSelectorLi
#endif
}
-bool CSSParser::parseDeclaration(CSSMutableStyleDeclaration* declaration, const String& string)
+bool CSSParser::parseDeclaration(CSSMutableStyleDeclaration* declaration, const String& string, CSSStyleSourceData* styleSourceData)
{
+<<<<<<< HEAD
#ifdef ANDROID_INSTRUMENT
android::TimeCounter::start(android::TimeCounter::CSSParseTimeCounter);
#endif
+=======
+ // Length of the "@-webkit-decls{" prefix.
+ static const unsigned prefixLength = 15;
+
+>>>>>>> webkit.org at r67908
ASSERT(!declaration->stylesheet() || declaration->stylesheet()->isCSSStyleSheet());
m_styleSheet = static_cast<CSSStyleSheet*>(declaration->stylesheet());
+ m_currentStyleData = styleSourceData;
setupParser("@-webkit-decls{", string, "} ");
cssyyparse(this);
@@ -388,9 +403,23 @@ bool CSSParser::parseDeclaration(CSSMutableStyleDeclaration* declaration, const
clearProperties();
}
+<<<<<<< HEAD
#ifdef ANDROID_INSTRUMENT
android::TimeCounter::record(android::TimeCounter::CSSParseTimeCounter, __FUNCTION__);
#endif
+=======
+ if (m_currentStyleData) {
+ m_currentStyleData->styleBodyRange.start = 0;
+ m_currentStyleData->styleBodyRange.end = string.length();
+ for (Vector<CSSPropertySourceData>::iterator it = m_currentStyleData->propertyData.begin(); it != m_currentStyleData->propertyData.end(); ++it) {
+ (*it).range.start -= prefixLength;
+ (*it).range.end -= prefixLength;
+ }
+ }
+
+ if (!m_ruleRangeMap)
+ m_currentStyleData = 0;
+>>>>>>> webkit.org at r67908
return ok;
}
@@ -805,6 +834,8 @@ bool CSSParser::parseValue(int propId, bool important)
case CSSPropertyBorderLeftStyle:
case CSSPropertyWebkitBorderStartStyle:
case CSSPropertyWebkitBorderEndStyle:
+ case CSSPropertyWebkitBorderBeforeStyle:
+ case CSSPropertyWebkitBorderAfterStyle:
case CSSPropertyWebkitColumnRuleStyle:
if (id >= CSSValueNone && id <= CSSValueDouble)
validPrimitive = true;
@@ -851,6 +882,8 @@ bool CSSParser::parseValue(int propId, bool important)
case CSSPropertyBorderLeftColor:
case CSSPropertyWebkitBorderStartColor:
case CSSPropertyWebkitBorderEndColor:
+ case CSSPropertyWebkitBorderBeforeColor:
+ case CSSPropertyWebkitBorderAfterColor:
case CSSPropertyColor: // <color> | inherit
case CSSPropertyTextLineThroughColor: // CSS3 text decoration colors
case CSSPropertyTextUnderlineColor:
@@ -1002,6 +1035,8 @@ bool CSSParser::parseValue(int propId, bool important)
case CSSPropertyBorderLeftWidth:
case CSSPropertyWebkitBorderStartWidth:
case CSSPropertyWebkitBorderEndWidth:
+ case CSSPropertyWebkitBorderBeforeWidth:
+ case CSSPropertyWebkitBorderAfterWidth:
case CSSPropertyWebkitColumnRuleWidth:
if (id == CSSValueThin || id == CSSValueMedium || id == CSSValueThick)
validPrimitive = true;
@@ -1037,11 +1072,15 @@ bool CSSParser::parseValue(int propId, bool important)
case CSSPropertyPaddingLeft: ////
case CSSPropertyWebkitPaddingStart:
case CSSPropertyWebkitPaddingEnd:
+ case CSSPropertyWebkitPaddingBefore:
+ case CSSPropertyWebkitPaddingAfter:
validPrimitive = (!id && validUnit(value, FLength | FPercent | FNonNeg, m_strict));
break;
case CSSPropertyMaxHeight: // <length> | <percentage> | none | inherit
case CSSPropertyMaxWidth: // <length> | <percentage> | none | inherit
+ case CSSPropertyWebkitMaxLogicalWidth:
+ case CSSPropertyWebkitMaxLogicalHeight:
if (id == CSSValueNone || id == CSSValueIntrinsic || id == CSSValueMinIntrinsic) {
validPrimitive = true;
break;
@@ -1049,6 +1088,8 @@ bool CSSParser::parseValue(int propId, bool important)
/* nobreak */
case CSSPropertyMinHeight: // <length> | <percentage> | inherit
case CSSPropertyMinWidth: // <length> | <percentage> | inherit
+ case CSSPropertyWebkitMinLogicalWidth:
+ case CSSPropertyWebkitMinLogicalHeight:
if (id == CSSValueIntrinsic || id == CSSValueMinIntrinsic)
validPrimitive = true;
else
@@ -1081,6 +1122,8 @@ bool CSSParser::parseValue(int propId, bool important)
case CSSPropertyHeight: // <length> | <percentage> | auto | inherit
case CSSPropertyWidth: // <length> | <percentage> | auto | inherit
+ case CSSPropertyWebkitLogicalWidth:
+ case CSSPropertyWebkitLogicalHeight:
if (id == CSSValueAuto || id == CSSValueIntrinsic || id == CSSValueMinIntrinsic)
validPrimitive = true;
else
@@ -1098,6 +1141,8 @@ bool CSSParser::parseValue(int propId, bool important)
case CSSPropertyMarginLeft: ////
case CSSPropertyWebkitMarginStart:
case CSSPropertyWebkitMarginEnd:
+ case CSSPropertyWebkitMarginBefore:
+ case CSSPropertyWebkitMarginAfter:
if (id == CSSValueAuto)
validPrimitive = true;
else
@@ -1667,19 +1712,29 @@ bool CSSParser::parseValue(int propId, bool important)
return parseShorthand(propId, properties, 3, important);
}
case CSSPropertyWebkitBorderStart:
- // [ '-webkit-border-start-width' || 'border-style' || <color> ] | inherit
{
const int properties[3] = { CSSPropertyWebkitBorderStartWidth, CSSPropertyWebkitBorderStartStyle,
CSSPropertyWebkitBorderStartColor };
return parseShorthand(propId, properties, 3, important);
}
case CSSPropertyWebkitBorderEnd:
- // [ '-webkit-border-end-width' || 'border-style' || <color> ] | inherit
{
const int properties[3] = { CSSPropertyWebkitBorderEndWidth, CSSPropertyWebkitBorderEndStyle,
CSSPropertyWebkitBorderEndColor };
return parseShorthand(propId, properties, 3, important);
}
+ case CSSPropertyWebkitBorderBefore:
+ {
+ const int properties[3] = { CSSPropertyWebkitBorderBeforeWidth, CSSPropertyWebkitBorderBeforeStyle,
+ CSSPropertyWebkitBorderBeforeColor };
+ return parseShorthand(propId, properties, 3, important);
+ }
+ case CSSPropertyWebkitBorderAfter:
+ {
+ const int properties[3] = { CSSPropertyWebkitBorderAfterWidth, CSSPropertyWebkitBorderAfterStyle,
+ CSSPropertyWebkitBorderAfterColor };
+ return parseShorthand(propId, properties, 3, important);
+ }
case CSSPropertyOutline:
// [ 'outline-color' || 'outline-style' || 'outline-width' ] | inherit
{
@@ -1773,6 +1828,7 @@ bool CSSParser::parseValue(int propId, bool important)
break;
#endif
+<<<<<<< HEAD
#ifdef ANDROID_CSS_RING
case CSSPropertyWebkitRing:
{
@@ -1810,6 +1866,20 @@ bool CSSParser::parseValue(int propId, bool important)
m_valueList->next();
break;
#endif
+=======
+ // CSS Text Layout Module Level 3: Vertical writing support
+ case CSSPropertyWebkitBlockFlow:
+ // [ "tb" | "rl" | "lr" | "bt" ]
+ if (id == CSSValueTb || id == CSSValueRl || id == CSSValueLr || id == CSSValueBt)
+ validPrimitive = true;
+ break;
+
+ case CSSPropertyWebkitWritingMode:
+ // [ "lr-tb" | "rl-tb" | "tb-rl" | "bt-rl" | "tb-lr" | "bt-lr" ]
+ if (id == CSSValueLrTb || id == CSSValueRlTb || id == CSSValueTbRl || id == CSSValueBtRl || id == CSSValueTbLr || id == CSSValueBtLr)
+ validPrimitive = true;
+ break;
+>>>>>>> webkit.org at r67908
#if ENABLE(SVG)
default:
@@ -5507,8 +5577,12 @@ CSSRule* CSSParser::createStyleRule(Vector<CSSSelector*>* selectors)
rule->setDeclaration(CSSMutableStyleDeclaration::create(rule.get(), m_parsedProperties, m_numParsedProperties));
result = rule.get();
m_parsedStyleObjects.append(rule.release());
- if (m_ruleRanges)
- m_ruleRanges->set(result, std::pair<unsigned, unsigned>(m_ruleBodyStartOffset, m_ruleBodyEndOffset));
+ if (m_ruleRangeMap) {
+ ASSERT(m_currentStyleData);
+ m_currentStyleData->styleBodyRange = SourceRange(m_ruleBodyStartOffset, m_ruleBodyEndOffset);
+ m_ruleRangeMap->set(result, m_currentStyleData.release());
+ m_currentStyleData = CSSStyleSourceData::create();
+ }
}
resetRuleBodyMarks();
clearProperties();
@@ -5767,7 +5841,9 @@ void CSSParser::updateLastSelectorLineAndPosition()
void CSSParser::markRuleBodyStart()
{
unsigned offset = yytext - m_data;
- if (!m_ruleBodyStartOffset || offset < m_ruleBodyStartOffset)
+ if (*yytext == '{')
+ ++offset; // Skip the rule body opening brace.
+ if (offset > m_ruleBodyStartOffset)
m_ruleBodyStartOffset = offset;
}
@@ -5778,6 +5854,39 @@ void CSSParser::markRuleBodyEnd()
m_ruleBodyEndOffset = offset;
}
+void CSSParser::markPropertyStart()
+{
+ unsigned offset = yytext - m_data;
+ m_propertyStartOffset = offset;
+}
+
+void CSSParser::markPropertyEnd(bool isImportantFound, bool isPropertyParsed)
+{
+ unsigned offset = yytext - m_data;
+ if (*yytext == ';') // Include semicolon into the property text.
+ ++offset;
+ m_propertyEndOffset = offset;
+ if (m_propertyStartOffset != UINT_MAX && m_currentStyleData) {
+ // This stuff is only executed when the style data retrieval is requested by client.
+ const unsigned start = m_propertyStartOffset;
+ const unsigned end = m_propertyEndOffset;
+ ASSERT(start < end);
+ String propertyString = String(m_data + start, end - start).stripWhiteSpace();
+ if (propertyString.endsWith(";", true))
+ propertyString = propertyString.left(propertyString.length() - 1);
+ Vector<String> propertyComponents;
+ size_t colonIndex = propertyString.find(":");
+ ASSERT(colonIndex != notFound);
+
+ String name = propertyString.left(colonIndex).stripWhiteSpace();
+ String value = propertyString.substring(colonIndex + 1, propertyString.length()).stripWhiteSpace();
+ // The property range is relative to the declaration start offset.
+ m_currentStyleData->propertyData.append(
+ CSSPropertySourceData(name, value, isImportantFound, isPropertyParsed, SourceRange(m_propertyStartOffset - m_ruleBodyStartOffset, m_propertyEndOffset - m_ruleBodyStartOffset)));
+ }
+ resetPropertyMarks();
+}
+
static int cssPropertyID(const UChar* propertyName, unsigned length)
{
if (!length)
diff --git a/WebCore/css/CSSParser.h b/WebCore/css/CSSParser.h
index 47f0bed..f8b24df 100644
--- a/WebCore/css/CSSParser.h
+++ b/WebCore/css/CSSParser.h
@@ -25,6 +25,7 @@
#include "Color.h"
#include "CSSParserValues.h"
+#include "CSSPropertySourceData.h"
#include "CSSSelectorList.h"
#include "MediaQuery.h"
#include <wtf/HashMap.h>
@@ -55,18 +56,16 @@ namespace WebCore {
class CSSParser {
public:
- typedef HashMap<CSSStyleRule*, std::pair<unsigned, unsigned> > StyleRuleRanges;
-
CSSParser(bool strictParsing = true);
~CSSParser();
- void parseSheet(CSSStyleSheet*, const String&, int startLineNumber = 0, StyleRuleRanges* ruleRangeMap = 0);
+ void parseSheet(CSSStyleSheet*, const String&, int startLineNumber = 0, StyleRuleRangeMap* ruleRangeMap = 0);
PassRefPtr<CSSRule> parseRule(CSSStyleSheet*, const String&);
PassRefPtr<CSSRule> parseKeyframeRule(CSSStyleSheet*, const String&);
bool parseValue(CSSMutableStyleDeclaration*, int propId, const String&, bool important);
static bool parseColor(RGBA32& color, const String&, bool strict = false);
bool parseColor(CSSMutableStyleDeclaration*, const String&);
- bool parseDeclaration(CSSMutableStyleDeclaration*, const String&);
+ bool parseDeclaration(CSSMutableStyleDeclaration*, const String&, CSSStyleSourceData* styleSourceData = 0);
bool parseMediaQuery(MediaList*, const String&);
Document* document() const;
@@ -244,10 +243,16 @@ namespace WebCore {
// tokenizer methods and data
unsigned m_ruleBodyStartOffset;
unsigned m_ruleBodyEndOffset;
- StyleRuleRanges* m_ruleRanges;
+ unsigned m_propertyStartOffset;
+ unsigned m_propertyEndOffset;
+ StyleRuleRangeMap* m_ruleRangeMap;
+ RefPtr<CSSStyleSourceData> m_currentStyleData;
void markRuleBodyStart();
void markRuleBodyEnd();
+ void markPropertyStart();
+ void markPropertyEnd(bool isImportantFound, bool isPropertyParsed);
void resetRuleBodyMarks() { m_ruleBodyStartOffset = m_ruleBodyEndOffset = 0; }
+ void resetPropertyMarks() { m_propertyStartOffset = m_propertyEndOffset = UINT_MAX; }
int lex(void* yylval);
int token() { return yyTok; }
UChar* text(int* length);
diff --git a/WebCore/css/CSSPrimitiveValueMappings.h b/WebCore/css/CSSPrimitiveValueMappings.h
index 3da5cf6..a452733 100644
--- a/WebCore/css/CSSPrimitiveValueMappings.h
+++ b/WebCore/css/CSSPrimitiveValueMappings.h
@@ -2003,6 +2003,43 @@ template<> inline CSSPrimitiveValue::operator TextDirection() const
}
}
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBlockFlowDirection e)
+ : m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
+{
+ switch (e) {
+ case TopToBottomBlockFlow:
+ m_value.ident = CSSValueTb;
+ break;
+ case RightToLeftBlockFlow:
+ m_value.ident = CSSValueRl;
+ break;
+ case LeftToRightBlockFlow:
+ m_value.ident = CSSValueLr;
+ break;
+ case BottomToTopBlockFlow:
+ m_value.ident = CSSValueBt;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator EBlockFlowDirection() const
+{
+ switch (m_value.ident) {
+ case CSSValueTb:
+ return TopToBottomBlockFlow;
+ case CSSValueRl:
+ return RightToLeftBlockFlow;
+ case CSSValueLr:
+ return LeftToRightBlockFlow;
+ case CSSValueBt:
+ return BottomToTopBlockFlow;
+ default:
+ ASSERT_NOT_REACHED();
+ return TopToBottomBlockFlow;
+ }
+}
+
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPointerEvents e)
: m_type(CSS_IDENT)
, m_hasCachedCSSText(false)
@@ -2647,7 +2684,23 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EWritingMode e)
template<> inline CSSPrimitiveValue::operator EWritingMode() const
{
- return static_cast<EWritingMode>(m_value.ident - CSSValueLrTb);
+ switch (m_value.ident) {
+ case CSSValueLrTb:
+ return WM_LRTB;
+ case CSSValueLr:
+ return WM_LR;
+ case CSSValueRlTb:
+ return WM_RLTB;
+ case CSSValueRl:
+ return WM_RL;
+ case CSSValueTbRl:
+ return WM_TBRL;
+ case CSSValueTb:
+ return WM_TB;
+ default:
+ ASSERT_NOT_REACHED();
+ return WM_LRTB;
+ }
}
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EVectorEffect e)
diff --git a/WebCore/css/CSSProperty.cpp b/WebCore/css/CSSProperty.cpp
index 453b381..7779aad 100644
--- a/WebCore/css/CSSProperty.cpp
+++ b/WebCore/css/CSSProperty.cpp
@@ -23,6 +23,7 @@
#include "CSSPropertyNames.h"
#include "PlatformString.h"
+#include "RenderStyleConstants.h"
namespace WebCore {
@@ -38,37 +39,246 @@ bool operator==(const CSSProperty& a, const CSSProperty& b)
return a.m_id == b.m_id && a.m_important == b.m_important && a.m_value == b.m_value;
}
-int CSSProperty::resolveDirectionAwareProperty(int propertyID, TextDirection direction)
-{
- switch (static_cast<CSSPropertyID>(propertyID)) {
- case CSSPropertyWebkitMarginEnd:
- return direction == LTR ? CSSPropertyMarginRight : CSSPropertyMarginLeft;
- case CSSPropertyWebkitMarginStart:
- return direction == LTR ? CSSPropertyMarginLeft : CSSPropertyMarginRight;
+enum LogicalBoxSide { BeforeSide, EndSide, AfterSide, StartSide };
+enum PhysicalBoxSide { TopSide, RightSide, BottomSide, LeftSide };
- case CSSPropertyWebkitPaddingEnd:
- return direction == LTR ? CSSPropertyPaddingRight : CSSPropertyPaddingLeft;
- case CSSPropertyWebkitPaddingStart:
- return direction == LTR ? CSSPropertyPaddingLeft : CSSPropertyPaddingRight;
+static int resolveToPhysicalProperty(TextDirection direction, EBlockFlowDirection blockDirection, LogicalBoxSide logicalSide, const int* properties)
+{
+ if (direction == LTR) {
+ if (blockDirection == TopToBottomBlockFlow) {
+ // The common case. The logical and physical box sides match.
+ // Left = Start, Right = End, Before = Top, After = Bottom
+ return properties[logicalSide];
+ }
+
+ if (blockDirection == BottomToTopBlockFlow) {
+ // Start = Left, End = Right, Before = Bottom, After = Top.
+ switch (logicalSide) {
+ case StartSide:
+ return properties[LeftSide];
+ case EndSide:
+ return properties[RightSide];
+ case BeforeSide:
+ return properties[BottomSide];
+ default:
+ return properties[TopSide];
+ }
+ }
+
+ if (blockDirection == LeftToRightBlockFlow) {
+ // Start = Top, End = Bottom, Before = Left, After = Right.
+ switch (logicalSide) {
+ case StartSide:
+ return properties[TopSide];
+ case EndSide:
+ return properties[BottomSide];
+ case BeforeSide:
+ return properties[LeftSide];
+ default:
+ return properties[RightSide];
+ }
+ }
+
+ // Start = Top, End = Bottom, Before = Right, After = Left
+ switch (logicalSide) {
+ case StartSide:
+ return properties[TopSide];
+ case EndSide:
+ return properties[BottomSide];
+ case BeforeSide:
+ return properties[RightSide];
+ default:
+ return properties[LeftSide];
+ }
+ }
- case CSSPropertyWebkitBorderEnd:
- return direction == LTR ? CSSPropertyBorderRight : CSSPropertyBorderLeft;
- case CSSPropertyWebkitBorderEndColor:
- return direction == LTR ? CSSPropertyBorderRightColor : CSSPropertyBorderLeftColor;
- case CSSPropertyWebkitBorderEndStyle:
- return direction == LTR ? CSSPropertyBorderRightStyle : CSSPropertyBorderLeftStyle;
- case CSSPropertyWebkitBorderEndWidth:
- return direction == LTR ? CSSPropertyBorderRightWidth : CSSPropertyBorderLeftWidth;
+ if (blockDirection == TopToBottomBlockFlow) {
+ // Start = Right, End = Left, Before = Top, After = Bottom
+ switch (logicalSide) {
+ case StartSide:
+ return properties[RightSide];
+ case EndSide:
+ return properties[LeftSide];
+ case BeforeSide:
+ return properties[TopSide];
+ default:
+ return properties[BottomSide];
+ }
+ }
+
+ if (blockDirection == BottomToTopBlockFlow) {
+ // Start = Right, End = Left, Before = Bottom, After = Top
+ switch (logicalSide) {
+ case StartSide:
+ return properties[RightSide];
+ case EndSide:
+ return properties[LeftSide];
+ case BeforeSide:
+ return properties[BottomSide];
+ default:
+ return properties[TopSide];
+ }
+ }
+
+ if (blockDirection == LeftToRightBlockFlow) {
+ // Start = Bottom, End = Top, Before = Left, After = Right
+ switch (logicalSide) {
+ case StartSide:
+ return properties[BottomSide];
+ case EndSide:
+ return properties[TopSide];
+ case BeforeSide:
+ return properties[LeftSide];
+ default:
+ return properties[RightSide];
+ }
+ }
+
+ // Start = Bottom, End = Top, Before = Right, After = Left
+ switch (logicalSide) {
+ case StartSide:
+ return properties[BottomSide];
+ case EndSide:
+ return properties[TopSide];
+ case BeforeSide:
+ return properties[RightSide];
+ default:
+ return properties[LeftSide];
+ }
+}
- case CSSPropertyWebkitBorderStart:
- return direction == LTR ? CSSPropertyBorderLeft : CSSPropertyBorderRight;
- case CSSPropertyWebkitBorderStartColor:
- return direction == LTR ? CSSPropertyBorderLeftColor : CSSPropertyBorderRightColor;
- case CSSPropertyWebkitBorderStartStyle:
- return direction == LTR ? CSSPropertyBorderLeftStyle : CSSPropertyBorderRightStyle;
- case CSSPropertyWebkitBorderStartWidth:
- return direction == LTR ? CSSPropertyBorderLeftWidth : CSSPropertyBorderRightWidth;
+enum LogicalExtent { LogicalWidth, LogicalHeight };
+static int resolveToPhysicalProperty(EBlockFlowDirection blockDirection, LogicalExtent logicalSide, const int* properties)
+{
+ if (blockDirection == TopToBottomBlockFlow || blockDirection == BottomToTopBlockFlow)
+ return properties[logicalSide];
+ return logicalSide == LogicalWidth ? properties[1] : properties[0];
+}
+
+int CSSProperty::resolveDirectionAwareProperty(int propertyID, TextDirection direction, EBlockFlowDirection blockDirection)
+{
+ switch (static_cast<CSSPropertyID>(propertyID)) {
+ case CSSPropertyWebkitMarginEnd: {
+ const int properties[4] = { CSSPropertyMarginTop, CSSPropertyMarginRight, CSSPropertyMarginBottom, CSSPropertyMarginLeft };
+ return resolveToPhysicalProperty(direction, blockDirection, EndSide, properties);
+ }
+ case CSSPropertyWebkitMarginStart: {
+ const int properties[4] = { CSSPropertyMarginTop, CSSPropertyMarginRight, CSSPropertyMarginBottom, CSSPropertyMarginLeft };
+ return resolveToPhysicalProperty(direction, blockDirection, StartSide, properties);
+ }
+ case CSSPropertyWebkitMarginBefore: {
+ const int properties[4] = { CSSPropertyMarginTop, CSSPropertyMarginRight, CSSPropertyMarginBottom, CSSPropertyMarginLeft };
+ return resolveToPhysicalProperty(direction, blockDirection, BeforeSide, properties);
+ }
+ case CSSPropertyWebkitMarginAfter: {
+ const int properties[4] = { CSSPropertyMarginTop, CSSPropertyMarginRight, CSSPropertyMarginBottom, CSSPropertyMarginLeft };
+ return resolveToPhysicalProperty(direction, blockDirection, AfterSide, properties);
+ }
+ case CSSPropertyWebkitPaddingEnd: {
+ const int properties[4] = { CSSPropertyPaddingTop, CSSPropertyPaddingRight, CSSPropertyPaddingBottom, CSSPropertyPaddingLeft };
+ return resolveToPhysicalProperty(direction, blockDirection, EndSide, properties);
+ }
+ case CSSPropertyWebkitPaddingStart: {
+ const int properties[4] = { CSSPropertyPaddingTop, CSSPropertyPaddingRight, CSSPropertyPaddingBottom, CSSPropertyPaddingLeft };
+ return resolveToPhysicalProperty(direction, blockDirection, StartSide, properties);
+ }
+ case CSSPropertyWebkitPaddingBefore: {
+ const int properties[4] = { CSSPropertyPaddingTop, CSSPropertyPaddingRight, CSSPropertyPaddingBottom, CSSPropertyPaddingLeft };
+ return resolveToPhysicalProperty(direction, blockDirection, BeforeSide, properties);
+ }
+ case CSSPropertyWebkitPaddingAfter: {
+ const int properties[4] = { CSSPropertyPaddingTop, CSSPropertyPaddingRight, CSSPropertyPaddingBottom, CSSPropertyPaddingLeft };
+ return resolveToPhysicalProperty(direction, blockDirection, AfterSide, properties);
+ }
+ case CSSPropertyWebkitBorderEnd: {
+ const int properties[4] = { CSSPropertyBorderTop, CSSPropertyBorderRight, CSSPropertyBorderBottom, CSSPropertyBorderLeft };
+ return resolveToPhysicalProperty(direction, blockDirection, EndSide, properties);
+ }
+ case CSSPropertyWebkitBorderStart: {
+ const int properties[4] = { CSSPropertyBorderTop, CSSPropertyBorderRight, CSSPropertyBorderBottom, CSSPropertyBorderLeft };
+ return resolveToPhysicalProperty(direction, blockDirection, StartSide, properties);
+ }
+ case CSSPropertyWebkitBorderBefore: {
+ const int properties[4] = { CSSPropertyBorderTop, CSSPropertyBorderRight, CSSPropertyBorderBottom, CSSPropertyBorderLeft };
+ return resolveToPhysicalProperty(direction, blockDirection, BeforeSide, properties);
+ }
+ case CSSPropertyWebkitBorderAfter: {
+ const int properties[4] = { CSSPropertyBorderTop, CSSPropertyBorderRight, CSSPropertyBorderBottom, CSSPropertyBorderLeft };
+ return resolveToPhysicalProperty(direction, blockDirection, AfterSide, properties);
+ }
+ case CSSPropertyWebkitBorderEndColor: {
+ const int properties[4] = { CSSPropertyBorderTopColor, CSSPropertyBorderRightColor, CSSPropertyBorderBottomColor, CSSPropertyBorderLeftColor };
+ return resolveToPhysicalProperty(direction, blockDirection, EndSide, properties);
+ }
+ case CSSPropertyWebkitBorderStartColor: {
+ const int properties[4] = { CSSPropertyBorderTopColor, CSSPropertyBorderRightColor, CSSPropertyBorderBottomColor, CSSPropertyBorderLeftColor };
+ return resolveToPhysicalProperty(direction, blockDirection, StartSide, properties);
+ }
+ case CSSPropertyWebkitBorderBeforeColor: {
+ const int properties[4] = { CSSPropertyBorderTopColor, CSSPropertyBorderRightColor, CSSPropertyBorderBottomColor, CSSPropertyBorderLeftColor };
+ return resolveToPhysicalProperty(direction, blockDirection, BeforeSide, properties);
+ }
+ case CSSPropertyWebkitBorderAfterColor: {
+ const int properties[4] = { CSSPropertyBorderTopColor, CSSPropertyBorderRightColor, CSSPropertyBorderBottomColor, CSSPropertyBorderLeftColor };
+ return resolveToPhysicalProperty(direction, blockDirection, AfterSide, properties);
+ }
+ case CSSPropertyWebkitBorderEndStyle: {
+ const int properties[4] = { CSSPropertyBorderTopStyle, CSSPropertyBorderRightStyle, CSSPropertyBorderBottomStyle, CSSPropertyBorderLeftStyle };
+ return resolveToPhysicalProperty(direction, blockDirection, EndSide, properties);
+ }
+ case CSSPropertyWebkitBorderStartStyle: {
+ const int properties[4] = { CSSPropertyBorderTopStyle, CSSPropertyBorderRightStyle, CSSPropertyBorderBottomStyle, CSSPropertyBorderLeftStyle };
+ return resolveToPhysicalProperty(direction, blockDirection, StartSide, properties);
+ }
+ case CSSPropertyWebkitBorderBeforeStyle: {
+ const int properties[4] = { CSSPropertyBorderTopStyle, CSSPropertyBorderRightStyle, CSSPropertyBorderBottomStyle, CSSPropertyBorderLeftStyle };
+ return resolveToPhysicalProperty(direction, blockDirection, BeforeSide, properties);
+ }
+ case CSSPropertyWebkitBorderAfterStyle: {
+ const int properties[4] = { CSSPropertyBorderTopStyle, CSSPropertyBorderRightStyle, CSSPropertyBorderBottomStyle, CSSPropertyBorderLeftStyle };
+ return resolveToPhysicalProperty(direction, blockDirection, AfterSide, properties);
+ }
+ case CSSPropertyWebkitBorderEndWidth: {
+ const int properties[4] = { CSSPropertyBorderTopWidth, CSSPropertyBorderRightWidth, CSSPropertyBorderBottomWidth, CSSPropertyBorderLeftWidth };
+ return resolveToPhysicalProperty(direction, blockDirection, EndSide, properties);
+ }
+ case CSSPropertyWebkitBorderStartWidth: {
+ const int properties[4] = { CSSPropertyBorderTopWidth, CSSPropertyBorderRightWidth, CSSPropertyBorderBottomWidth, CSSPropertyBorderLeftWidth };
+ return resolveToPhysicalProperty(direction, blockDirection, StartSide, properties);
+ }
+ case CSSPropertyWebkitBorderBeforeWidth: {
+ const int properties[4] = { CSSPropertyBorderTopWidth, CSSPropertyBorderRightWidth, CSSPropertyBorderBottomWidth, CSSPropertyBorderLeftWidth };
+ return resolveToPhysicalProperty(direction, blockDirection, BeforeSide, properties);
+ }
+ case CSSPropertyWebkitBorderAfterWidth: {
+ const int properties[4] = { CSSPropertyBorderTopWidth, CSSPropertyBorderRightWidth, CSSPropertyBorderBottomWidth, CSSPropertyBorderLeftWidth };
+ return resolveToPhysicalProperty(direction, blockDirection, AfterSide, properties);
+ }
+ case CSSPropertyWebkitLogicalWidth: {
+ const int properties[2] = { CSSPropertyWidth, CSSPropertyHeight };
+ return resolveToPhysicalProperty(blockDirection, LogicalWidth, properties);
+ }
+ case CSSPropertyWebkitLogicalHeight: {
+ const int properties[2] = { CSSPropertyWidth, CSSPropertyHeight };
+ return resolveToPhysicalProperty(blockDirection, LogicalHeight, properties);
+ }
+ case CSSPropertyWebkitMinLogicalWidth: {
+ const int properties[2] = { CSSPropertyMinWidth, CSSPropertyMinHeight };
+ return resolveToPhysicalProperty(blockDirection, LogicalWidth, properties);
+ }
+ case CSSPropertyWebkitMinLogicalHeight: {
+ const int properties[2] = { CSSPropertyMinWidth, CSSPropertyMinHeight };
+ return resolveToPhysicalProperty(blockDirection, LogicalHeight, properties);
+ }
+ case CSSPropertyWebkitMaxLogicalWidth: {
+ const int properties[2] = { CSSPropertyMaxWidth, CSSPropertyMaxHeight };
+ return resolveToPhysicalProperty(blockDirection, LogicalWidth, properties);
+ }
+ case CSSPropertyWebkitMaxLogicalHeight: {
+ const int properties[2] = { CSSPropertyMaxWidth, CSSPropertyMaxHeight };
+ return resolveToPhysicalProperty(blockDirection, LogicalHeight, properties);
+ }
default:
return propertyID;
}
diff --git a/WebCore/css/CSSProperty.h b/WebCore/css/CSSProperty.h
index 7a3da68..0da6050 100644
--- a/WebCore/css/CSSProperty.h
+++ b/WebCore/css/CSSProperty.h
@@ -22,6 +22,7 @@
#define CSSProperty_h
#include "CSSValue.h"
+#include "RenderStyleConstants.h"
#include "TextDirection.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
@@ -59,7 +60,7 @@ public:
String cssText() const;
- static int resolveDirectionAwareProperty(int propertyID, TextDirection);
+ static int resolveDirectionAwareProperty(int propertyID, TextDirection, EBlockFlowDirection);
friend bool operator==(const CSSProperty&, const CSSProperty&);
diff --git a/WebCore/css/CSSPropertyNames.in b/WebCore/css/CSSPropertyNames.in
index a3063db..addecca 100644
--- a/WebCore/css/CSSPropertyNames.in
+++ b/WebCore/css/CSSPropertyNames.in
@@ -20,8 +20,10 @@ font-style
font-variant
font-weight
text-rendering
+-webkit-block-flow
-webkit-font-smoothing
-webkit-text-size-adjust
+-webkit-writing-mode
zoom
# line height needs to be right after the above high-priority properties
@@ -173,6 +175,14 @@ z-index
# a single value: -webkit-background-size: l; is equivalent to background-size: l l;
# whereas background-size: l; is equivalent to background-size: l auto;
-webkit-background-size
+-webkit-border-after
+-webkit-border-after-color
+-webkit-border-after-style
+-webkit-border-after-width
+-webkit-border-before
+-webkit-border-before-color
+-webkit-border-before-style
+-webkit-border-before-width
-webkit-border-end
-webkit-border-end-color
-webkit-border-end-style
@@ -220,8 +230,12 @@ z-index
-webkit-hyphens
-webkit-line-break
-webkit-line-clamp
+-webkit-logical-width
+-webkit-logical-height
-webkit-margin-bottom-collapse
-webkit-margin-collapse
+-webkit-margin-after
+-webkit-margin-before
-webkit-margin-end
-webkit-margin-start
-webkit-margin-top-collapse
@@ -246,7 +260,13 @@ z-index
-webkit-mask-repeat-y
-webkit-mask-size
-webkit-match-nearest-mail-blockquote-color
+-webkit-max-logical-width
+-webkit-max-logical-height
+-webkit-min-logical-width
+-webkit-min-logical-height
-webkit-nbsp-mode
+-webkit-padding-after
+-webkit-padding-before
-webkit-padding-end
-webkit-padding-start
-webkit-perspective
diff --git a/WebCore/css/CSSPropertySourceData.cpp b/WebCore/css/CSSPropertySourceData.cpp
new file mode 100644
index 0000000..1628031
--- /dev/null
+++ b/WebCore/css/CSSPropertySourceData.cpp
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#ifdef SKIP_STATIC_CONSTRUCTORS_ON_GCC
+#define CSSPROPERTYSOURCEDATA_HIDE_GLOBALS 1
+#endif
+
+#include "CSSPropertySourceData.h"
+
+#include "PlatformString.h"
+#include <wtf/StaticConstructors.h>
+#include <wtf/text/StringHash.h>
+
+namespace WebCore {
+
+SourceRange::SourceRange()
+ : start(0)
+ , end(0)
+{
+}
+
+SourceRange::SourceRange(unsigned start, unsigned end)
+ : start(start)
+ , end(end)
+{
+}
+
+SourceRange& SourceRange::operator=(const SourceRange& other)
+{
+ this->start = other.start;
+ this->end = other.end;
+ return *this;
+}
+
+CSSPropertySourceData::CSSPropertySourceData(const String& name, const String& value, bool important, bool parsedOk, const SourceRange& range)
+ : name(name)
+ , value(value)
+ , important(important)
+ , parsedOk(parsedOk)
+ , range(range)
+{
+}
+
+CSSPropertySourceData::CSSPropertySourceData(const CSSPropertySourceData& other)
+ : name(other.name)
+ , value(other.value)
+ , important(other.important)
+ , parsedOk(other.parsedOk)
+ , range(other.range)
+{
+}
+
+CSSPropertySourceData::CSSPropertySourceData()
+ : name("")
+ , value("")
+ , important(false)
+ , parsedOk(false)
+ , range(SourceRange(0, 0))
+{
+}
+
+CSSPropertySourceData& CSSPropertySourceData::operator=(const CSSPropertySourceData& other)
+{
+ name = other.name;
+ value = other.value;
+ important = other.important;
+ parsedOk = other.parsedOk;
+ range = other.range;
+ return *this;
+}
+
+String CSSPropertySourceData::toString() const
+{
+ DEFINE_STATIC_LOCAL(String, emptyValue, ("e"));
+ DEFINE_STATIC_LOCAL(String, importantSuffix, (" !important"));
+ if (!name && value == emptyValue)
+ return String();
+
+ String result = name;
+ result += ": ";
+ result += value;
+ if (important)
+ result += importantSuffix;
+ result += ";";
+ return result;
+}
+
+unsigned CSSPropertySourceData::hash() const
+{
+ return StringHash::hash(name) + 3 * StringHash::hash(value) + 7 * important + 13 * parsedOk + 31;
+}
+
+// Global init routines
+DEFINE_GLOBAL(CSSPropertySourceData, emptyCSSPropertySourceData, "", "e", false, false)
+
+// static
+void CSSPropertySourceData::init()
+{
+ static bool initialized;
+ if (!initialized) {
+ new ((void *) &emptyCSSPropertySourceData) CSSPropertySourceData("", "e", false, false, SourceRange(0, 0));
+ initialized = true;
+ }
+}
+
+} // namespace WebCore
diff --git a/WebCore/css/CSSPropertySourceData.h b/WebCore/css/CSSPropertySourceData.h
new file mode 100644
index 0000000..beae9d0
--- /dev/null
+++ b/WebCore/css/CSSPropertySourceData.h
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CSSPropertySourceData_h
+#define CSSPropertySourceData_h
+
+#include "PlatformString.h"
+#include <utility>
+#include <wtf/Forward.h>
+#include <wtf/HashMap.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class CSSStyleRule;
+
+struct SourceRange {
+ SourceRange();
+ SourceRange(unsigned start, unsigned end);
+ SourceRange& operator=(const SourceRange& other);
+
+ unsigned start;
+ unsigned end;
+};
+
+struct CSSPropertySourceData {
+ static void init();
+
+ CSSPropertySourceData(const String& name, const String& value, bool important, bool parsedOk, const SourceRange& range);
+ CSSPropertySourceData(const CSSPropertySourceData& other);
+ CSSPropertySourceData();
+ ALWAYS_INLINE ~CSSPropertySourceData() { }
+
+ CSSPropertySourceData& operator=(const CSSPropertySourceData& other);
+ String toString() const;
+ unsigned hash() const;
+
+ String name;
+ String value;
+ bool important;
+ bool parsedOk;
+ SourceRange range;
+};
+
+#ifndef CSSPROPERTYSOURCEDATA_HIDE_GLOBALS
+extern const CSSPropertySourceData emptyCSSPropertySourceData;
+#endif
+
+struct CSSStyleSourceData : public RefCounted<CSSStyleSourceData> {
+ static PassRefPtr<CSSStyleSourceData> create()
+ {
+ return adoptRef(new CSSStyleSourceData());
+ }
+
+ // Range of the style text in the enclosing source.
+ SourceRange styleBodyRange;
+ Vector<CSSPropertySourceData> propertyData;
+};
+typedef HashMap<CSSStyleRule*, RefPtr<CSSStyleSourceData> > StyleRuleRangeMap;
+
+} // namespace WebCore
+
+#endif // CSSPropertySourceData_h
diff --git a/WebCore/css/CSSStyleSelector.cpp b/WebCore/css/CSSStyleSelector.cpp
index 60dfb84..abc4c22 100644
--- a/WebCore/css/CSSStyleSelector.cpp
+++ b/WebCore/css/CSSStyleSelector.cpp
@@ -654,7 +654,7 @@ void CSSStyleSelector::resolveVariablesForDeclaration(CSSMutableStyleDeclaration
}
}
-void CSSStyleSelector::matchRules(CSSRuleSet* rules, int& firstRuleIndex, int& lastRuleIndex)
+void CSSStyleSelector::matchRules(CSSRuleSet* rules, int& firstRuleIndex, int& lastRuleIndex, bool includeEmptyRules)
{
m_matchedRules.clear();
@@ -664,16 +664,16 @@ void CSSStyleSelector::matchRules(CSSRuleSet* rules, int& firstRuleIndex, int& l
// We need to collect the rules for id, class, tag, and everything else into a buffer and
// then sort the buffer.
if (m_element->hasID())
- matchRulesForList(rules->getIDRules(m_element->idForStyleResolution().impl()), firstRuleIndex, lastRuleIndex);
+ matchRulesForList(rules->getIDRules(m_element->idForStyleResolution().impl()), firstRuleIndex, lastRuleIndex, includeEmptyRules);
if (m_element->hasClass()) {
ASSERT(m_styledElement);
const SpaceSplitString& classNames = m_styledElement->classNames();
size_t size = classNames.size();
for (size_t i = 0; i < size; ++i)
- matchRulesForList(rules->getClassRules(classNames[i].impl()), firstRuleIndex, lastRuleIndex);
+ matchRulesForList(rules->getClassRules(classNames[i].impl()), firstRuleIndex, lastRuleIndex, includeEmptyRules);
}
- matchRulesForList(rules->getTagRules(m_element->localName().impl()), firstRuleIndex, lastRuleIndex);
- matchRulesForList(rules->getUniversalRules(), firstRuleIndex, lastRuleIndex);
+ matchRulesForList(rules->getTagRules(m_element->localName().impl()), firstRuleIndex, lastRuleIndex, includeEmptyRules);
+ matchRulesForList(rules->getUniversalRules(), firstRuleIndex, lastRuleIndex, includeEmptyRules);
// If we didn't match any rules, we're done.
if (m_matchedRules.isEmpty())
@@ -695,7 +695,7 @@ void CSSStyleSelector::matchRules(CSSRuleSet* rules, int& firstRuleIndex, int& l
}
}
-void CSSStyleSelector::matchRulesForList(CSSRuleDataList* rules, int& firstRuleIndex, int& lastRuleIndex)
+void CSSStyleSelector::matchRulesForList(CSSRuleDataList* rules, int& firstRuleIndex, int& lastRuleIndex, bool includeEmptyRules)
{
if (!rules)
return;
@@ -703,9 +703,9 @@ void CSSStyleSelector::matchRulesForList(CSSRuleDataList* rules, int& firstRuleI
for (CSSRuleData* d = rules->first(); d; d = d->next()) {
CSSStyleRule* rule = d->rule();
if (checkSelector(d->selector())) {
- // If the rule has no properties to apply, then ignore it.
+ // If the rule has no properties to apply, then ignore it in the non-debug mode.
CSSMutableStyleDeclaration* decl = rule->declaration();
- if (!decl || !decl->length())
+ if (!decl || (!decl->length() && !includeEmptyRules))
continue;
// If we're matching normal rules, set a pseudo bit if
@@ -1083,28 +1083,28 @@ void CSSStyleSelector::matchUARules(int& firstUARule, int& lastUARule)
// First we match rules from the user agent sheet.
CSSRuleSet* userAgentStyleSheet = m_medium->mediaTypeMatchSpecific("print")
? defaultPrintStyle : defaultStyle;
- matchRules(userAgentStyleSheet, firstUARule, lastUARule);
+ matchRules(userAgentStyleSheet, firstUARule, lastUARule, false);
// In quirks mode, we match rules from the quirks user agent sheet.
if (!m_checker.m_strictParsing)
- matchRules(defaultQuirksStyle, firstUARule, lastUARule);
+ matchRules(defaultQuirksStyle, firstUARule, lastUARule, false);
// If we're in view source mode, then we match rules from the view source style sheet.
if (m_checker.m_document->frame() && m_checker.m_document->frame()->inViewSourceMode()) {
if (!defaultViewSourceStyle)
loadViewSourceStyle();
- matchRules(defaultViewSourceStyle, firstUARule, lastUARule);
+ matchRules(defaultViewSourceStyle, firstUARule, lastUARule, false);
}
}
PassRefPtr<RenderStyle> CSSStyleSelector::styleForDocument(Document* document)
{
- FrameView* view = document->view();
+ Frame* frame = document->frame();
RefPtr<RenderStyle> documentStyle = RenderStyle::create();
documentStyle->setDisplay(BLOCK);
documentStyle->setVisuallyOrdered(document->visuallyOrdered());
- documentStyle->setZoom(view ? view->pageZoomFactor() : 1);
+ documentStyle->setZoom(frame ? frame->pageZoomFactor() : 1);
FontDescription fontDescription;
fontDescription.setUsePrinterFont(document->printing());
@@ -1247,7 +1247,7 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl
if (!resolveForRootDefault) {
// 4. Now we check user sheet rules.
if (m_matchAuthorAndUserStyles)
- matchRules(m_userStyle.get(), firstUserRule, lastUserRule);
+ matchRules(m_userStyle.get(), firstUserRule, lastUserRule, false);
// 5. Now check author rules, beginning first with presentational attributes
// mapped from HTML.
@@ -1286,7 +1286,7 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl
// 6. Check the rules in author sheets next.
if (m_matchAuthorAndUserStyles)
- matchRules(m_authorStyle.get(), firstAuthorRule, lastAuthorRule);
+ matchRules(m_authorStyle.get(), firstAuthorRule, lastAuthorRule, false);
// 7. Now check our inline style attribute.
if (m_matchAuthorAndUserStyles && m_styledElement) {
@@ -1503,8 +1503,10 @@ PassRefPtr<RenderStyle> CSSStyleSelector::pseudoStyleForElement(PseudoId pseudo,
}
initForStyleResolve(e, parentStyle, pseudo);
- m_style = parentStyle;
-
+ m_style = RenderStyle::create();
+ if (parentStyle)
+ m_style->inheritFrom(parentStyle);
+
m_checker.m_matchVisitedPseudoClass = matchVisitedPseudoClass;
// Since we don't use pseudo-elements in any of our quirk/print user agent rules, don't waste time walking
@@ -1515,17 +1517,13 @@ PassRefPtr<RenderStyle> CSSStyleSelector::pseudoStyleForElement(PseudoId pseudo,
matchUARules(firstUARule, lastUARule);
if (m_matchAuthorAndUserStyles) {
- matchRules(m_userStyle.get(), firstUserRule, lastUserRule);
- matchRules(m_authorStyle.get(), firstAuthorRule, lastAuthorRule);
+ matchRules(m_userStyle.get(), firstUserRule, lastUserRule, false);
+ matchRules(m_authorStyle.get(), firstAuthorRule, lastAuthorRule, false);
}
if (m_matchedDecls.isEmpty() && !visitedStyle)
return 0;
- m_style = RenderStyle::create();
- if (parentStyle)
- m_style->inheritFrom(parentStyle);
-
m_style->setStyleType(pseudo);
m_lineHeightValue = 0;
@@ -1798,7 +1796,7 @@ void CSSStyleSelector::adjustRenderStyle(RenderStyle* style, Element *e)
if (e && e->isFormControlElement() && style->fontSize() >= 11) {
// Don't apply intrinsic margins to image buttons. The designer knows how big the images are,
// so we have to treat all image buttons as though they were explicitly sized.
- if (!e->hasTagName(inputTag) || static_cast<HTMLInputElement*>(e)->inputType() != HTMLInputElement::IMAGE)
+ if (!e->hasTagName(inputTag) || !static_cast<HTMLInputElement*>(e)->isImageButton())
addIntrinsicMargins(style);
}
@@ -1845,12 +1843,12 @@ void CSSStyleSelector::cacheBorderAndBackground()
}
}
-PassRefPtr<CSSRuleList> CSSStyleSelector::styleRulesForElement(Element* e, bool authorOnly)
+PassRefPtr<CSSRuleList> CSSStyleSelector::styleRulesForElement(Element* e, bool authorOnly, bool includeEmptyRules)
{
- return pseudoStyleRulesForElement(e, NOPSEUDO, authorOnly);
+ return pseudoStyleRulesForElement(e, NOPSEUDO, authorOnly, includeEmptyRules);
}
-PassRefPtr<CSSRuleList> CSSStyleSelector::pseudoStyleRulesForElement(Element* e, PseudoId pseudoId, bool authorOnly)
+PassRefPtr<CSSRuleList> CSSStyleSelector::pseudoStyleRulesForElement(Element* e, PseudoId pseudoId, bool authorOnly, bool includeEmptyRules)
{
if (!e || !e->document()->haveStylesheetsLoaded())
return 0;
@@ -1868,14 +1866,14 @@ PassRefPtr<CSSRuleList> CSSStyleSelector::pseudoStyleRulesForElement(Element* e,
// Now we check user sheet rules.
if (m_matchAuthorAndUserStyles) {
int firstUserRule = -1, lastUserRule = -1;
- matchRules(m_userStyle.get(), firstUserRule, lastUserRule);
+ matchRules(m_userStyle.get(), firstUserRule, lastUserRule, includeEmptyRules);
}
}
if (m_matchAuthorAndUserStyles) {
// Check the rules in author sheets.
int firstAuthorRule = -1, lastAuthorRule = -1;
- matchRules(m_authorStyle.get(), firstAuthorRule, lastAuthorRule);
+ matchRules(m_authorStyle.get(), firstAuthorRule, lastAuthorRule, includeEmptyRules);
}
m_checker.m_collectRulesOnly = false;
@@ -1888,7 +1886,7 @@ bool CSSStyleSelector::checkSelector(CSSSelector* sel)
m_dynamicPseudo = NOPSEUDO;
// Check the selector
- SelectorMatch match = m_checker.checkSelector(sel, m_element, &m_selectorAttrs, m_dynamicPseudo, false, false, style(), m_parentStyle);
+ SelectorMatch match = m_checker.checkSelector(sel, m_element, &m_selectorAttrs, m_dynamicPseudo, false, false, style(), m_parentNode ? m_parentNode->renderStyle() : 0);
if (match != SelectorMatches)
return false;
@@ -2925,7 +2923,7 @@ void CSSStyleSelector::applyDeclarations(bool isImportant, int startIndex, int e
if (applyFirst) {
COMPILE_ASSERT(firstCSSProperty == CSSPropertyColor, CSS_color_is_first_property);
- COMPILE_ASSERT(CSSPropertyZoom == CSSPropertyColor + 12, CSS_zoom_is_end_of_first_prop_range);
+ COMPILE_ASSERT(CSSPropertyZoom == CSSPropertyColor + 14, CSS_zoom_is_end_of_first_prop_range);
COMPILE_ASSERT(CSSPropertyLineHeight == CSSPropertyZoom + 1, CSS_line_height_is_after_zoom);
// give special priority to font-xxx, color properties, etc
@@ -3113,7 +3111,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
bool isInherit = m_parentNode && valueType == CSSValue::CSS_INHERIT;
bool isInitial = valueType == CSSValue::CSS_INITIAL || (!m_parentNode && valueType == CSSValue::CSS_INHERIT);
- id = CSSProperty::resolveDirectionAwareProperty(id, m_style->direction());
+ id = CSSProperty::resolveDirectionAwareProperty(id, m_style->direction(), m_style->blockFlow());
if (m_checker.m_matchVisitedPseudoClass && !isValidVisitedLinkProperty(id)) {
// Limit the properties that can be applied to only the ones honored by :visited.
@@ -4151,10 +4149,8 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
else if (CSSPrimitiveValue::isUnitTypeLength(type)) {
double multiplier = zoomFactor;
if (m_style->textSizeAdjust()) {
- if (FrameView* view = m_checker.m_document->view()) {
- if (view->shouldApplyTextZoom())
- multiplier *= view->textZoomFactor();
- }
+ if (Frame* frame = m_checker.m_document->frame())
+ multiplier *= frame->textZoomFactor();
}
lineHeight = Length(primitiveValue->computeLengthIntForLength(style(), m_rootElementStyle, multiplier), Fixed);
} else if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
@@ -5478,10 +5474,28 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
case CSSPropertyWebkitBorderStartColor:
case CSSPropertyWebkitBorderStartStyle:
case CSSPropertyWebkitBorderStartWidth:
+ case CSSPropertyWebkitBorderBefore:
+ case CSSPropertyWebkitBorderBeforeColor:
+ case CSSPropertyWebkitBorderBeforeStyle:
+ case CSSPropertyWebkitBorderBeforeWidth:
+ case CSSPropertyWebkitBorderAfter:
+ case CSSPropertyWebkitBorderAfterColor:
+ case CSSPropertyWebkitBorderAfterStyle:
+ case CSSPropertyWebkitBorderAfterWidth:
case CSSPropertyWebkitMarginEnd:
case CSSPropertyWebkitMarginStart:
+ case CSSPropertyWebkitMarginBefore:
+ case CSSPropertyWebkitMarginAfter:
case CSSPropertyWebkitPaddingEnd:
case CSSPropertyWebkitPaddingStart:
+ case CSSPropertyWebkitPaddingBefore:
+ case CSSPropertyWebkitPaddingAfter:
+ case CSSPropertyWebkitLogicalWidth:
+ case CSSPropertyWebkitLogicalHeight:
+ case CSSPropertyWebkitMinLogicalWidth:
+ case CSSPropertyWebkitMinLogicalHeight:
+ case CSSPropertyWebkitMaxLogicalWidth:
+ case CSSPropertyWebkitMaxLogicalHeight:
ASSERT_NOT_REACHED();
break;
@@ -5525,6 +5539,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
return;
#endif
+<<<<<<< HEAD
#ifdef ANDROID_CSS_RING
case CSSPropertyWebkitRing:
if (valueType != CSSValue::CSS_INHERIT || !m_parentNode) return;
@@ -5668,6 +5683,54 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
return;
}
#endif
+=======
+ // CSS Text Layout Module Level 3: Vertical writing support
+ case CSSPropertyWebkitBlockFlow:
+ HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(blockFlow, BlockFlow)
+ return;
+
+ case CSSPropertyWebkitWritingMode:
+ // The 'writing-mode' property is a shorthand property for the 'direction' property and the 'block-flow' property.
+ if (isInherit) {
+ m_style->setDirection(m_parentStyle->direction());
+ m_style->setBlockFlow(m_parentStyle->blockFlow());
+ } else if (isInitial) {
+ m_style->setDirection(m_style->initialDirection());
+ m_style->setBlockFlow(m_style->initialBlockFlow());
+ } else {
+ if (!primitiveValue)
+ return;
+ switch (primitiveValue->getIdent()) {
+ case CSSValueLrTb:
+ m_style->setDirection(LTR);
+ m_style->setBlockFlow(TopToBottomBlockFlow);
+ break;
+ case CSSValueRlTb:
+ m_style->setDirection(RTL);
+ m_style->setBlockFlow(TopToBottomBlockFlow);
+ break;
+ case CSSValueTbRl:
+ m_style->setDirection(LTR);
+ m_style->setBlockFlow(RightToLeftBlockFlow);
+ break;
+ case CSSValueBtRl:
+ m_style->setDirection(RTL);
+ m_style->setBlockFlow(RightToLeftBlockFlow);
+ break;
+ case CSSValueTbLr:
+ m_style->setDirection(LTR);
+ m_style->setBlockFlow(LeftToRightBlockFlow);
+ break;
+ case CSSValueBtLr:
+ m_style->setDirection(RTL);
+ m_style->setBlockFlow(LeftToRightBlockFlow);
+ break;
+ default:
+ break;
+ }
+ }
+ return;
+>>>>>>> webkit.org at r67908
#if ENABLE(SVG)
default:
@@ -6375,8 +6438,8 @@ float CSSStyleSelector::getComputedSizeFromSpecifiedSize(Document* document, Ren
float zoomFactor = 1.0f;
if (!useSVGZoomRules) {
zoomFactor = style->effectiveZoom();
- if (document->view() && document->view()->shouldApplyTextZoom())
- zoomFactor *= document->view()->textZoomFactor();
+ if (Frame* frame = document->frame())
+ zoomFactor *= frame->textZoomFactor();
}
// We support two types of minimum font size. The first is a hard override that applies to
diff --git a/WebCore/css/CSSStyleSelector.h b/WebCore/css/CSSStyleSelector.h
index 4a4565d..b77f23c 100644
--- a/WebCore/css/CSSStyleSelector.h
+++ b/WebCore/css/CSSStyleSelector.h
@@ -119,8 +119,8 @@ public:
public:
// These methods will give back the set of rules that matched for a given element (or a pseudo-element).
- PassRefPtr<CSSRuleList> styleRulesForElement(Element*, bool authorOnly);
- PassRefPtr<CSSRuleList> pseudoStyleRulesForElement(Element*, PseudoId, bool authorOnly);
+ PassRefPtr<CSSRuleList> styleRulesForElement(Element*, bool authorOnly, bool includeEmptyRules = false);
+ PassRefPtr<CSSRuleList> pseudoStyleRulesForElement(Element*, PseudoId, bool authorOnly, bool includeEmptyRules = false);
// Given a CSS keyword in the range (xx-small to -webkit-xxx-large), this function will return
// the correct font size scaled relative to the user's default (medium).
@@ -186,8 +186,8 @@ public:
void addMatchedRule(CSSRuleData* rule) { m_matchedRules.append(rule); }
void addMatchedDeclaration(CSSMutableStyleDeclaration* decl);
- void matchRules(CSSRuleSet*, int& firstRuleIndex, int& lastRuleIndex);
- void matchRulesForList(CSSRuleDataList*, int& firstRuleIndex, int& lastRuleIndex);
+ void matchRules(CSSRuleSet*, int& firstRuleIndex, int& lastRuleIndex, bool includeEmptyRules);
+ void matchRulesForList(CSSRuleDataList*, int& firstRuleIndex, int& lastRuleIndex, bool includeEmptyRules);
void sortMatchedRules(unsigned start, unsigned end);
template <bool firstPass>
diff --git a/WebCore/css/CSSValueKeywords.in b/WebCore/css/CSSValueKeywords.in
index 1e7c2b5..990bb36 100644
--- a/WebCore/css/CSSValueKeywords.in
+++ b/WebCore/css/CSSValueKeywords.in
@@ -742,3 +742,17 @@ windowed
# none
manual
# auto
+
+# -webkit-block-flow
+tb
+rl
+lr
+bt
+
+# -webkit-writing-mode
+lr-tb
+rl-tb
+tb-rl
+bt-rl
+tb-lr
+bt-lr
diff --git a/WebCore/css/SVGCSSComputedStyleDeclaration.cpp b/WebCore/css/SVGCSSComputedStyleDeclaration.cpp
index 410eede..0cf6181 100644
--- a/WebCore/css/SVGCSSComputedStyleDeclaration.cpp
+++ b/WebCore/css/SVGCSSComputedStyleDeclaration.cpp
@@ -180,7 +180,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getSVGPropertyCSSValue(int pro
return 0;
}
case CSSPropertyWebkitSvgShadow:
- return valueForShadow(svgStyle->shadow(), propertyID);
+ return valueForShadow(svgStyle->shadow(), propertyID, style);
case CSSPropertyVectorEffect:
return CSSPrimitiveValue::create(svgStyle->vectorEffect());
case CSSPropertyMarker:
diff --git a/WebCore/css/SVGCSSParser.cpp b/WebCore/css/SVGCSSParser.cpp
index 535b273..3c42d40 100644
--- a/WebCore/css/SVGCSSParser.cpp
+++ b/WebCore/css/SVGCSSParser.cpp
@@ -232,7 +232,7 @@ bool CSSParser::parseSVGValue(int propId, bool important)
case CSSPropertyWritingMode:
// lr-tb | rl_tb | tb-rl | lr | rl | tb | inherit
- if (id >= CSSValueLrTb && id <= CSSValueTb)
+ if (id == CSSValueLrTb || id == CSSValueRlTb || id == CSSValueTbRl || id == CSSValueLr || id == CSSValueRl || id == CSSValueTb)
valid_primitive = true;
break;
diff --git a/WebCore/css/SVGCSSValueKeywords.in b/WebCore/css/SVGCSSValueKeywords.in
index 420fbd8..a2c9f83 100644
--- a/WebCore/css/SVGCSSValueKeywords.in
+++ b/WebCore/css/SVGCSSValueKeywords.in
@@ -276,12 +276,3 @@ reset-size
# CSS_PROP_VECTOR_EFFECT
# none
non-scaling-stroke
-
-
-# CSS_PROP_WRITING_MODE
-lr-tb
-rl-tb
-tb-rl
-lr
-rl
-tb
diff --git a/WebCore/css/mediaControlsQuickTime.css b/WebCore/css/mediaControlsQuickTime.css
index d2c731f..06f31ae 100644
--- a/WebCore/css/mediaControlsQuickTime.css
+++ b/WebCore/css/mediaControlsQuickTime.css
@@ -221,4 +221,4 @@ audio::-webkit-media-controls-volume-slider-mute-button, video::-webkit-media-co
width: 14px;
height: 12px;
-}
+}