diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2012-10-17 16:21:14 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-10-17 16:21:14 +0200 |
commit | 8995b83bcbfbb68245f779b64e5517627c6cc6ea (patch) | |
tree | 17985605dab9263cc2444bd4d45f189e142cca7c /Source/WebCore/css/CSSComputedStyleDeclaration.cpp | |
parent | b9c9652036d5e9f1e29c574f40bc73a35c81ace6 (diff) | |
download | qtwebkit-8995b83bcbfbb68245f779b64e5517627c6cc6ea.tar.gz |
Imported WebKit commit cf4f8fc6f19b0629f51860cb2d4b25e139d07e00 (http://svn.webkit.org/repository/webkit/trunk@131592)
New snapshot that includes the build fixes for Mac OS X 10.6 and earlier as well
as the previously cherry-picked changes
Diffstat (limited to 'Source/WebCore/css/CSSComputedStyleDeclaration.cpp')
-rw-r--r-- | Source/WebCore/css/CSSComputedStyleDeclaration.cpp | 90 |
1 files changed, 71 insertions, 19 deletions
diff --git a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp index d10d738a3..7307402bf 100644 --- a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp +++ b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp @@ -49,6 +49,7 @@ #include "FontFeatureSettings.h" #include "FontFeatureValue.h" #include "FontValue.h" +#include "HTMLFrameOwnerElement.h" #include "Pair.h" #include "Rect.h" #include "RenderBox.h" @@ -58,6 +59,7 @@ #include "StyleInheritedData.h" #include "StylePropertySet.h" #include "StylePropertyShorthand.h" +#include "StyleResolver.h" #include "WebCoreMemoryInstrumentation.h" #include "WebKitCSSTransformValue.h" #include "WebKitFontFamilyNames.h" @@ -78,7 +80,7 @@ #include "WebKitCSSFilterValue.h" #endif -#if ENABLE(DASHBOARD_SUPPORT) || ENABLE(WIDGET_REGION) +#if ENABLE(DASHBOARD_SUPPORT) #include "DashboardRegion.h" #endif @@ -349,8 +351,8 @@ static const CSSPropertyID computedProperties[] = { CSSPropertyWebkitRegionBreakBefore, CSSPropertyWebkitRegionBreakInside, #endif -#if ENABLE(WIDGET_REGION) - CSSPropertyWebkitWidgetRegion, +#if ENABLE(DRAGGABLE_REGION) + CSSPropertyWebkitAppRegion, #endif #if ENABLE(CSS_EXCLUSIONS) CSSPropertyWebkitWrapFlow, @@ -919,7 +921,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::valueForFilter(const RenderObj shadersList->append(cssValuePool().createIdentifierValue(CSSValueNone)); const CustomFilterProgramMixSettings mixSettings = program->mixSettings(); - if (mixSettings.enabled) { + if (program->programType() == PROGRAM_TYPE_BLENDS_ELEMENT_TEXTURE) { RefPtr<WebKitCSSMixFunctionValue> mixFunction = WebKitCSSMixFunctionValue::create(); mixFunction->append(program->fragmentShader()->cssValue()); mixFunction->append(cssValuePool().createValue(mixSettings.blendMode)); @@ -1300,8 +1302,8 @@ static PassRefPtr<CSSValue> counterToCSSValue(const RenderStyle* style, CSSPrope RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); for (CounterDirectiveMap::const_iterator it = map->begin(); it != map->end(); ++it) { - list->append(cssValuePool().createValue(it->first, CSSPrimitiveValue::CSS_STRING)); - short number = propertyID == CSSPropertyCounterIncrement ? it->second.incrementValue() : it->second.resetValue(); + list->append(cssValuePool().createValue(it->key, CSSPrimitiveValue::CSS_STRING)); + short number = propertyID == CSSPropertyCounterIncrement ? it->value.incrementValue() : it->value.resetValue(); list->append(cssValuePool().createValue((double)number, CSSPrimitiveValue::CSS_NUMBER)); } return list.release(); @@ -1384,15 +1386,57 @@ static PassRefPtr<CSSPrimitiveValue> fontWeightFromStyle(RenderStyle* style) return cssValuePool().createIdentifierValue(CSSValueNormal); } +static bool isLayoutDependentProperty(CSSPropertyID propertyID) +{ + switch (propertyID) { + case CSSPropertyWidth: + case CSSPropertyHeight: + case CSSPropertyMargin: + case CSSPropertyMarginTop: + case CSSPropertyMarginBottom: + case CSSPropertyMarginLeft: + case CSSPropertyMarginRight: + case CSSPropertyPadding: + case CSSPropertyPaddingTop: + case CSSPropertyPaddingBottom: + case CSSPropertyPaddingLeft: + case CSSPropertyPaddingRight: + case CSSPropertyWebkitPerspectiveOrigin: + case CSSPropertyWebkitTransformOrigin: + case CSSPropertyWebkitTransform: +#if ENABLE(CSS_FILTERS) + case CSSPropertyWebkitFilter: +#endif + return true; + default: + return false; + } +} + PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropertyID propertyID, EUpdateLayout updateLayout) const { Node* node = m_node.get(); if (!node) return 0; - // Make sure our layout is up to date before we allow a query on these attributes. - if (updateLayout) - node->document()->updateLayoutIgnorePendingStylesheets(); + if (updateLayout) { + Document* document = m_node->document(); + // FIXME: Some of these cases could be narrowed down or optimized better. + bool forceFullLayout = isLayoutDependentProperty(propertyID) + || node->isInShadowTree() + || (document->styleResolverIfExists() && document->styleResolverIfExists()->hasViewportDependentMediaQueries() && document->ownerElement()) + || document->seamlessParentIFrame(); + + if (forceFullLayout) + document->updateLayoutIgnorePendingStylesheets(); + else { + bool needsStyleRecalc = document->hasPendingForcedStyleRecalc(); + for (Node* n = m_node.get(); n && !needsStyleRecalc; n = n->parentNode()) + needsStyleRecalc = n->needsStyleRecalc(); + if (needsStyleRecalc) + document->updateStyleIfNeeded(); + } + } RenderObject* renderer = node->renderer(); @@ -2125,13 +2169,8 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert if (style->boxSizing() == CONTENT_BOX) return cssValuePool().createIdentifierValue(CSSValueContentBox); return cssValuePool().createIdentifierValue(CSSValueBorderBox); -#if ENABLE(DASHBOARD_SUPPORT) || ENABLE(WIDGET_REGION) #if ENABLE(DASHBOARD_SUPPORT) case CSSPropertyWebkitDashboardRegion: -#endif -#if ENABLE(WIDGET_REGION) - case CSSPropertyWebkitWidgetRegion: -#endif { const Vector<StyleDashboardRegion>& regions = style->dashboardRegions(); unsigned count = regions.size(); @@ -2162,6 +2201,10 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert return cssValuePool().createValue(firstRegion.release()); } #endif +#if ENABLE(DRAGGABLE_REGION) + case CSSPropertyWebkitAppRegion: + return cssValuePool().createIdentifierValue(style->getDraggableRegionMode() == DraggableRegionDrag ? CSSValueDrag : CSSValueNoDrag); +#endif case CSSPropertyWebkitAnimationDelay: return getDelayValue(style->animations()); case CSSPropertyWebkitAnimationDirection: { @@ -2300,7 +2343,10 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert case CSSPropertyWebkitPerspectiveOrigin: { RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); if (renderer) { - LayoutRect box = sizingBox(renderer); + LayoutRect box; + if (renderer->isBox()) + box = toRenderBox(renderer)->borderBoxRect(); + RenderView* renderView = m_node->document()->renderView(); list->append(zoomAdjustedPixelValue(minimumValueForLength(style->perspectiveOriginX(), box.width(), renderView), style.get())); list->append(zoomAdjustedPixelValue(minimumValueForLength(style->perspectiveOriginY(), box.height(), renderView), style.get())); @@ -2421,6 +2467,12 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert if (ClipPathOperation* operation = style->clipPath()) { if (operation->getOperationType() == ClipPathOperation::SHAPE) return valueForBasicShape(static_cast<ShapeClipPathOperation*>(operation)->basicShape()); +#if ENABLE(SVG) + else if (operation->getOperationType() == ClipPathOperation::REFERENCE) { + ReferenceClipPathOperation* referenceOperation = static_cast<ReferenceClipPathOperation*>(operation); + return CSSPrimitiveValue::create(referenceOperation->url(), CSSPrimitiveValue::CSS_URI); + } +#endif } return cssValuePool().createIdentifierValue(CSSValueNone); #if ENABLE(CSS_REGIONS) @@ -2443,13 +2495,13 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert case CSSPropertyWebkitWrapPadding: return cssValuePool().createValue(style->wrapPadding()); case CSSPropertyWebkitShapeInside: - if (!style->wrapShapeInside()) + if (!style->shapeInside()) return cssValuePool().createIdentifierValue(CSSValueAuto); - return valueForBasicShape(style->wrapShapeInside()); + return valueForBasicShape(style->shapeInside()); case CSSPropertyWebkitShapeOutside: - if (!style->wrapShapeOutside()) + if (!style->shapeOutside()) return cssValuePool().createIdentifierValue(CSSValueAuto); - return valueForBasicShape(style->wrapShapeOutside()); + return valueForBasicShape(style->shapeOutside()); case CSSPropertyWebkitWrapThrough: return cssValuePool().createValue(style->wrapThrough()); #endif |