static bool paintMediaSlider(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect) { HTMLMediaElement* mediaElement = toParentMediaElement(object); if (!mediaElement) return false; RenderStyle* style = object->style(); GraphicsContext* context = paintInfo.context; // Draw the border of the time bar. // FIXME: this should be a rounded rect but need to fix GraphicsContextSkia first. // https://bugs.webkit.org/show_bug.cgi?id=30143 context->save(); context->setShouldAntialias(true); context->setStrokeStyle(SolidStroke); context->setStrokeColor(style->visitedDependentColor(CSSPropertyBorderLeftColor), ColorSpaceDeviceRGB); context->setStrokeThickness(style->borderLeftWidth()); context->setFillColor(style->visitedDependentColor(CSSPropertyBackgroundColor), ColorSpaceDeviceRGB); context->drawRect(rect); context->restore(); // Draw the buffered ranges. // FIXME: Draw multiple ranges if there are multiple buffered ranges. IntRect bufferedRect = rect; bufferedRect.inflate(-style->borderLeftWidth()); double bufferedWidth = 0.0; if (mediaElement->percentLoaded() > 0.0) { // Account for the width of the slider thumb. Image* mediaSliderThumb = getMediaSliderThumb(); double thumbWidth = mediaSliderThumb->width() / 2.0 + 1.0; double rectWidth = bufferedRect.width() - thumbWidth; if (rectWidth < 0.0) rectWidth = 0.0; bufferedWidth = rectWidth * mediaElement->percentLoaded() + thumbWidth; } bufferedRect.setWidth(bufferedWidth); // Don't bother drawing an empty area. if (!bufferedRect.isEmpty()) { IntPoint sliderTopLeft = bufferedRect.location(); IntPoint sliderTopRight = sliderTopLeft; sliderTopRight.move(0, bufferedRect.height()); RefPtr<Gradient> gradient = Gradient::create(sliderTopLeft, sliderTopRight); Color startColor = object->style()->visitedDependentColor(CSSPropertyColor); gradient->addColorStop(0.0, startColor); gradient->addColorStop(1.0, Color(startColor.red() / 2, startColor.green() / 2, startColor.blue() / 2, startColor.alpha())); context->save(); context->setStrokeStyle(NoStroke); context->setFillGradient(gradient); context->fillRect(bufferedRect); context->restore(); } return true; }
bool RenderThemeGtk::paintMediaSliderTrack(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { GraphicsContext* context = paintInfo.context; context->fillRect(FloatRect(r), m_panelColor, ColorSpaceDeviceRGB); context->fillRect(FloatRect(IntRect(r.x(), r.y() + (r.height() - m_mediaSliderHeight) / 2, r.width(), m_mediaSliderHeight)), m_sliderColor, ColorSpaceDeviceRGB); RenderStyle* style = o->style(); HTMLMediaElement* mediaElement = toParentMediaElement(o); if (!mediaElement) return false; // Draw the buffered ranges. This code is highly inspired from // Chrome for the gradient code. float mediaDuration = mediaElement->duration(); RefPtr<TimeRanges> timeRanges = mediaElement->buffered(); IntRect trackRect = r; int totalWidth = trackRect.width(); trackRect.inflate(-style->borderLeftWidth()); context->save(); context->setStrokeStyle(NoStroke); for (unsigned index = 0; index < timeRanges->length(); ++index) { ExceptionCode ignoredException; float start = timeRanges->start(index, ignoredException); float end = timeRanges->end(index, ignoredException); int width = ((end - start) * totalWidth) / mediaDuration; IntRect rangeRect; if (!index) { rangeRect = trackRect; rangeRect.setWidth(width); } else { rangeRect.setLocation(IntPoint(trackRect.x() + start / mediaDuration* totalWidth, trackRect.y())); rangeRect.setSize(IntSize(width, trackRect.height())); } // Don't bother drawing empty range. if (rangeRect.isEmpty()) continue; IntPoint sliderTopLeft = rangeRect.location(); IntPoint sliderTopRight = sliderTopLeft; sliderTopRight.move(0, rangeRect.height()); RefPtr<Gradient> gradient = Gradient::create(sliderTopLeft, sliderTopRight); Color startColor = m_panelColor; gradient->addColorStop(0.0, startColor); gradient->addColorStop(1.0, Color(startColor.red() / 2, startColor.green() / 2, startColor.blue() / 2, startColor.alpha())); context->setFillGradient(gradient); context->fillRect(rangeRect); } context->restore(); return false; }
bool RenderThemeGtk::paintMediaSliderTrack(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) { GraphicsContext* context = paintInfo.context; context->fillRect(FloatRect(r), m_panelColor, DeviceColorSpace); context->fillRect(FloatRect(IntRect(r.x(), r.y() + (r.height() - m_mediaSliderHeight) / 2, r.width(), m_mediaSliderHeight)), m_sliderColor, DeviceColorSpace); RenderStyle* style = o->style(); HTMLMediaElement* mediaElement = toParentMediaElement(o); if (!mediaElement) return false; // Draw the buffered ranges. This code is highly inspired from // Chrome. // FIXME: Draw multiple ranges if there are multiple buffered // ranges. The current implementation of the player is always // buffering a single range anyway. IntRect bufferedRect = r; bufferedRect.inflate(-style->borderLeftWidth()); bufferedRect.setWidth((bufferedRect.width() * mediaElement->percentLoaded())); // Don't bother drawing an empty area. if (bufferedRect.isEmpty()) return false; IntPoint sliderTopLeft = bufferedRect.location(); IntPoint sliderTopRight = sliderTopLeft; sliderTopRight.move(0, bufferedRect.height()); RefPtr<Gradient> gradient = Gradient::create(sliderTopLeft, sliderTopRight); Color startColor = m_panelColor; gradient->addColorStop(0.0, startColor); gradient->addColorStop(1.0, Color(startColor.red() / 2, startColor.green() / 2, startColor.blue() / 2, startColor.alpha())); context->save(); context->setStrokeStyle(NoStroke); context->setFillGradient(gradient); context->fillRect(bufferedRect); context->restore(); return false; }
void RenderTheme::adjustStyle(StyleResolver& styleResolver, RenderStyle& style, Element* element, bool UAHasAppearance, const BorderData& border, const FillLayer& background, const Color& backgroundColor) { // Force inline and table display styles to be inline-block (except for table- which is block) ControlPart part = style.appearance(); if (style.display() == INLINE || style.display() == INLINE_TABLE || style.display() == TABLE_ROW_GROUP || style.display() == TABLE_HEADER_GROUP || style.display() == TABLE_FOOTER_GROUP || style.display() == TABLE_ROW || style.display() == TABLE_COLUMN_GROUP || style.display() == TABLE_COLUMN || style.display() == TABLE_CELL || style.display() == TABLE_CAPTION) style.setDisplay(INLINE_BLOCK); else if (style.display() == COMPACT || style.display() == LIST_ITEM || style.display() == TABLE) style.setDisplay(BLOCK); if (UAHasAppearance && isControlStyled(style, border, background, backgroundColor)) { if (part == MenulistPart) { style.setAppearance(MenulistButtonPart); part = MenulistButtonPart; } else style.setAppearance(NoControlPart); } if (!style.hasAppearance()) return; // Never support box-shadow on native controls. style.setBoxShadow(nullptr); #if USE(NEW_THEME) switch (part) { case CheckboxPart: case InnerSpinButtonPart: case RadioPart: case PushButtonPart: case SquareButtonPart: case DefaultButtonPart: case ButtonPart: { // Border LengthBox borderBox(style.borderTopWidth(), style.borderRightWidth(), style.borderBottomWidth(), style.borderLeftWidth()); borderBox = m_theme->controlBorder(part, style.fontCascade(), borderBox, style.effectiveZoom()); if (borderBox.top().value() != static_cast<int>(style.borderTopWidth())) { if (borderBox.top().value()) style.setBorderTopWidth(borderBox.top().value()); else style.resetBorderTop(); } if (borderBox.right().value() != static_cast<int>(style.borderRightWidth())) { if (borderBox.right().value()) style.setBorderRightWidth(borderBox.right().value()); else style.resetBorderRight(); } if (borderBox.bottom().value() != static_cast<int>(style.borderBottomWidth())) { style.setBorderBottomWidth(borderBox.bottom().value()); if (borderBox.bottom().value()) style.setBorderBottomWidth(borderBox.bottom().value()); else style.resetBorderBottom(); } if (borderBox.left().value() != static_cast<int>(style.borderLeftWidth())) { style.setBorderLeftWidth(borderBox.left().value()); if (borderBox.left().value()) style.setBorderLeftWidth(borderBox.left().value()); else style.resetBorderLeft(); } // Padding LengthBox paddingBox = m_theme->controlPadding(part, style.fontCascade(), style.paddingBox(), style.effectiveZoom()); if (paddingBox != style.paddingBox()) style.setPaddingBox(paddingBox); // Whitespace if (m_theme->controlRequiresPreWhiteSpace(part)) style.setWhiteSpace(PRE); // Width / Height // The width and height here are affected by the zoom. // FIXME: Check is flawed, since it doesn't take min-width/max-width into account. LengthSize controlSize = m_theme->controlSize(part, style.fontCascade(), LengthSize(style.width(), style.height()), style.effectiveZoom()); if (controlSize.width() != style.width()) style.setWidth(controlSize.width()); if (controlSize.height() != style.height()) style.setHeight(controlSize.height()); // Min-Width / Min-Height LengthSize minControlSize = m_theme->minimumControlSize(part, style.fontCascade(), style.effectiveZoom()); if (minControlSize.width() != style.minWidth()) style.setMinWidth(minControlSize.width()); if (minControlSize.height() != style.minHeight()) style.setMinHeight(minControlSize.height()); // Font if (auto themeFont = m_theme->controlFont(part, style.fontCascade(), style.effectiveZoom())) { // If overriding the specified font with the theme font, also override the line height with the standard line height. style.setLineHeight(RenderStyle::initialLineHeight()); if (style.setFontDescription(themeFont.value())) style.fontCascade().update(nullptr); } // Special style that tells enabled default buttons in active windows to use the ActiveButtonText color. // The active window part of the test has to be done at paint time since it's not triggered by a style change. style.setInsideDefaultButton(part == DefaultButtonPart && element && !element->isDisabledFormControl()); break; } default: break; } #endif // Call the appropriate style adjustment method based off the appearance value. switch (style.appearance()) { #if !USE(NEW_THEME) case CheckboxPart: return adjustCheckboxStyle(styleResolver, style, element); case RadioPart: return adjustRadioStyle(styleResolver, style, element); case PushButtonPart: case SquareButtonPart: case DefaultButtonPart: case ButtonPart: return adjustButtonStyle(styleResolver, style, element); case InnerSpinButtonPart: return adjustInnerSpinButtonStyle(styleResolver, style, element); #endif case TextFieldPart: return adjustTextFieldStyle(styleResolver, style, element); case TextAreaPart: return adjustTextAreaStyle(styleResolver, style, element); case MenulistPart: return adjustMenuListStyle(styleResolver, style, element); case MenulistButtonPart: return adjustMenuListButtonStyle(styleResolver, style, element); case MediaPlayButtonPart: case MediaCurrentTimePart: case MediaTimeRemainingPart: case MediaEnterFullscreenButtonPart: case MediaExitFullscreenButtonPart: case MediaMuteButtonPart: case MediaVolumeSliderContainerPart: return adjustMediaControlStyle(styleResolver, style, element); case MediaSliderPart: case MediaVolumeSliderPart: case MediaFullScreenVolumeSliderPart: case SliderHorizontalPart: case SliderVerticalPart: return adjustSliderTrackStyle(styleResolver, style, element); case SliderThumbHorizontalPart: case SliderThumbVerticalPart: return adjustSliderThumbStyle(styleResolver, style, element); case SearchFieldPart: return adjustSearchFieldStyle(styleResolver, style, element); case SearchFieldCancelButtonPart: return adjustSearchFieldCancelButtonStyle(styleResolver, style, element); case SearchFieldDecorationPart: return adjustSearchFieldDecorationPartStyle(styleResolver, style, element); case SearchFieldResultsDecorationPart: return adjustSearchFieldResultsDecorationPartStyle(styleResolver, style, element); case SearchFieldResultsButtonPart: return adjustSearchFieldResultsButtonStyle(styleResolver, style, element); case ProgressBarPart: return adjustProgressBarStyle(styleResolver, style, element); #if ENABLE(METER_ELEMENT) case MeterPart: case RelevancyLevelIndicatorPart: case ContinuousCapacityLevelIndicatorPart: case DiscreteCapacityLevelIndicatorPart: case RatingLevelIndicatorPart: return adjustMeterStyle(styleResolver, style, element); #endif #if ENABLE(SERVICE_CONTROLS) case ImageControlsButtonPart: break; #endif case CapsLockIndicatorPart: return adjustCapsLockIndicatorStyle(styleResolver, style, element); #if ENABLE(ATTACHMENT_ELEMENT) case AttachmentPart: return adjustAttachmentStyle(styleResolver, style, element); #endif default: break; } }
bool CSSPropertyEquality::propertiesEqual(CSSPropertyID prop, const RenderStyle& a, const RenderStyle& b) { switch (prop) { case CSSPropertyBackgroundColor: return a.backgroundColor().resolve(a.color()) == b.backgroundColor().resolve(b.color()) && a.visitedLinkBackgroundColor().resolve(a.color()) == b.visitedLinkBackgroundColor().resolve(b.color()); case CSSPropertyBackgroundImage: return fillLayersEqual<CSSPropertyBackgroundImage>(a.backgroundLayers(), b.backgroundLayers()); case CSSPropertyBackgroundPositionX: return fillLayersEqual<CSSPropertyBackgroundPositionX>(a.backgroundLayers(), b.backgroundLayers()); case CSSPropertyBackgroundPositionY: return fillLayersEqual<CSSPropertyBackgroundPositionY>(a.backgroundLayers(), b.backgroundLayers()); case CSSPropertyBackgroundSize: return fillLayersEqual<CSSPropertyBackgroundSize>(a.backgroundLayers(), b.backgroundLayers()); case CSSPropertyBaselineShift: return dataEquivalent(a.baselineShiftValue(), b.baselineShiftValue()); case CSSPropertyBorderBottomColor: return a.borderBottomColor().resolve(a.color()) == b.borderBottomColor().resolve(b.color()) && a.visitedLinkBorderBottomColor().resolve(a.color()) == b.visitedLinkBorderBottomColor().resolve(b.color()); case CSSPropertyBorderBottomLeftRadius: return a.borderBottomLeftRadius() == b.borderBottomLeftRadius(); case CSSPropertyBorderBottomRightRadius: return a.borderBottomRightRadius() == b.borderBottomRightRadius(); case CSSPropertyBorderBottomWidth: return a.borderBottomWidth() == b.borderBottomWidth(); case CSSPropertyBorderImageOutset: return a.borderImageOutset() == b.borderImageOutset(); case CSSPropertyBorderImageSlice: return a.borderImageSlices() == b.borderImageSlices(); case CSSPropertyBorderImageSource: return dataEquivalent(a.borderImageSource(), b.borderImageSource()); case CSSPropertyBorderImageWidth: return a.borderImageWidth() == b.borderImageWidth(); case CSSPropertyBorderLeftColor: return a.borderLeftColor().resolve(a.color()) == b.borderLeftColor().resolve(b.color()) && a.visitedLinkBorderLeftColor().resolve(a.color()) == b.visitedLinkBorderLeftColor().resolve(b.color()); case CSSPropertyBorderLeftWidth: return a.borderLeftWidth() == b.borderLeftWidth(); case CSSPropertyBorderRightColor: return a.borderRightColor().resolve(a.color()) == b.borderRightColor().resolve(b.color()) && a.visitedLinkBorderRightColor().resolve(a.color()) == b.visitedLinkBorderRightColor().resolve(b.color()); case CSSPropertyBorderRightWidth: return a.borderRightWidth() == b.borderRightWidth(); case CSSPropertyBorderTopColor: return a.borderTopColor().resolve(a.color()) == b.borderTopColor().resolve(b.color()) && a.visitedLinkBorderTopColor().resolve(a.color()) == b.visitedLinkBorderTopColor().resolve(b.color()); case CSSPropertyBorderTopLeftRadius: return a.borderTopLeftRadius() == b.borderTopLeftRadius(); case CSSPropertyBorderTopRightRadius: return a.borderTopRightRadius() == b.borderTopRightRadius(); case CSSPropertyBorderTopWidth: return a.borderTopWidth() == b.borderTopWidth(); case CSSPropertyBottom: return a.bottom() == b.bottom(); case CSSPropertyBoxShadow: return dataEquivalent(a.boxShadow(), b.boxShadow()); case CSSPropertyClip: return a.clip() == b.clip(); case CSSPropertyColor: return a.color() == b.color() && a.visitedLinkColor() == b.visitedLinkColor(); case CSSPropertyFill: return a.fillPaintType() == b.fillPaintType() && (a.fillPaintType() != SVGPaint::SVG_PAINTTYPE_RGBCOLOR || a.fillPaintColor() == b.fillPaintColor()); case CSSPropertyFillOpacity: return a.fillOpacity() == b.fillOpacity(); case CSSPropertyFlexBasis: return a.flexBasis() == b.flexBasis(); case CSSPropertyFlexGrow: return a.flexGrow() == b.flexGrow(); case CSSPropertyFlexShrink: return a.flexShrink() == b.flexShrink(); case CSSPropertyFloodColor: return a.floodColor() == b.floodColor(); case CSSPropertyFloodOpacity: return a.floodOpacity() == b.floodOpacity(); case CSSPropertyFontSize: // CSSPropertyFontSize: Must pass a specified size to setFontSize if Text Autosizing is enabled, but a computed size // if text zoom is enabled (if neither is enabled it's irrelevant as they're probably the same). // FIXME: Should we introduce an option to pass the computed font size here, allowing consumers to // enable text zoom rather than Text Autosizing? See http://crbug.com/227545. return a.specifiedFontSize() == b.specifiedFontSize(); case CSSPropertyFontWeight: return a.fontWeight() == b.fontWeight(); case CSSPropertyHeight: return a.height() == b.height(); case CSSPropertyLeft: return a.left() == b.left(); case CSSPropertyLetterSpacing: return a.letterSpacing() == b.letterSpacing(); case CSSPropertyLightingColor: return a.lightingColor() == b.lightingColor(); case CSSPropertyLineHeight: return a.specifiedLineHeight() == b.specifiedLineHeight(); case CSSPropertyListStyleImage: return dataEquivalent(a.listStyleImage(), b.listStyleImage()); case CSSPropertyMarginBottom: return a.marginBottom() == b.marginBottom(); case CSSPropertyMarginLeft: return a.marginLeft() == b.marginLeft(); case CSSPropertyMarginRight: return a.marginRight() == b.marginRight(); case CSSPropertyMarginTop: return a.marginTop() == b.marginTop(); case CSSPropertyMaxHeight: return a.maxHeight() == b.maxHeight(); case CSSPropertyMaxWidth: return a.maxWidth() == b.maxWidth(); case CSSPropertyMinHeight: return a.minHeight() == b.minHeight(); case CSSPropertyMinWidth: return a.minWidth() == b.minWidth(); case CSSPropertyObjectPosition: return a.objectPosition() == b.objectPosition(); case CSSPropertyOpacity: return a.opacity() == b.opacity(); case CSSPropertyOrphans: return a.orphans() == b.orphans(); case CSSPropertyOutlineColor: return a.outlineColor().resolve(a.color()) == b.outlineColor().resolve(b.color()) && a.visitedLinkOutlineColor().resolve(a.color()) == b.visitedLinkOutlineColor().resolve(b.color()); case CSSPropertyOutlineOffset: return a.outlineOffset() == b.outlineOffset(); case CSSPropertyOutlineWidth: return a.outlineWidth() == b.outlineWidth(); case CSSPropertyPaddingBottom: return a.paddingBottom() == b.paddingBottom(); case CSSPropertyPaddingLeft: return a.paddingLeft() == b.paddingLeft(); case CSSPropertyPaddingRight: return a.paddingRight() == b.paddingRight(); case CSSPropertyPaddingTop: return a.paddingTop() == b.paddingTop(); case CSSPropertyRight: return a.right() == b.right(); case CSSPropertyShapeImageThreshold: return a.shapeImageThreshold() == b.shapeImageThreshold(); case CSSPropertyShapeMargin: return a.shapeMargin() == b.shapeMargin(); case CSSPropertyShapeOutside: return dataEquivalent(a.shapeOutside(), b.shapeOutside()); case CSSPropertyStopColor: return a.stopColor() == b.stopColor(); case CSSPropertyStopOpacity: return a.stopOpacity() == b.stopOpacity(); case CSSPropertyStroke: return a.strokePaintType() == b.strokePaintType() && (a.strokePaintType() != SVGPaint::SVG_PAINTTYPE_RGBCOLOR || a.strokePaintColor() == b.strokePaintColor()); case CSSPropertyStrokeDasharray: return dataEquivalent(a.strokeDashArray(), b.strokeDashArray()); case CSSPropertyStrokeDashoffset: return dataEquivalent(a.strokeDashOffset(), b.strokeDashOffset()); case CSSPropertyStrokeMiterlimit: return a.strokeMiterLimit() == b.strokeMiterLimit(); case CSSPropertyStrokeOpacity: return a.strokeOpacity() == b.strokeOpacity(); case CSSPropertyStrokeWidth: return dataEquivalent(a.strokeWidth(), b.strokeWidth()); case CSSPropertyTextDecorationColor: return a.textDecorationColor().resolve(a.color()) == b.textDecorationColor().resolve(b.color()) && a.visitedLinkTextDecorationColor().resolve(a.color()) == b.visitedLinkTextDecorationColor().resolve(b.color()); case CSSPropertyTextIndent: return a.textIndent() == b.textIndent(); case CSSPropertyTextShadow: return dataEquivalent(a.textShadow(), b.textShadow()); case CSSPropertyTop: return a.top() == b.top(); case CSSPropertyVisibility: return a.visibility() == b.visibility(); case CSSPropertyWebkitBackgroundSize: return fillLayersEqual<CSSPropertyWebkitBackgroundSize>(a.backgroundLayers(), b.backgroundLayers()); case CSSPropertyWebkitBorderHorizontalSpacing: return a.horizontalBorderSpacing() == b.horizontalBorderSpacing(); case CSSPropertyWebkitBorderVerticalSpacing: return a.verticalBorderSpacing() == b.verticalBorderSpacing(); case CSSPropertyWebkitBoxShadow: return dataEquivalent(a.boxShadow(), b.boxShadow()); case CSSPropertyWebkitClipPath: return dataEquivalent(a.clipPath(), b.clipPath()); case CSSPropertyWebkitColumnCount: return a.columnCount() == b.columnCount(); case CSSPropertyWebkitColumnGap: return a.columnGap() == b.columnGap(); case CSSPropertyWebkitColumnRuleColor: return a.columnRuleColor().resolve(a.color()) == b.columnRuleColor().resolve(b.color()) && a.visitedLinkColumnRuleColor().resolve(a.color()) == b.visitedLinkColumnRuleColor().resolve(b.color()); case CSSPropertyWebkitColumnRuleWidth: return a.columnRuleWidth() == b.columnRuleWidth(); case CSSPropertyWebkitColumnWidth: return a.columnWidth() == b.columnWidth(); case CSSPropertyWebkitFilter: return a.filter() == b.filter(); case CSSPropertyWebkitMaskBoxImageOutset: return a.maskBoxImageOutset() == b.maskBoxImageOutset(); case CSSPropertyWebkitMaskBoxImageSlice: return a.maskBoxImageSlices() == b.maskBoxImageSlices(); case CSSPropertyWebkitMaskBoxImageSource: return dataEquivalent(a.maskBoxImageSource(), b.maskBoxImageSource()); case CSSPropertyWebkitMaskBoxImageWidth: return a.maskBoxImageWidth() == b.maskBoxImageWidth(); case CSSPropertyWebkitMaskImage: return dataEquivalent(a.maskImage(), b.maskImage()); case CSSPropertyWebkitMaskPositionX: return fillLayersEqual<CSSPropertyWebkitMaskPositionX>(a.maskLayers(), b.maskLayers()); case CSSPropertyWebkitMaskPositionY: return fillLayersEqual<CSSPropertyWebkitMaskPositionY>(a.maskLayers(), b.maskLayers()); case CSSPropertyWebkitMaskSize: return fillLayersEqual<CSSPropertyWebkitMaskSize>(a.maskLayers(), b.maskLayers()); case CSSPropertyPerspective: return a.perspective() == b.perspective(); case CSSPropertyPerspectiveOrigin: return a.perspectiveOriginX() == b.perspectiveOriginX() && a.perspectiveOriginY() == b.perspectiveOriginY(); case CSSPropertyWebkitPerspectiveOriginX: return a.perspectiveOriginX() == b.perspectiveOriginX(); case CSSPropertyWebkitPerspectiveOriginY: return a.perspectiveOriginY() == b.perspectiveOriginY(); case CSSPropertyWebkitTextStrokeColor: return a.textStrokeColor().resolve(a.color()) == b.textStrokeColor().resolve(b.color()) && a.visitedLinkTextStrokeColor().resolve(a.color()) == b.visitedLinkTextStrokeColor().resolve(b.color()); case CSSPropertyTransform: return a.transform() == b.transform(); case CSSPropertyTransformOrigin: return a.transformOriginX() == b.transformOriginX() && a.transformOriginY() == b.transformOriginY() && a.transformOriginZ() == b.transformOriginZ(); case CSSPropertyWebkitTransformOriginX: return a.transformOriginX() == b.transformOriginX(); case CSSPropertyWebkitTransformOriginY: return a.transformOriginY() == b.transformOriginY(); case CSSPropertyWebkitTransformOriginZ: return a.transformOriginZ() == b.transformOriginZ(); case CSSPropertyWidows: return a.widows() == b.widows(); case CSSPropertyWidth: return a.width() == b.width(); case CSSPropertyWordSpacing: return a.wordSpacing() == b.wordSpacing(); case CSSPropertyZIndex: return a.zIndex() == b.zIndex(); case CSSPropertyZoom: return a.zoom() == b.zoom(); default: ASSERT_NOT_REACHED(); return true; } }
// FIXME: Generate this function. PassRefPtr<AnimatableValue> CSSAnimatableValueFactory::create(CSSPropertyID property, const RenderStyle& style) { ASSERT(CSSPropertyMetadata::isAnimatableProperty(property)); switch (property) { case CSSPropertyBackgroundColor: return createFromColor(property, style); case CSSPropertyBackgroundImage: return createFromFillLayers<CSSPropertyBackgroundImage>(style.backgroundLayers(), style); case CSSPropertyBackgroundPositionX: return createFromFillLayers<CSSPropertyBackgroundPositionX>(style.backgroundLayers(), style); case CSSPropertyBackgroundPositionY: return createFromFillLayers<CSSPropertyBackgroundPositionY>(style.backgroundLayers(), style); case CSSPropertyBackgroundSize: case CSSPropertyWebkitBackgroundSize: return createFromFillLayers<CSSPropertyBackgroundSize>(style.backgroundLayers(), style); case CSSPropertyBorderBottomColor: return createFromColor(property, style); case CSSPropertyBorderBottomLeftRadius: return createFromLengthSize(style.borderBottomLeftRadius(), style); case CSSPropertyBorderBottomRightRadius: return createFromLengthSize(style.borderBottomRightRadius(), style); case CSSPropertyBorderBottomWidth: return createFromDouble(style.borderBottomWidth()); case CSSPropertyBorderImageOutset: return createFromBorderImageLengthBox(style.borderImageOutset(), style); case CSSPropertyBorderImageSlice: return createFromLengthBox(style.borderImageSlices(), style); case CSSPropertyBorderImageSource: return createFromStyleImage(style.borderImageSource()); case CSSPropertyBorderImageWidth: return createFromBorderImageLengthBox(style.borderImageWidth(), style); case CSSPropertyBorderLeftColor: return createFromColor(property, style); case CSSPropertyBorderLeftWidth: return createFromDouble(style.borderLeftWidth()); case CSSPropertyBorderRightColor: return createFromColor(property, style); case CSSPropertyBorderRightWidth: return createFromDouble(style.borderRightWidth()); case CSSPropertyBorderTopColor: return createFromColor(property, style); case CSSPropertyBorderTopLeftRadius: return createFromLengthSize(style.borderTopLeftRadius(), style); case CSSPropertyBorderTopRightRadius: return createFromLengthSize(style.borderTopRightRadius(), style); case CSSPropertyBorderTopWidth: return createFromDouble(style.borderTopWidth()); case CSSPropertyBottom: return createFromLength(style.bottom(), style); case CSSPropertyBoxShadow: case CSSPropertyWebkitBoxShadow: return AnimatableShadow::create(style.boxShadow()); case CSSPropertyClip: if (style.hasAutoClip()) return AnimatableUnknown::create(CSSPrimitiveValue::create(CSSValueAuto)); return createFromLengthBox(style.clip(), style); case CSSPropertyColor: return createFromColor(property, style); case CSSPropertyFilter: return AnimatableFilterOperations::create(style.filter()); case CSSPropertyFlexGrow: return createFromDouble(style.flexGrow(), AnimatableDouble::InterpolationIsNonContinuousWithZero); case CSSPropertyFlexShrink: return createFromDouble(style.flexShrink(), AnimatableDouble::InterpolationIsNonContinuousWithZero); case CSSPropertyFlexBasis: return createFromLength(style.flexBasis(), style); case CSSPropertyFontSize: // Must pass a specified size to setFontSize if Text Autosizing is enabled, but a computed size // if text zoom is enabled (if neither is enabled it's irrelevant as they're probably the same). // FIXME: Should we introduce an option to pass the computed font size here, allowing consumers to // enable text zoom rather than Text Autosizing? See http://crbug.com/227545. return createFromDouble(style.specifiedFontSize()); case CSSPropertyFontStretch: return createFromFontStretch(style.fontStretch()); case CSSPropertyFontWeight: return createFromFontWeight(style.fontWeight()); case CSSPropertyHeight: return createFromLength(style.height(), style); case CSSPropertyLeft: return createFromLength(style.left(), style); case CSSPropertyLetterSpacing: return createFromDouble(style.letterSpacing()); case CSSPropertyLineHeight: return createFromLineHeight(style.specifiedLineHeight(), style); case CSSPropertyMarginBottom: return createFromLength(style.marginBottom(), style); case CSSPropertyMarginLeft: return createFromLength(style.marginLeft(), style); case CSSPropertyMarginRight: return createFromLength(style.marginRight(), style); case CSSPropertyMarginTop: return createFromLength(style.marginTop(), style); case CSSPropertyMaxHeight: return createFromLength(style.maxHeight(), style); case CSSPropertyMaxWidth: return createFromLength(style.maxWidth(), style); case CSSPropertyMinHeight: return createFromLength(style.minHeight(), style); case CSSPropertyMinWidth: return createFromLength(style.minWidth(), style); case CSSPropertyObjectPosition: return createFromLengthPoint(style.objectPosition(), style); case CSSPropertyOpacity: return createFromDouble(style.opacity()); case CSSPropertyOutlineColor: return createFromColor(property, style); case CSSPropertyOutlineOffset: return createFromDouble(style.outlineOffset()); case CSSPropertyOutlineWidth: return createFromDouble(style.outlineWidth()); case CSSPropertyPaddingBottom: return createFromLength(style.paddingBottom(), style); case CSSPropertyPaddingLeft: return createFromLength(style.paddingLeft(), style); case CSSPropertyPaddingRight: return createFromLength(style.paddingRight(), style); case CSSPropertyPaddingTop: return createFromLength(style.paddingTop(), style); case CSSPropertyRight: return createFromLength(style.right(), style); case CSSPropertyTextDecorationColor: return AnimatableColor::create(style.textDecorationColor().resolve(style.color())); case CSSPropertyTextIndent: return createFromLength(style.textIndent(), style); case CSSPropertyTextShadow: return AnimatableShadow::create(style.textShadow()); case CSSPropertyTop: return createFromLength(style.top(), style); case CSSPropertyWebkitBorderHorizontalSpacing: return createFromDouble(style.horizontalBorderSpacing()); case CSSPropertyWebkitBorderVerticalSpacing: return createFromDouble(style.verticalBorderSpacing()); case CSSPropertyWebkitClipPath: if (ClipPathOperation* operation = style.clipPath()) return AnimatableClipPathOperation::create(operation); return AnimatableUnknown::create(CSSValueNone); case CSSPropertyPerspective: return createFromDouble(style.perspective()); case CSSPropertyPerspectiveOrigin: return AnimatableLengthPoint::create( createFromLength(style.perspectiveOriginX(), style), createFromLength(style.perspectiveOriginY(), style)); case CSSPropertyWebkitTextStrokeColor: return createFromColor(property, style); case CSSPropertyTransform: return AnimatableTransform::create(style.transform()); case CSSPropertyTransformOrigin: return AnimatableLengthPoint3D::create( createFromLength(style.transformOriginX(), style), createFromLength(style.transformOriginY(), style), createFromDouble(style.transformOriginZ())); case CSSPropertyWidth: return createFromLength(style.width(), style); case CSSPropertyWordSpacing: return createFromDouble(style.wordSpacing()); case CSSPropertyVerticalAlign: if (style.verticalAlign() == LENGTH) return createFromLength(style.verticalAlignLength(), style); return AnimatableUnknown::create(CSSPrimitiveValue::create(style.verticalAlign())); case CSSPropertyZIndex: return createFromDouble(style.zIndex()); default: ASSERT_NOT_REACHED(); // This return value is to avoid a release crash if possible. return AnimatableUnknown::create(nullptr); } }
// FIXME: Generate this function. PassRefPtr<AnimatableValue> CSSAnimatableValueFactory::create(CSSPropertyID property, const RenderStyle& style) { switch (property) { case CSSPropertyBackgroundColor: return createFromColor(property, style); case CSSPropertyBackgroundImage: return createFromFillLayers<CSSPropertyBackgroundImage>(style.backgroundLayers(), style); case CSSPropertyBackgroundPositionX: return createFromFillLayers<CSSPropertyBackgroundPositionX>(style.backgroundLayers(), style); case CSSPropertyBackgroundPositionY: return createFromFillLayers<CSSPropertyBackgroundPositionY>(style.backgroundLayers(), style); case CSSPropertyBackgroundSize: case CSSPropertyWebkitBackgroundSize: return createFromFillLayers<CSSPropertyBackgroundSize>(style.backgroundLayers(), style); case CSSPropertyBaselineShift: return AnimatableSVGLength::create(style.baselineShiftValue()); case CSSPropertyBorderBottomColor: return createFromColor(property, style); case CSSPropertyBorderBottomLeftRadius: return createFromLengthSize(style.borderBottomLeftRadius(), style); case CSSPropertyBorderBottomRightRadius: return createFromLengthSize(style.borderBottomRightRadius(), style); case CSSPropertyBorderBottomWidth: return createFromDouble(style.borderBottomWidth()); case CSSPropertyBorderImageOutset: return createFromBorderImageLengthBox(style.borderImageOutset(), style); case CSSPropertyBorderImageSlice: return createFromLengthBox(style.borderImageSlices(), style); case CSSPropertyBorderImageSource: return createFromStyleImage(style.borderImageSource()); case CSSPropertyBorderImageWidth: return createFromBorderImageLengthBox(style.borderImageWidth(), style); case CSSPropertyBorderLeftColor: return createFromColor(property, style); case CSSPropertyBorderLeftWidth: return createFromDouble(style.borderLeftWidth()); case CSSPropertyBorderRightColor: return createFromColor(property, style); case CSSPropertyBorderRightWidth: return createFromDouble(style.borderRightWidth()); case CSSPropertyBorderTopColor: return createFromColor(property, style); case CSSPropertyBorderTopLeftRadius: return createFromLengthSize(style.borderTopLeftRadius(), style); case CSSPropertyBorderTopRightRadius: return createFromLengthSize(style.borderTopRightRadius(), style); case CSSPropertyBorderTopWidth: return createFromDouble(style.borderTopWidth()); case CSSPropertyBottom: return createFromLength(style.bottom(), style); case CSSPropertyBoxShadow: case CSSPropertyWebkitBoxShadow: return AnimatableShadow::create(style.boxShadow()); case CSSPropertyClip: if (style.hasClip()) return createFromLengthBox(style.clip(), style); return AnimatableUnknown::create(CSSPrimitiveValue::create(CSSValueAuto)); case CSSPropertyColor: return createFromColor(property, style); case CSSPropertyFillOpacity: return createFromDouble(style.fillOpacity()); case CSSPropertyFill: return AnimatableSVGPaint::create(style.svgStyle()->fillPaintType(), style.svgStyle()->fillPaintColor(), style.svgStyle()->fillPaintUri()); case CSSPropertyFlexGrow: return createFromDouble(style.flexGrow(), AnimatableDouble::InterpolationIsNonContinuousWithZero); case CSSPropertyFlexShrink: return createFromDouble(style.flexShrink(), AnimatableDouble::InterpolationIsNonContinuousWithZero); case CSSPropertyFlexBasis: return createFromLength(style.flexBasis(), style); case CSSPropertyFloodColor: return createFromColor(property, style); case CSSPropertyFloodOpacity: return createFromDouble(style.floodOpacity()); case CSSPropertyFontSize: // Must pass a specified size to setFontSize if Text Autosizing is enabled, but a computed size // if text zoom is enabled (if neither is enabled it's irrelevant as they're probably the same). // FIXME: Should we introduce an option to pass the computed font size here, allowing consumers to // enable text zoom rather than Text Autosizing? See http://crbug.com/227545. return createFromDouble(style.specifiedFontSize()); case CSSPropertyHeight: return createFromLength(style.height(), style); case CSSPropertyKerning: return AnimatableSVGLength::create(style.kerning()); case CSSPropertyLightingColor: return createFromColor(property, style); case CSSPropertyListStyleImage: return createFromStyleImage(style.listStyleImage()); case CSSPropertyLeft: return createFromLength(style.left(), style); case CSSPropertyLetterSpacing: return createFromDouble(style.letterSpacing()); case CSSPropertyLineHeight: return createFromLineHeight(style.specifiedLineHeight(), style); case CSSPropertyMarginBottom: return createFromLength(style.marginBottom(), style); case CSSPropertyMarginLeft: return createFromLength(style.marginLeft(), style); case CSSPropertyMarginRight: return createFromLength(style.marginRight(), style); case CSSPropertyMarginTop: return createFromLength(style.marginTop(), style); case CSSPropertyMaxHeight: return createFromLength(style.maxHeight(), style); case CSSPropertyMaxWidth: return createFromLength(style.maxWidth(), style); case CSSPropertyMinHeight: return createFromLength(style.minHeight(), style); case CSSPropertyMinWidth: return createFromLength(style.minWidth(), style); case CSSPropertyObjectPosition: return createFromLengthPoint(style.objectPosition(), style); case CSSPropertyOpacity: return createFromDouble(style.opacity()); case CSSPropertyOrphans: return createFromDouble(style.orphans()); case CSSPropertyOutlineColor: return createFromColor(property, style); case CSSPropertyOutlineOffset: return createFromDouble(style.outlineOffset()); case CSSPropertyOutlineWidth: return createFromDouble(style.outlineWidth()); case CSSPropertyPaddingBottom: return createFromLength(style.paddingBottom(), style); case CSSPropertyPaddingLeft: return createFromLength(style.paddingLeft(), style); case CSSPropertyPaddingRight: return createFromLength(style.paddingRight(), style); case CSSPropertyPaddingTop: return createFromLength(style.paddingTop(), style); case CSSPropertyRight: return createFromLength(style.right(), style); case CSSPropertyStrokeWidth: return AnimatableSVGLength::create(style.strokeWidth()); case CSSPropertyStopColor: return createFromColor(property, style); case CSSPropertyStopOpacity: return createFromDouble(style.stopOpacity()); case CSSPropertyStrokeDasharray: return AnimatableStrokeDasharrayList::create(style.strokeDashArray()); case CSSPropertyStrokeDashoffset: return AnimatableSVGLength::create(style.strokeDashOffset()); case CSSPropertyStrokeMiterlimit: return createFromDouble(style.strokeMiterLimit()); case CSSPropertyStrokeOpacity: return createFromDouble(style.strokeOpacity()); case CSSPropertyStroke: return AnimatableSVGPaint::create(style.svgStyle()->strokePaintType(), style.svgStyle()->strokePaintColor(), style.svgStyle()->strokePaintUri()); case CSSPropertyTextDecorationColor: return createFromColor(property, style); case CSSPropertyTextIndent: return createFromLength(style.textIndent(), style); case CSSPropertyTextShadow: return AnimatableShadow::create(style.textShadow()); case CSSPropertyTop: return createFromLength(style.top(), style); case CSSPropertyWebkitBorderHorizontalSpacing: return createFromDouble(style.horizontalBorderSpacing()); case CSSPropertyWebkitBorderVerticalSpacing: return createFromDouble(style.verticalBorderSpacing()); case CSSPropertyWebkitClipPath: return AnimatableClipPathOperation::create(style.clipPath()); case CSSPropertyWebkitColumnCount: return createFromDouble(style.columnCount()); case CSSPropertyWebkitColumnGap: return createFromDouble(style.columnGap()); case CSSPropertyWebkitColumnRuleColor: return createFromColor(property, style); case CSSPropertyWebkitColumnRuleWidth: return createFromDouble(style.columnRuleWidth()); case CSSPropertyWebkitColumnWidth: return createFromDouble(style.columnWidth()); case CSSPropertyWebkitFilter: return AnimatableFilterOperations::create(style.filter()); case CSSPropertyWebkitMaskBoxImageOutset: return createFromBorderImageLengthBox(style.maskBoxImageOutset(), style); case CSSPropertyWebkitMaskBoxImageSlice: return createFromLengthBoxAndBool(style.maskBoxImageSlices(), style.maskBoxImageSlicesFill(), style); case CSSPropertyWebkitMaskBoxImageSource: return createFromStyleImage(style.maskBoxImageSource()); case CSSPropertyWebkitMaskBoxImageWidth: return createFromBorderImageLengthBox(style.maskBoxImageWidth(), style); case CSSPropertyWebkitMaskImage: return createFromFillLayers<CSSPropertyWebkitMaskImage>(style.maskLayers(), style); case CSSPropertyWebkitMaskPositionX: return createFromFillLayers<CSSPropertyWebkitMaskPositionX>(style.maskLayers(), style); case CSSPropertyWebkitMaskPositionY: return createFromFillLayers<CSSPropertyWebkitMaskPositionY>(style.maskLayers(), style); case CSSPropertyWebkitMaskSize: return createFromFillLayers<CSSPropertyWebkitMaskSize>(style.maskLayers(), style); case CSSPropertyWebkitPerspective: return createFromDouble(style.perspective()); case CSSPropertyWebkitPerspectiveOriginX: return createFromLength(style.perspectiveOriginX(), style); case CSSPropertyWebkitPerspectiveOriginY: return createFromLength(style.perspectiveOriginY(), style); case CSSPropertyShapeInside: return AnimatableShapeValue::create(style.shapeInside()); case CSSPropertyShapeOutside: return AnimatableShapeValue::create(style.shapeOutside()); case CSSPropertyShapeMargin: return createFromLength(style.shapeMargin(), style); case CSSPropertyWebkitTextStrokeColor: return createFromColor(property, style); case CSSPropertyWebkitTransform: return AnimatableTransform::create(style.transform()); case CSSPropertyWebkitTransformOriginX: return createFromLength(style.transformOriginX(), style); case CSSPropertyWebkitTransformOriginY: return createFromLength(style.transformOriginY(), style); case CSSPropertyWebkitTransformOriginZ: return createFromDouble(style.transformOriginZ()); case CSSPropertyWidows: return createFromDouble(style.widows()); case CSSPropertyWidth: return createFromLength(style.width(), style); case CSSPropertyWordSpacing: return createFromDouble(style.wordSpacing()); case CSSPropertyVisibility: return AnimatableVisibility::create(style.visibility()); case CSSPropertyZIndex: return createFromDouble(style.zIndex()); case CSSPropertyZoom: return createFromDouble(style.zoom()); default: ASSERT_WITH_MESSAGE(!CSSAnimations::isAnimatableProperty(property), "Web Animations not yet implemented: Create AnimatableValue from render style: %s", getPropertyNameString(property).utf8().data()); ASSERT_NOT_REACHED(); // This return value is to avoid a release crash if possible. return AnimatableUnknown::create(0); } }
CSSValueImpl *CSSComputedStyleDeclarationImpl::getPropertyCSSValue(int propertyID, EUpdateLayout updateLayout) const { NodeImpl *node = m_node.handle(); if (!node) return 0; // Make sure our layout is up to date before we allow a query on these attributes. DocumentImpl* docimpl = node->getDocument(); if (docimpl && updateLayout) docimpl->updateLayout(); RenderObject *renderer = node->renderer(); if (!renderer) return 0; RenderStyle *style = renderer->style(); if (!style) return 0; switch (propertyID) { case CSS_PROP_BACKGROUND_COLOR: return new CSSPrimitiveValueImpl(style->backgroundColor().rgb()); case CSS_PROP_BACKGROUND_IMAGE: if (style->backgroundImage()) return new CSSPrimitiveValueImpl(style->backgroundImage()->url(), CSSPrimitiveValue::CSS_URI); return new CSSPrimitiveValueImpl(CSS_VAL_NONE); case CSS_PROP_BACKGROUND_REPEAT: switch (style->backgroundRepeat()) { case khtml::REPEAT: return new CSSPrimitiveValueImpl(CSS_VAL_REPEAT); case khtml::REPEAT_X: return new CSSPrimitiveValueImpl(CSS_VAL_REPEAT_X); case khtml::REPEAT_Y: return new CSSPrimitiveValueImpl(CSS_VAL_REPEAT_Y); case khtml::NO_REPEAT: return new CSSPrimitiveValueImpl(CSS_VAL_NO_REPEAT); } ASSERT_NOT_REACHED(); return 0; case CSS_PROP_BACKGROUND_ATTACHMENT: if (style->backgroundAttachment()) return new CSSPrimitiveValueImpl(CSS_VAL_SCROLL); else return new CSSPrimitiveValueImpl(CSS_VAL_FIXED); case CSS_PROP_BACKGROUND_POSITION: { DOMString string; Length length(style->backgroundXPosition()); if (length.isPercent()) string = numberAsString(length.length()) + "%"; else string = numberAsString(length.minWidth(renderer->contentWidth())); string += " "; length = style->backgroundYPosition(); if (length.isPercent()) string += numberAsString(length.length()) + "%"; else string += numberAsString(length.minWidth(renderer->contentWidth())); return new CSSPrimitiveValueImpl(string, CSSPrimitiveValue::CSS_STRING); } case CSS_PROP_BACKGROUND_POSITION_X: return valueForLength(style->backgroundXPosition()); case CSS_PROP_BACKGROUND_POSITION_Y: return valueForLength(style->backgroundYPosition()); #ifndef KHTML_NO_XBL case CSS_PROP__KHTML_BINDING: // FIXME: unimplemented break; #endif case CSS_PROP_BORDER_COLLAPSE: if (style->borderCollapse()) return new CSSPrimitiveValueImpl(CSS_VAL_COLLAPSE); else return new CSSPrimitiveValueImpl(CSS_VAL_SEPARATE); case CSS_PROP_BORDER_SPACING: { QString string(numberAsString(style->horizontalBorderSpacing()) + "px " + numberAsString(style->verticalBorderSpacing()) + "px"); return new CSSPrimitiveValueImpl(string, CSSPrimitiveValue::CSS_STRING); } case CSS_PROP__KHTML_BORDER_HORIZONTAL_SPACING: return new CSSPrimitiveValueImpl(style->horizontalBorderSpacing(), CSSPrimitiveValue::CSS_PX); case CSS_PROP__KHTML_BORDER_VERTICAL_SPACING: return new CSSPrimitiveValueImpl(style->verticalBorderSpacing(), CSSPrimitiveValue::CSS_PX); case CSS_PROP_BORDER_TOP_COLOR: return new CSSPrimitiveValueImpl(style->borderLeftColor().rgb()); case CSS_PROP_BORDER_RIGHT_COLOR: return new CSSPrimitiveValueImpl(style->borderRightColor().rgb()); case CSS_PROP_BORDER_BOTTOM_COLOR: return new CSSPrimitiveValueImpl(style->borderBottomColor().rgb()); case CSS_PROP_BORDER_LEFT_COLOR: return new CSSPrimitiveValueImpl(style->borderLeftColor().rgb()); case CSS_PROP_BORDER_TOP_STYLE: return valueForBorderStyle(style->borderTopStyle()); case CSS_PROP_BORDER_RIGHT_STYLE: return valueForBorderStyle(style->borderRightStyle()); case CSS_PROP_BORDER_BOTTOM_STYLE: return valueForBorderStyle(style->borderBottomStyle()); case CSS_PROP_BORDER_LEFT_STYLE: return valueForBorderStyle(style->borderLeftStyle()); case CSS_PROP_BORDER_TOP_WIDTH: return new CSSPrimitiveValueImpl(style->borderTopWidth(), CSSPrimitiveValue::CSS_PX); case CSS_PROP_BORDER_RIGHT_WIDTH: return new CSSPrimitiveValueImpl(style->borderRightWidth(), CSSPrimitiveValue::CSS_PX); case CSS_PROP_BORDER_BOTTOM_WIDTH: return new CSSPrimitiveValueImpl(style->borderBottomWidth(), CSSPrimitiveValue::CSS_PX); case CSS_PROP_BORDER_LEFT_WIDTH: return new CSSPrimitiveValueImpl(style->borderLeftWidth(), CSSPrimitiveValue::CSS_PX); case CSS_PROP_BOTTOM: return getPositionOffsetValue(renderer, CSS_PROP_BOTTOM); case CSS_PROP__KHTML_BOX_ALIGN: switch (style->boxAlign()) { case khtml::BSTRETCH: return new CSSPrimitiveValueImpl(CSS_VAL_STRETCH); case khtml::BSTART: return new CSSPrimitiveValueImpl(CSS_VAL_START); case khtml::BCENTER: return new CSSPrimitiveValueImpl(CSS_VAL_CENTER); case khtml::BEND: return new CSSPrimitiveValueImpl(CSS_VAL_END); case khtml::BBASELINE: return new CSSPrimitiveValueImpl(CSS_VAL_BASELINE); case khtml::BJUSTIFY: break; // not allowed } ASSERT_NOT_REACHED(); return 0; case CSS_PROP__KHTML_BOX_DIRECTION: switch (style->boxDirection()) { case khtml::BNORMAL: return new CSSPrimitiveValueImpl(CSS_VAL_NORMAL); case khtml::BREVERSE: return new CSSPrimitiveValueImpl(CSS_VAL_REVERSE); } ASSERT_NOT_REACHED(); return 0; case CSS_PROP__KHTML_BOX_FLEX: return new CSSPrimitiveValueImpl(style->boxFlex(), CSSPrimitiveValue::CSS_NUMBER); case CSS_PROP__KHTML_BOX_FLEX_GROUP: return new CSSPrimitiveValueImpl(style->boxFlexGroup(), CSSPrimitiveValue::CSS_NUMBER); case CSS_PROP__KHTML_BOX_LINES: switch (style->boxLines()) { case khtml::SINGLE: return new CSSPrimitiveValueImpl(CSS_VAL_SINGLE); case khtml::MULTIPLE: return new CSSPrimitiveValueImpl(CSS_VAL_MULTIPLE); } ASSERT_NOT_REACHED(); return 0; case CSS_PROP__KHTML_BOX_ORDINAL_GROUP: return new CSSPrimitiveValueImpl(style->boxOrdinalGroup(), CSSPrimitiveValue::CSS_NUMBER); case CSS_PROP__KHTML_BOX_ORIENT: switch (style->boxOrient()) { case khtml::HORIZONTAL: return new CSSPrimitiveValueImpl(CSS_VAL_HORIZONTAL); case khtml::VERTICAL: return new CSSPrimitiveValueImpl(CSS_VAL_VERTICAL); } ASSERT_NOT_REACHED(); return 0; case CSS_PROP__KHTML_BOX_PACK: switch (style->boxPack()) { case khtml::BSTART: return new CSSPrimitiveValueImpl(CSS_VAL_START); case khtml::BEND: return new CSSPrimitiveValueImpl(CSS_VAL_END); case khtml::BCENTER: return new CSSPrimitiveValueImpl(CSS_VAL_CENTER); case khtml::BJUSTIFY: return new CSSPrimitiveValueImpl(CSS_VAL_JUSTIFY); case khtml::BSTRETCH: case khtml::BBASELINE: break; // not allowed } ASSERT_NOT_REACHED(); return 0; case CSS_PROP_CAPTION_SIDE: switch (style->captionSide()) { case khtml::CAPLEFT: return new CSSPrimitiveValueImpl(CSS_VAL_LEFT); case khtml::CAPRIGHT: return new CSSPrimitiveValueImpl(CSS_VAL_RIGHT); case khtml::CAPTOP: return new CSSPrimitiveValueImpl(CSS_VAL_TOP); case khtml::CAPBOTTOM: return new CSSPrimitiveValueImpl(CSS_VAL_BOTTOM); } ASSERT_NOT_REACHED(); return 0; case CSS_PROP_CLEAR: switch (style->clear()) { case khtml::CNONE: return new CSSPrimitiveValueImpl(CSS_VAL_NONE); case khtml::CLEFT: return new CSSPrimitiveValueImpl(CSS_VAL_LEFT); case khtml::CRIGHT: return new CSSPrimitiveValueImpl(CSS_VAL_RIGHT); case khtml::CBOTH: return new CSSPrimitiveValueImpl(CSS_VAL_BOTH); } ASSERT_NOT_REACHED(); return 0; case CSS_PROP_CLIP: // FIXME: unimplemented break; case CSS_PROP_COLOR: return new CSSPrimitiveValueImpl(style->color().rgb()); case CSS_PROP_CONTENT: // FIXME: unimplemented break; case CSS_PROP_COUNTER_INCREMENT: // FIXME: unimplemented break; case CSS_PROP_COUNTER_RESET: // FIXME: unimplemented break; case CSS_PROP_CURSOR: switch (style->cursor()) { case khtml::CURSOR_AUTO: return new CSSPrimitiveValueImpl(CSS_VAL_AUTO); case khtml::CURSOR_CROSS: return new CSSPrimitiveValueImpl(CSS_VAL_CROSSHAIR); case khtml::CURSOR_DEFAULT: return new CSSPrimitiveValueImpl(CSS_VAL_DEFAULT); case khtml::CURSOR_POINTER: return new CSSPrimitiveValueImpl(CSS_VAL_POINTER); case khtml::CURSOR_MOVE: return new CSSPrimitiveValueImpl(CSS_VAL_MOVE); case khtml::CURSOR_E_RESIZE: return new CSSPrimitiveValueImpl(CSS_VAL_E_RESIZE); case khtml::CURSOR_NE_RESIZE: return new CSSPrimitiveValueImpl(CSS_VAL_NE_RESIZE); case khtml::CURSOR_NW_RESIZE: return new CSSPrimitiveValueImpl(CSS_VAL_NW_RESIZE); case khtml::CURSOR_N_RESIZE: return new CSSPrimitiveValueImpl(CSS_VAL_N_RESIZE); case khtml::CURSOR_SE_RESIZE: return new CSSPrimitiveValueImpl(CSS_VAL_SE_RESIZE); case khtml::CURSOR_SW_RESIZE: return new CSSPrimitiveValueImpl(CSS_VAL_SW_RESIZE); case khtml::CURSOR_S_RESIZE: return new CSSPrimitiveValueImpl(CSS_VAL_S_RESIZE); case khtml::CURSOR_W_RESIZE: return new CSSPrimitiveValueImpl(CSS_VAL_W_RESIZE); case khtml::CURSOR_TEXT: return new CSSPrimitiveValueImpl(CSS_VAL_TEXT); case khtml::CURSOR_WAIT: return new CSSPrimitiveValueImpl(CSS_VAL_WAIT); case khtml::CURSOR_HELP: return new CSSPrimitiveValueImpl(CSS_VAL_HELP); } ASSERT_NOT_REACHED(); return 0; case CSS_PROP_DIRECTION: switch (style->direction()) { case khtml::LTR: return new CSSPrimitiveValueImpl(CSS_VAL_LTR); case khtml::RTL: return new CSSPrimitiveValueImpl(CSS_VAL_RTL); } ASSERT_NOT_REACHED(); return 0; case CSS_PROP_DISPLAY: switch (style->display()) { case khtml::INLINE: return new CSSPrimitiveValueImpl(CSS_VAL_INLINE); case khtml::BLOCK: return new CSSPrimitiveValueImpl(CSS_VAL_BLOCK); case khtml::LIST_ITEM: return new CSSPrimitiveValueImpl(CSS_VAL_LIST_ITEM); case khtml::RUN_IN: return new CSSPrimitiveValueImpl(CSS_VAL_RUN_IN); case khtml::COMPACT: return new CSSPrimitiveValueImpl(CSS_VAL_COMPACT); case khtml::INLINE_BLOCK: return new CSSPrimitiveValueImpl(CSS_VAL_INLINE_BLOCK); case khtml::TABLE: return new CSSPrimitiveValueImpl(CSS_VAL_TABLE); case khtml::INLINE_TABLE: return new CSSPrimitiveValueImpl(CSS_VAL_INLINE_TABLE); case khtml::TABLE_ROW_GROUP: return new CSSPrimitiveValueImpl(CSS_VAL_TABLE_ROW_GROUP); case khtml::TABLE_HEADER_GROUP: return new CSSPrimitiveValueImpl(CSS_VAL_TABLE_HEADER_GROUP); case khtml::TABLE_FOOTER_GROUP: return new CSSPrimitiveValueImpl(CSS_VAL_TABLE_FOOTER_GROUP); case khtml::TABLE_ROW: return new CSSPrimitiveValueImpl(CSS_VAL_TABLE_ROW); case khtml::TABLE_COLUMN_GROUP: return new CSSPrimitiveValueImpl(CSS_VAL_TABLE_COLUMN_GROUP); case khtml::TABLE_COLUMN: return new CSSPrimitiveValueImpl(CSS_VAL_TABLE_COLUMN); case khtml::TABLE_CELL: return new CSSPrimitiveValueImpl(CSS_VAL_TABLE_CELL); case khtml::TABLE_CAPTION: return new CSSPrimitiveValueImpl(CSS_VAL_TABLE_CAPTION); case khtml::BOX: return new CSSPrimitiveValueImpl(CSS_VAL__KHTML_BOX); case khtml::INLINE_BOX: return new CSSPrimitiveValueImpl(CSS_VAL__KHTML_INLINE_BOX); case khtml::NONE: return new CSSPrimitiveValueImpl(CSS_VAL_NONE); } ASSERT_NOT_REACHED(); return 0; case CSS_PROP_EMPTY_CELLS: switch (style->emptyCells()) { case khtml::SHOW: return new CSSPrimitiveValueImpl(CSS_VAL_SHOW); case khtml::HIDE: return new CSSPrimitiveValueImpl(CSS_VAL_HIDE); } ASSERT_NOT_REACHED(); return 0; case CSS_PROP_FLOAT: switch (style->floating()) { case khtml::FNONE: return new CSSPrimitiveValueImpl(CSS_VAL_NONE); case khtml::FLEFT: return new CSSPrimitiveValueImpl(CSS_VAL_LEFT); case khtml::FRIGHT: return new CSSPrimitiveValueImpl(CSS_VAL_RIGHT); } ASSERT_NOT_REACHED(); return 0; case CSS_PROP_FONT_FAMILY: { FontDef def = style->htmlFont().getFontDef(); return new CSSPrimitiveValueImpl(def.firstFamily().family().domString(), CSSPrimitiveValue::CSS_STRING); } case CSS_PROP_FONT_SIZE: { FontDef def = style->htmlFont().getFontDef(); return new CSSPrimitiveValueImpl(def.specifiedSize, CSSPrimitiveValue::CSS_PX); } case CSS_PROP_FONT_STRETCH: // FIXME: unimplemented break; case CSS_PROP_FONT_STYLE: { // FIXME: handle oblique? FontDef def = style->htmlFont().getFontDef(); if (def.italic) return new CSSPrimitiveValueImpl(CSS_VAL_ITALIC); else return new CSSPrimitiveValueImpl(CSS_VAL_NORMAL); } case CSS_PROP_FONT_VARIANT: { FontDef def = style->htmlFont().getFontDef(); if (def.smallCaps) return new CSSPrimitiveValueImpl(CSS_VAL_SMALL_CAPS); else return new CSSPrimitiveValueImpl(CSS_VAL_NORMAL); } case CSS_PROP_FONT_WEIGHT: { // FIXME: this does not reflect the full range of weights // that can be expressed with CSS FontDef def = style->htmlFont().getFontDef(); if (def.weight == QFont::Bold) return new CSSPrimitiveValueImpl(CSS_VAL_BOLD); else return new CSSPrimitiveValueImpl(CSS_VAL_NORMAL); } case CSS_PROP_HEIGHT: return new CSSPrimitiveValueImpl(renderer->contentHeight(), CSSPrimitiveValue::CSS_PX); case CSS_PROP_LEFT: return getPositionOffsetValue(renderer, CSS_PROP_LEFT); case CSS_PROP_LETTER_SPACING: if (style->letterSpacing() == 0) return new CSSPrimitiveValueImpl(CSS_VAL_NORMAL); return new CSSPrimitiveValueImpl(style->letterSpacing(), CSSPrimitiveValue::CSS_PX); case CSS_PROP__APPLE_LINE_CLAMP: return new CSSPrimitiveValueImpl(style->lineClamp(), CSSPrimitiveValue::CSS_PERCENTAGE); case CSS_PROP_LINE_HEIGHT: { Length length(style->lineHeight()); if (length.value < 0) return new CSSPrimitiveValueImpl(CSS_VAL_NORMAL); if (length.isPercent()) { // This is imperfect, because it doesn't include the zoom factor and the real computation // 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. float fontSize = style->htmlFont().getFontDef().specifiedSize; return new CSSPrimitiveValueImpl((int)(length.length() * fontSize) / 100, CSSPrimitiveValue::CSS_PX); } else { return new CSSPrimitiveValueImpl(length.length(), CSSPrimitiveValue::CSS_PX); } } case CSS_PROP_LIST_STYLE_IMAGE: if (style->listStyleImage()) return new CSSPrimitiveValueImpl(style->listStyleImage()->url(), CSSPrimitiveValue::CSS_URI); return new CSSPrimitiveValueImpl(CSS_VAL_NONE); case CSS_PROP_LIST_STYLE_POSITION: switch (style->listStylePosition()) { case khtml::OUTSIDE: return new CSSPrimitiveValueImpl(CSS_VAL_OUTSIDE); case khtml::INSIDE: return new CSSPrimitiveValueImpl(CSS_VAL_INSIDE); } ASSERT_NOT_REACHED(); return 0; case CSS_PROP_LIST_STYLE_TYPE: switch (style->listStyleType()) { case khtml::LNONE: return new CSSPrimitiveValueImpl(CSS_VAL_NONE); case khtml::DISC: return new CSSPrimitiveValueImpl(CSS_VAL_DISC); case khtml::CIRCLE: return new CSSPrimitiveValueImpl(CSS_VAL_CIRCLE); case khtml::SQUARE: return new CSSPrimitiveValueImpl(CSS_VAL_SQUARE); case khtml::LDECIMAL: return new CSSPrimitiveValueImpl(CSS_VAL_DECIMAL); case khtml::DECIMAL_LEADING_ZERO: return new CSSPrimitiveValueImpl(CSS_VAL_DECIMAL_LEADING_ZERO); case khtml::LOWER_ROMAN: return new CSSPrimitiveValueImpl(CSS_VAL_LOWER_ROMAN); case khtml::UPPER_ROMAN: return new CSSPrimitiveValueImpl(CSS_VAL_UPPER_ROMAN); case khtml::LOWER_GREEK: return new CSSPrimitiveValueImpl(CSS_VAL_LOWER_GREEK); case khtml::LOWER_ALPHA: return new CSSPrimitiveValueImpl(CSS_VAL_LOWER_ALPHA); case khtml::LOWER_LATIN: return new CSSPrimitiveValueImpl(CSS_VAL_LOWER_LATIN); case khtml::UPPER_ALPHA: return new CSSPrimitiveValueImpl(CSS_VAL_UPPER_ALPHA); case khtml::UPPER_LATIN: return new CSSPrimitiveValueImpl(CSS_VAL_UPPER_LATIN); case khtml::HEBREW: return new CSSPrimitiveValueImpl(CSS_VAL_HEBREW); case khtml::ARMENIAN: return new CSSPrimitiveValueImpl(CSS_VAL_ARMENIAN); case khtml::GEORGIAN: return new CSSPrimitiveValueImpl(CSS_VAL_GEORGIAN); case khtml::CJK_IDEOGRAPHIC: return new CSSPrimitiveValueImpl(CSS_VAL_CJK_IDEOGRAPHIC); case khtml::HIRAGANA: return new CSSPrimitiveValueImpl(CSS_VAL_HIRAGANA); case khtml::KATAKANA: return new CSSPrimitiveValueImpl(CSS_VAL_KATAKANA); case khtml::HIRAGANA_IROHA: return new CSSPrimitiveValueImpl(CSS_VAL_HIRAGANA_IROHA); case khtml::KATAKANA_IROHA: return new CSSPrimitiveValueImpl(CSS_VAL_KATAKANA_IROHA); } ASSERT_NOT_REACHED(); return 0; case CSS_PROP_MARGIN_TOP: return valueForLength(style->marginTop()); case CSS_PROP_MARGIN_RIGHT: return valueForLength(style->marginRight()); case CSS_PROP_MARGIN_BOTTOM: return valueForLength(style->marginBottom()); case CSS_PROP_MARGIN_LEFT: return valueForLength(style->marginLeft()); case CSS_PROP__KHTML_MARQUEE: // FIXME: unimplemented break; case CSS_PROP__KHTML_MARQUEE_DIRECTION: switch (style->marqueeDirection()) { case khtml::MFORWARD: return new CSSPrimitiveValueImpl(CSS_VAL_FORWARDS); case khtml::MBACKWARD: return new CSSPrimitiveValueImpl(CSS_VAL_BACKWARDS); case khtml::MAUTO: return new CSSPrimitiveValueImpl(CSS_VAL_AUTO); case khtml::MUP: return new CSSPrimitiveValueImpl(CSS_VAL_UP); case khtml::MDOWN: return new CSSPrimitiveValueImpl(CSS_VAL_DOWN); case khtml::MLEFT: return new CSSPrimitiveValueImpl(CSS_VAL_LEFT); case khtml::MRIGHT: return new CSSPrimitiveValueImpl(CSS_VAL_RIGHT); } ASSERT_NOT_REACHED(); return 0; case CSS_PROP__KHTML_MARQUEE_INCREMENT: return valueForLength(style->marqueeIncrement()); case CSS_PROP__KHTML_MARQUEE_REPETITION: if (style->marqueeLoopCount() < 0) return new CSSPrimitiveValueImpl(CSS_VAL_INFINITE); return new CSSPrimitiveValueImpl(style->marqueeLoopCount(), CSSPrimitiveValue::CSS_NUMBER); case CSS_PROP__KHTML_MARQUEE_SPEED: // FIXME: unimplemented break; case CSS_PROP__KHTML_MARQUEE_STYLE: switch (style->marqueeBehavior()) { case khtml::MNONE: return new CSSPrimitiveValueImpl(CSS_VAL_NONE); case khtml::MSCROLL: return new CSSPrimitiveValueImpl(CSS_VAL_SCROLL); case khtml::MSLIDE: return new CSSPrimitiveValueImpl(CSS_VAL_SLIDE); case khtml::MALTERNATE: return new CSSPrimitiveValueImpl(CSS_VAL_ALTERNATE); case khtml::MUNFURL: return new CSSPrimitiveValueImpl(CSS_VAL_UNFURL); } ASSERT_NOT_REACHED(); return 0; case CSS_PROP__KHTML_USER_MODIFY: switch (style->userModify()) { case khtml::READ_ONLY: return new CSSPrimitiveValueImpl(CSS_VAL_READ_ONLY); case khtml::READ_WRITE: return new CSSPrimitiveValueImpl(CSS_VAL_READ_WRITE); } ASSERT_NOT_REACHED(); return 0; case CSS_PROP_MAX_HEIGHT: return valueForLength(style->maxHeight()); case CSS_PROP_MAX_WIDTH: return valueForLength(style->maxWidth()); case CSS_PROP_MIN_HEIGHT: return valueForLength(style->minHeight()); case CSS_PROP_MIN_WIDTH: return valueForLength(style->minWidth()); case CSS_PROP_OPACITY: return new CSSPrimitiveValueImpl(style->opacity(), CSSPrimitiveValue::CSS_NUMBER); case CSS_PROP_ORPHANS: return new CSSPrimitiveValueImpl(style->orphans(), CSSPrimitiveValue::CSS_NUMBER); case CSS_PROP_OUTLINE_COLOR: // FIXME: unimplemented break; case CSS_PROP_OUTLINE_OFFSET: // FIXME: unimplemented break; case CSS_PROP_OUTLINE_STYLE: if (style->outlineStyleIsAuto()) return new CSSPrimitiveValueImpl(CSS_VAL_AUTO); return valueForBorderStyle(style->outlineStyle()); case CSS_PROP_OUTLINE_WIDTH: // FIXME: unimplemented break; case CSS_PROP_OVERFLOW: switch (style->overflow()) { case khtml::OVISIBLE: return new CSSPrimitiveValueImpl(CSS_VAL_VISIBLE); case khtml::OHIDDEN: return new CSSPrimitiveValueImpl(CSS_VAL_HIDDEN); case khtml::OSCROLL: return new CSSPrimitiveValueImpl(CSS_VAL_SCROLL); case khtml::OAUTO: return new CSSPrimitiveValueImpl(CSS_VAL_AUTO); case khtml::OMARQUEE: return new CSSPrimitiveValueImpl(CSS_VAL_MARQUEE); case khtml::OOVERLAY: return new CSSPrimitiveValueImpl(CSS_VAL_OVERLAY); } ASSERT_NOT_REACHED(); return 0; case CSS_PROP_PADDING_TOP: return valueForLength(style->paddingTop()); case CSS_PROP_PADDING_RIGHT: return valueForLength(style->paddingRight()); case CSS_PROP_PADDING_BOTTOM: return valueForLength(style->paddingBottom()); case CSS_PROP_PADDING_LEFT: return valueForLength(style->paddingLeft()); case CSS_PROP_PAGE: // FIXME: unimplemented break; case CSS_PROP_PAGE_BREAK_AFTER: switch (style->pageBreakAfter()) { case khtml::PBAUTO: return new CSSPrimitiveValueImpl(CSS_VAL_AUTO); case khtml::PBALWAYS: return new CSSPrimitiveValueImpl(CSS_VAL_ALWAYS); case khtml::PBAVOID: return new CSSPrimitiveValueImpl(CSS_VAL_AVOID); } ASSERT_NOT_REACHED(); return 0; case CSS_PROP_PAGE_BREAK_BEFORE: switch (style->pageBreakBefore()) { case khtml::PBAUTO: return new CSSPrimitiveValueImpl(CSS_VAL_AUTO); case khtml::PBALWAYS: return new CSSPrimitiveValueImpl(CSS_VAL_ALWAYS); case khtml::PBAVOID: return new CSSPrimitiveValueImpl(CSS_VAL_AVOID); } ASSERT_NOT_REACHED(); return 0; case CSS_PROP_PAGE_BREAK_INSIDE: switch (style->pageBreakInside()) { case khtml::PBAUTO: return new CSSPrimitiveValueImpl(CSS_VAL_AUTO); case khtml::PBAVOID: return new CSSPrimitiveValueImpl(CSS_VAL_AVOID); case khtml::PBALWAYS: break; // not allowed } ASSERT_NOT_REACHED(); return 0; case CSS_PROP_POSITION: switch (style->position()) { case khtml::STATIC: return new CSSPrimitiveValueImpl(CSS_VAL_STATIC); case khtml::RELATIVE: return new CSSPrimitiveValueImpl(CSS_VAL_RELATIVE); case khtml::ABSOLUTE: return new CSSPrimitiveValueImpl(CSS_VAL_ABSOLUTE); case khtml::FIXED: return new CSSPrimitiveValueImpl(CSS_VAL_FIXED); } ASSERT_NOT_REACHED(); return 0; case CSS_PROP_QUOTES: // FIXME: unimplemented break; case CSS_PROP_RIGHT: return getPositionOffsetValue(renderer, CSS_PROP_RIGHT); case CSS_PROP_SIZE: // FIXME: unimplemented break; case CSS_PROP_TABLE_LAYOUT: switch (style->tableLayout()) { case khtml::TAUTO: return new CSSPrimitiveValueImpl(CSS_VAL_AUTO); case khtml::TFIXED: return new CSSPrimitiveValueImpl(CSS_VAL_FIXED); } ASSERT_NOT_REACHED(); return 0; case CSS_PROP_TEXT_ALIGN: return valueForTextAlign(style->textAlign()); case CSS_PROP_TEXT_DECORATION: { QString string; if (style->textDecoration() & khtml::UNDERLINE) string += "underline"; if (style->textDecoration() & khtml::OVERLINE) { if (string.length() > 0) string += " "; string += "overline"; } if (style->textDecoration() & khtml::LINE_THROUGH) { if (string.length() > 0) string += " "; string += "line-through"; } if (style->textDecoration() & khtml::BLINK) { if (string.length() > 0) string += " "; string += "blink"; } if (string.length() == 0) return new CSSPrimitiveValueImpl(CSS_VAL_NONE); return new CSSPrimitiveValueImpl(string, CSSPrimitiveValue::CSS_STRING); } case CSS_PROP__KHTML_TEXT_DECORATIONS_IN_EFFECT: { QString string; if (style->textDecorationsInEffect() & khtml::UNDERLINE) string += "underline"; if (style->textDecorationsInEffect() & khtml::OVERLINE) { if (string.length() > 0) string += " "; string += "overline"; } if (style->textDecorationsInEffect() & khtml::LINE_THROUGH) { if (string.length() > 0) string += " "; string += "line-through"; } if (style->textDecorationsInEffect() & khtml::BLINK) { if (string.length() > 0) string += " "; string += "blink"; } if (string.length() == 0) return new CSSPrimitiveValueImpl(CSS_VAL_NONE); return new CSSPrimitiveValueImpl(string, CSSPrimitiveValue::CSS_STRING); } case CSS_PROP_TEXT_INDENT: return valueForLength(style->textIndent()); case CSS_PROP_TEXT_SHADOW: return valueForShadow(style->textShadow()); case CSS_PROP__APPLE_TEXT_SIZE_ADJUST: if (style->textSizeAdjust()) return new CSSPrimitiveValueImpl(CSS_VAL_AUTO); else return new CSSPrimitiveValueImpl(CSS_VAL_NONE); case CSS_PROP_TEXT_TRANSFORM: switch (style->textTransform()) { case khtml::CAPITALIZE: return new CSSPrimitiveValueImpl(CSS_VAL_CAPITALIZE); case khtml::UPPERCASE: return new CSSPrimitiveValueImpl(CSS_VAL_UPPERCASE); case khtml::LOWERCASE: return new CSSPrimitiveValueImpl(CSS_VAL_LOWERCASE); case khtml::TTNONE: return new CSSPrimitiveValueImpl(CSS_VAL_NONE); } ASSERT_NOT_REACHED(); return 0; case CSS_PROP_TOP: return getPositionOffsetValue(renderer, CSS_PROP_TOP); case CSS_PROP_UNICODE_BIDI: switch (style->unicodeBidi()) { case khtml::UBNormal: return new CSSPrimitiveValueImpl(CSS_VAL_NORMAL); case khtml::Embed: return new CSSPrimitiveValueImpl(CSS_VAL_EMBED); case khtml::Override: return new CSSPrimitiveValueImpl(CSS_VAL_BIDI_OVERRIDE); } ASSERT_NOT_REACHED(); return 0; case CSS_PROP_VERTICAL_ALIGN: switch (style->verticalAlign()) { case khtml::BASELINE: return new CSSPrimitiveValueImpl(CSS_VAL_BASELINE); case khtml::MIDDLE: return new CSSPrimitiveValueImpl(CSS_VAL_MIDDLE); case khtml::SUB: return new CSSPrimitiveValueImpl(CSS_VAL_SUB); case khtml::SUPER: return new CSSPrimitiveValueImpl(CSS_VAL_SUPER); case khtml::TEXT_TOP: return new CSSPrimitiveValueImpl(CSS_VAL_TEXT_TOP); case khtml::TEXT_BOTTOM: return new CSSPrimitiveValueImpl(CSS_VAL_TEXT_BOTTOM); case khtml::TOP: return new CSSPrimitiveValueImpl(CSS_VAL_TOP); case khtml::BOTTOM: return new CSSPrimitiveValueImpl(CSS_VAL_BOTTOM); case khtml::BASELINE_MIDDLE: return new CSSPrimitiveValueImpl(CSS_VAL__KHTML_BASELINE_MIDDLE); case khtml::LENGTH: return valueForLength(style->verticalAlignLength()); } ASSERT_NOT_REACHED(); return 0; case CSS_PROP_VISIBILITY: switch (style->visibility()) { case khtml::VISIBLE: return new CSSPrimitiveValueImpl(CSS_VAL_VISIBLE); case khtml::HIDDEN: return new CSSPrimitiveValueImpl(CSS_VAL_HIDDEN); case khtml::COLLAPSE: return new CSSPrimitiveValueImpl(CSS_VAL_COLLAPSE); } ASSERT_NOT_REACHED(); return 0; case CSS_PROP_WHITE_SPACE: switch (style->whiteSpace()) { case khtml::NORMAL: return new CSSPrimitiveValueImpl(CSS_VAL_NORMAL); case khtml::PRE: return new CSSPrimitiveValueImpl(CSS_VAL_PRE); case khtml::NOWRAP: return new CSSPrimitiveValueImpl(CSS_VAL_NOWRAP); case khtml::KHTML_NOWRAP: return new CSSPrimitiveValueImpl(CSS_VAL__KHTML_NOWRAP); } ASSERT_NOT_REACHED(); return 0; case CSS_PROP_WIDOWS: return new CSSPrimitiveValueImpl(style->widows(), CSSPrimitiveValue::CSS_NUMBER); case CSS_PROP_WIDTH: return new CSSPrimitiveValueImpl(renderer->contentWidth(), CSSPrimitiveValue::CSS_PX); case CSS_PROP_WORD_SPACING: return new CSSPrimitiveValueImpl(style->wordSpacing(), CSSPrimitiveValue::CSS_PX); case CSS_PROP_WORD_WRAP: switch (style->wordWrap()) { case khtml::WBNORMAL: return new CSSPrimitiveValueImpl(CSS_VAL_NORMAL); case khtml::BREAK_WORD: return new CSSPrimitiveValueImpl(CSS_VAL_BREAK_WORD); } ASSERT_NOT_REACHED(); return 0; case CSS_PROP__KHTML_LINE_BREAK: switch (style->khtmlLineBreak()) { case khtml::LBNORMAL: return new CSSPrimitiveValueImpl(CSS_VAL_NORMAL); case khtml::AFTER_WHITE_SPACE: return new CSSPrimitiveValueImpl(CSS_VAL_AFTER_WHITE_SPACE); } ASSERT_NOT_REACHED(); return 0; case CSS_PROP__KHTML_NBSP_MODE: switch (style->nbspMode()) { case khtml::NBNORMAL: return new CSSPrimitiveValueImpl(CSS_VAL_NORMAL); case khtml::SPACE: return new CSSPrimitiveValueImpl(CSS_VAL_SPACE); } ASSERT_NOT_REACHED(); return 0; case CSS_PROP__KHTML_MATCH_NEAREST_MAIL_BLOCKQUOTE_COLOR: switch (style->matchNearestMailBlockquoteColor()) { case khtml::BCNORMAL: return new CSSPrimitiveValueImpl(CSS_VAL_NORMAL); case khtml::MATCH: return new CSSPrimitiveValueImpl(CSS_VAL_MATCH); } ASSERT_NOT_REACHED(); return 0; case CSS_PROP_Z_INDEX: if (style->hasAutoZIndex()) return new CSSPrimitiveValueImpl(CSS_VAL_NORMAL); return new CSSPrimitiveValueImpl(style->zIndex(), CSSPrimitiveValue::CSS_NUMBER); case CSS_PROP_BACKGROUND: // FIXME: unimplemented break; case CSS_PROP_BORDER: // FIXME: unimplemented break; case CSS_PROP_BORDER_COLOR: // FIXME: unimplemented break; case CSS_PROP_BORDER_STYLE: // FIXME: unimplemented break; case CSS_PROP_BORDER_TOP: // FIXME: unimplemented break; case CSS_PROP_BORDER_RIGHT: // FIXME: unimplemented break; case CSS_PROP_BORDER_BOTTOM: // FIXME: unimplemented break; case CSS_PROP_BORDER_LEFT: // FIXME: unimplemented break; case CSS_PROP_BORDER_WIDTH: // FIXME: unimplemented break; case CSS_PROP_FONT: // FIXME: unimplemented break; case CSS_PROP_LIST_STYLE: // FIXME: unimplemented break; case CSS_PROP_MARGIN: // FIXME: unimplemented break; case CSS_PROP_OUTLINE: // FIXME: unimplemented break; case CSS_PROP_PADDING: // FIXME: unimplemented break; #if !APPLE_CHANGES case CSS_PROP_SCROLLBAR_FACE_COLOR: // FIXME: unimplemented break; case CSS_PROP_SCROLLBAR_SHADOW_COLOR: // FIXME: unimplemented break; case CSS_PROP_SCROLLBAR_HIGHLIGHT_COLOR: // FIXME: unimplemented break; case CSS_PROP_SCROLLBAR_3DLIGHT_COLOR: // FIXME: unimplemented break; case CSS_PROP_SCROLLBAR_DARKSHADOW_COLOR: // FIXME: unimplemented break; case CSS_PROP_SCROLLBAR_TRACK_COLOR: // FIXME: unimplemented break; case CSS_PROP_SCROLLBAR_ARROW_COLOR: // FIXME: unimplemented break; #endif #if APPLE_CHANGES case CSS_PROP__APPLE_DASHBOARD_REGION: { QValueList<StyleDashboardRegion> regions = style->dashboardRegions(); uint i, count = regions.count(); if (count == 1 && regions[0].type == StyleDashboardRegion::None) return new CSSPrimitiveValueImpl (CSS_VAL_NONE); DashboardRegionImpl *firstRegion = new DashboardRegionImpl(), *region; region = firstRegion; for (i = 0; i < count; i++) { StyleDashboardRegion styleRegion = regions[i]; region->m_label = styleRegion.label; LengthBox offset = styleRegion.offset; region->setTop (new CSSPrimitiveValueImpl(offset.top.value, CSSPrimitiveValue::CSS_PX)); region->setRight (new CSSPrimitiveValueImpl(offset.right.value, CSSPrimitiveValue::CSS_PX)); region->setBottom (new CSSPrimitiveValueImpl(offset.bottom.value, CSSPrimitiveValue::CSS_PX)); region->setLeft (new CSSPrimitiveValueImpl(offset.left.value, CSSPrimitiveValue::CSS_PX)); region->m_isRectangle = (styleRegion.type == StyleDashboardRegion::Rectangle); region->m_isCircle = (styleRegion.type == StyleDashboardRegion::Circle); if (i != count-1) { DashboardRegionImpl *newRegion = new DashboardRegionImpl(); region->setNext (newRegion); region = newRegion; } } return new CSSPrimitiveValueImpl(firstRegion); } #endif } ERROR("unimplemented propertyID: %d", propertyID); return 0; }
bool RenderStyle::diffNeedsFullLayout(const RenderStyle& other) const { // FIXME: Not all cases in this method need both full layout and paint invalidation. // Should move cases into diffNeedsFullLayout() if // - don't need paint invalidation at all; // - or the renderer knows how to exactly invalidate paints caused by the layout change // instead of forced full paint invalidation. if (surround.get() != other.surround.get()) { // If our border widths change, then we need to layout. Other changes to borders only necessitate a paint invalidation. if (borderLeftWidth() != other.borderLeftWidth() || borderTopWidth() != other.borderTopWidth() || borderBottomWidth() != other.borderBottomWidth() || borderRightWidth() != other.borderRightWidth()) return true; } if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) { if (rareNonInheritedData->textOverflow != other.rareNonInheritedData->textOverflow || rareNonInheritedData->m_wrapFlow != other.rareNonInheritedData->m_wrapFlow || rareNonInheritedData->m_wrapThrough != other.rareNonInheritedData->m_wrapThrough || rareNonInheritedData->m_order != other.rareNonInheritedData->m_order || rareNonInheritedData->m_alignContent != other.rareNonInheritedData->m_alignContent || rareNonInheritedData->m_alignItems != other.rareNonInheritedData->m_alignItems || rareNonInheritedData->m_alignSelf != other.rareNonInheritedData->m_alignSelf || rareNonInheritedData->m_justifyContent != other.rareNonInheritedData->m_justifyContent) return true; if (rareNonInheritedData->m_flexibleBox.get() != other.rareNonInheritedData->m_flexibleBox.get() && *rareNonInheritedData->m_flexibleBox.get() != *other.rareNonInheritedData->m_flexibleBox.get()) return true; // FIXME: We should add an optimized form of layout that just recomputes visual overflow. if (!rareNonInheritedData->shadowDataEquivalent(*other.rareNonInheritedData.get())) return true; // If the counter directives change, trigger a relayout to re-calculate counter values and rebuild the counter node tree. const CounterDirectiveMap* mapA = rareNonInheritedData->m_counterDirectives.get(); const CounterDirectiveMap* mapB = other.rareNonInheritedData->m_counterDirectives.get(); if (!(mapA == mapB || (mapA && mapB && *mapA == *mapB))) return true; // We only need do layout for opacity changes if adding or losing opacity could trigger a change // in us being a stacking context. if (hasAutoZIndex() != other.hasAutoZIndex() && rareNonInheritedData->hasOpacity() != other.rareNonInheritedData->hasOpacity()) { // FIXME: We would like to use SimplifiedLayout here, but we can't quite do that yet. // We need to make sure SimplifiedLayout can operate correctly on RenderInlines (we will need // to add a selfNeedsSimplifiedLayout bit in order to not get confused and taint every line). // In addition we need to solve the floating object issue when layers come and go. Right now // a full layout is necessary to keep floating object lists sane. return true; } } if (rareInheritedData.get() != other.rareInheritedData.get()) { if (rareInheritedData->highlight != other.rareInheritedData->highlight || rareInheritedData->indent != other.rareInheritedData->indent || rareInheritedData->m_textAlignLast != other.rareInheritedData->m_textAlignLast || rareInheritedData->m_textIndentLine != other.rareInheritedData->m_textIndentLine || rareInheritedData->wordBreak != other.rareInheritedData->wordBreak || rareInheritedData->overflowWrap != other.rareInheritedData->overflowWrap || rareInheritedData->lineBreak != other.rareInheritedData->lineBreak || rareInheritedData->hyphens != other.rareInheritedData->hyphens || rareInheritedData->hyphenationLimitBefore != other.rareInheritedData->hyphenationLimitBefore || rareInheritedData->hyphenationLimitAfter != other.rareInheritedData->hyphenationLimitAfter || rareInheritedData->hyphenationString != other.rareInheritedData->hyphenationString || rareInheritedData->locale != other.rareInheritedData->locale || rareInheritedData->textEmphasisMark != other.rareInheritedData->textEmphasisMark || rareInheritedData->textEmphasisPosition != other.rareInheritedData->textEmphasisPosition || rareInheritedData->textEmphasisCustomMark != other.rareInheritedData->textEmphasisCustomMark || rareInheritedData->m_textJustify != other.rareInheritedData->m_textJustify || rareInheritedData->m_textOrientation != other.rareInheritedData->m_textOrientation || rareInheritedData->m_tabSize != other.rareInheritedData->m_tabSize || rareInheritedData->m_lineBoxContain != other.rareInheritedData->m_lineBoxContain || rareInheritedData->textStrokeWidth != other.rareInheritedData->textStrokeWidth) return true; if (!rareInheritedData->shadowDataEquivalent(*other.rareInheritedData.get())) return true; } if (inherited.get() != other.inherited.get()) { if (inherited->line_height != other.inherited->line_height || inherited->font != other.inherited->font || inherited->horizontal_border_spacing != other.inherited->horizontal_border_spacing || inherited->vertical_border_spacing != other.inherited->vertical_border_spacing) return true; } if (inherited_flags.m_rtlOrdering != other.inherited_flags.m_rtlOrdering || inherited_flags._text_align != other.inherited_flags._text_align || inherited_flags._direction != other.inherited_flags._direction || inherited_flags._white_space != other.inherited_flags._white_space) return true; if (noninherited_flags.overflowX != other.noninherited_flags.overflowX || noninherited_flags.overflowY != other.noninherited_flags.overflowY || noninherited_flags.unicodeBidi != other.noninherited_flags.unicodeBidi || noninherited_flags.position != other.noninherited_flags.position || noninherited_flags.originalDisplay != other.noninherited_flags.originalDisplay) return true; if (!m_background->outline().visuallyEqual(other.m_background->outline())) { // FIXME: We only really need to recompute the overflow but we don't have an optimized layout for it. return true; } if (m_box.get() != other.m_box.get()) { if (m_box->width() != other.m_box->width() || m_box->minWidth() != other.m_box->minWidth() || m_box->maxWidth() != other.m_box->maxWidth() || m_box->height() != other.m_box->height() || m_box->minHeight() != other.m_box->minHeight() || m_box->maxHeight() != other.m_box->maxHeight()) return true; if (m_box->verticalAlign() != other.m_box->verticalAlign()) return true; if (m_box->boxSizing() != other.m_box->boxSizing()) return true; } if (noninherited_flags.verticalAlign != other.noninherited_flags.verticalAlign) return true; if (surround.get() != other.surround.get()) { if (surround->margin != other.surround->margin) return true; if (surround->padding != other.surround->padding) return true; } // Movement of non-static-positioned object is special cased in RenderStyle::visualInvalidationDiff(). return false; }