948
978
(s->hovered() == m_element->hovered()) &&
949
979
(s->active() == m_element->active()) &&
950
980
(s->focused() == m_element->focused()) &&
951
(s != s->document()->getCSSTarget() && m_element != m_element->document()->getCSSTarget()) &&
981
(s != s->document()->cssTarget() && m_element != m_element->document()->cssTarget()) &&
952
982
(s->getAttribute(typeAttr) == m_element->getAttribute(typeAttr)) &&
953
983
(s->getAttribute(XMLNames::langAttr) == m_element->getAttribute(XMLNames::langAttr)) &&
954
984
(s->getAttribute(langAttr) == m_element->getAttribute(langAttr)) &&
955
985
(s->getAttribute(readonlyAttr) == m_element->getAttribute(readonlyAttr)) &&
956
986
(s->getAttribute(cellpaddingAttr) == m_element->getAttribute(cellpaddingAttr))) {
957
bool isControl = s->isControl();
958
if (isControl != m_element->isControl())
960
if (isControl && (s->isEnabled() != m_element->isEnabled()) ||
961
(s->isIndeterminate() != m_element->isIndeterminate()) ||
962
(s->isChecked() != m_element->isChecked()) ||
963
(s->isAutofilled() != m_element->isAutofilled()))
987
bool isControl = s->isFormControlElement();
988
if (isControl != m_element->isFormControlElement())
991
InputElement* thisInputElement = toInputElement(s);
992
InputElement* otherInputElement = toInputElement(m_element);
993
if (thisInputElement && otherInputElement) {
994
if ((thisInputElement->isAutofilled() != otherInputElement->isAutofilled()) ||
995
(thisInputElement->isChecked() != otherInputElement->isChecked()) ||
996
(thisInputElement->isIndeterminate() != otherInputElement->isIndeterminate()))
1001
if (s->isEnabledFormControl() != m_element->isEnabledFormControl())
1004
if (s->isDefaultButtonForForm() != m_element->isDefaultButtonForForm())
1007
if ((s->willValidate() && s->isValidFormControlElement()) !=
1008
(m_element->willValidate() && m_element->isValidFormControlElement()))
966
1012
if (style->transitions() || style->animations())
1481
1562
// cases where objects that should be blended as a single unit end up with a non-transparent
1482
1563
// object wedged in between them. Auto z-index also becomes 0 for objects that specify transforms/masks/reflections.
1483
1564
if (style->hasAutoZIndex() && ((e && e->document()->documentElement() == e) || style->opacity() < 1.0f ||
1484
style->hasTransform() || style->hasMask() || style->boxReflect()))
1565
style->hasTransformRelatedProperty() || style->hasMask() || style->boxReflect()))
1485
1566
style->setZIndex(0);
1487
1568
// Button, legend, input, select and textarea all consider width values of 'auto' to be 'intrinsic'.
1488
1569
// This will be important when we use block flows for all form controls.
1489
1570
if (e && (e->hasTagName(legendTag) || e->hasTagName(buttonTag) || e->hasTagName(inputTag) ||
1490
e->hasTagName(selectTag) || e->hasTagName(textareaTag)
1571
e->hasTagName(selectTag) || e->hasTagName(textareaTag) || e->hasTagName(datagridTag)
1491
1572
#if ENABLE(WML)
1492
1573
|| e->hasTagName(WMLNames::insertedLegendTag)
1574
|| e->hasTagName(WMLNames::inputTag)
1495
1577
if (style->width().isAuto())
1496
1578
style->setWidth(Length(Intrinsic));
1580
// Textarea considers overflow visible as auto.
1581
if (e && e->hasTagName(textareaTag)) {
1582
style->setOverflowX(style->overflowX() == OVISIBLE ? OAUTO : style->overflowX());
1583
style->setOverflowY(style->overflowY() == OVISIBLE ? OAUTO : style->overflowY());
1499
1587
// Finally update our text decorations in effect, but don't allow text-decoration to percolate through
1906
1994
for (CSSSelector* subSel = sel->simpleSelector(); subSel; subSel = subSel->tagHistory()) {
1907
1995
// :not cannot nest. I don't really know why this is a
1908
1996
// restriction in CSS3, but it is, so let's honor it.
1909
if (subSel->simpleSelector())
1997
// the parser enforces that this never occurs
1998
ASSERT(!subSel->simpleSelector());
1911
2000
if (!checkOneSelector(subSel, e, selectorAttrs, dynamicPseudo, isAncestor, true, elementStyle, elementParentStyle))
1914
} else if (dynamicPseudo != RenderStyle::NOPSEUDO && (RenderScrollbar::scrollbarForStyleResolve() || dynamicPseudo == RenderStyle::SCROLLBAR_CORNER || dynamicPseudo == RenderStyle::RESIZER)) {
2003
} else if (dynamicPseudo != NOPSEUDO && (RenderScrollbar::scrollbarForStyleResolve() || dynamicPseudo == SCROLLBAR_CORNER || dynamicPseudo == RESIZER)) {
1915
2004
// CSS scrollbars match a specific subset of pseudo classes, and they have specialized rules for each
1916
2005
// (since there are no elements involved).
1917
2006
return checkScrollbarPseudoClass(sel, dynamicPseudo);
2007
} else if (dynamicPseudo == SELECTION) {
2008
if (sel->pseudoType() == CSSSelector::PseudoWindowInactive)
2009
return !m_document->page()->focusController()->isActive();
1920
2012
// Normal element pseudo class checking.
2275
2370
case CSSSelector::PseudoEnabled:
2276
if (e && e->isControl() && !e->isInputTypeHidden())
2371
if (e && e->isFormControlElement()) {
2372
InputElement* inputElement = toInputElement(e);
2373
if (inputElement && inputElement->isInputTypeHidden())
2277
2375
// The UI spec states that you can't match :enabled unless you are an object that can
2278
2376
// "receive focus and be activated." We will limit matching of this pseudo-class to elements
2279
2377
// that are non-"hidden" controls.
2280
return e->isEnabled();
2378
return e->isEnabledFormControl();
2282
2381
case CSSSelector::PseudoFullPageMedia:
2283
2382
return e && e->document() && e->document()->isMediaDocument();
2384
case CSSSelector::PseudoDefault:
2385
return e && e->isDefaultButtonForForm();
2285
2386
case CSSSelector::PseudoDisabled:
2286
if (e && e->isControl() && !e->isInputTypeHidden())
2387
if (e && e->isFormControlElement()) {
2388
InputElement* inputElement = toInputElement(e);
2389
if (inputElement && inputElement->isInputTypeHidden())
2287
2392
// The UI spec states that you can't match :enabled unless you are an object that can
2288
2393
// "receive focus and be activated." We will limit matching of this pseudo-class to elements
2289
2394
// that are non-"hidden" controls.
2290
return !e->isEnabled();
2395
return !e->isEnabledFormControl();
2292
case CSSSelector::PseudoReadOnly:
2293
return e && e->isTextControl() && e->isReadOnlyControl();
2294
case CSSSelector::PseudoReadWrite:
2295
return e && e->isTextControl() && !e->isReadOnlyControl();
2296
case CSSSelector::PseudoChecked:
2398
case CSSSelector::PseudoReadOnly: {
2399
if (!e || !e->isFormControlElement())
2401
return e->isTextFormControl() && e->isReadOnlyFormControl();
2403
case CSSSelector::PseudoReadWrite: {
2404
if (!e || !e->isFormControlElement())
2406
return e->isTextFormControl() && !e->isReadOnlyFormControl();
2408
case CSSSelector::PseudoOptional:
2409
return e && e->isOptionalFormControl();
2410
case CSSSelector::PseudoRequired:
2411
return e && e->isRequiredFormControl();
2412
case CSSSelector::PseudoValid:
2413
return e && e->willValidate() && e->isValidFormControlElement();
2414
case CSSSelector::PseudoInvalid:
2415
return e && e->willValidate() && !e->isValidFormControlElement();
2416
case CSSSelector::PseudoChecked: {
2417
if (!e || !e->isFormControlElement())
2297
2419
// Even though WinIE allows checked and indeterminate to co-exist, the CSS selector spec says that
2298
2420
// you can't be both checked and indeterminate. We will behave like WinIE behind the scenes and just
2299
2421
// obey the CSS spec here in the test for matching the pseudo.
2300
if (e && e->isChecked() && !e->isIndeterminate())
2303
case CSSSelector::PseudoIndeterminate:
2304
if (e && e->isIndeterminate())
2422
InputElement* inputElement = toInputElement(e);
2423
if (inputElement && inputElement->isChecked() && !inputElement->isIndeterminate())
2427
case CSSSelector::PseudoIndeterminate: {
2428
if (!e || !e->isFormControlElement())
2430
InputElement* inputElement = toInputElement(e);
2431
if (inputElement && inputElement->isIndeterminate())
2307
2435
case CSSSelector::PseudoRoot:
2308
2436
if (e == e->document()->documentElement())
2347
2475
switch (sel->pseudoType()) {
2348
2476
// Pseudo-elements:
2349
2477
case CSSSelector::PseudoFirstLine:
2350
dynamicPseudo = RenderStyle::FIRST_LINE;
2478
dynamicPseudo = FIRST_LINE;
2352
2480
case CSSSelector::PseudoFirstLetter:
2353
dynamicPseudo = RenderStyle::FIRST_LETTER;
2481
dynamicPseudo = FIRST_LETTER;
2354
2482
if (Document* doc = e->document())
2355
2483
doc->setUsesFirstLetterRules(true);
2357
2485
case CSSSelector::PseudoSelection:
2358
dynamicPseudo = RenderStyle::SELECTION;
2486
dynamicPseudo = SELECTION;
2360
2488
case CSSSelector::PseudoBefore:
2361
dynamicPseudo = RenderStyle::BEFORE;
2489
dynamicPseudo = BEFORE;
2363
2491
case CSSSelector::PseudoAfter:
2364
dynamicPseudo = RenderStyle::AFTER;
2492
dynamicPseudo = AFTER;
2366
2494
case CSSSelector::PseudoFileUploadButton:
2367
dynamicPseudo = RenderStyle::FILE_UPLOAD_BUTTON;
2495
dynamicPseudo = FILE_UPLOAD_BUTTON;
2369
2497
case CSSSelector::PseudoInputPlaceholder:
2370
dynamicPseudo = RenderStyle::INPUT_PLACEHOLDER;
2498
dynamicPseudo = INPUT_PLACEHOLDER;
2372
2500
case CSSSelector::PseudoSliderThumb:
2373
dynamicPseudo = RenderStyle::SLIDER_THUMB;
2501
dynamicPseudo = SLIDER_THUMB;
2375
2503
case CSSSelector::PseudoSearchCancelButton:
2376
dynamicPseudo = RenderStyle::SEARCH_CANCEL_BUTTON;
2504
dynamicPseudo = SEARCH_CANCEL_BUTTON;
2378
2506
case CSSSelector::PseudoSearchDecoration:
2379
dynamicPseudo = RenderStyle::SEARCH_DECORATION;
2507
dynamicPseudo = SEARCH_DECORATION;
2381
2509
case CSSSelector::PseudoSearchResultsDecoration:
2382
dynamicPseudo = RenderStyle::SEARCH_RESULTS_DECORATION;
2510
dynamicPseudo = SEARCH_RESULTS_DECORATION;
2384
2512
case CSSSelector::PseudoSearchResultsButton:
2385
dynamicPseudo = RenderStyle::SEARCH_RESULTS_BUTTON;
2513
dynamicPseudo = SEARCH_RESULTS_BUTTON;
2387
2515
case CSSSelector::PseudoMediaControlsPanel:
2388
dynamicPseudo = RenderStyle::MEDIA_CONTROLS_PANEL;
2516
dynamicPseudo = MEDIA_CONTROLS_PANEL;
2390
2518
case CSSSelector::PseudoMediaControlsMuteButton:
2391
dynamicPseudo = RenderStyle::MEDIA_CONTROLS_MUTE_BUTTON;
2519
dynamicPseudo = MEDIA_CONTROLS_MUTE_BUTTON;
2393
2521
case CSSSelector::PseudoMediaControlsPlayButton:
2394
dynamicPseudo = RenderStyle::MEDIA_CONTROLS_PLAY_BUTTON;
2396
case CSSSelector::PseudoMediaControlsTimeDisplay:
2397
dynamicPseudo = RenderStyle::MEDIA_CONTROLS_TIME_DISPLAY;
2522
dynamicPseudo = MEDIA_CONTROLS_PLAY_BUTTON;
2524
case CSSSelector::PseudoMediaControlsTimelineContainer:
2525
dynamicPseudo = MEDIA_CONTROLS_TIMELINE_CONTAINER;
2527
case CSSSelector::PseudoMediaControlsVolumeSliderContainer:
2528
dynamicPseudo = MEDIA_CONTROLS_VOLUME_SLIDER_CONTAINER;
2530
case CSSSelector::PseudoMediaControlsCurrentTimeDisplay:
2531
dynamicPseudo = MEDIA_CONTROLS_CURRENT_TIME_DISPLAY;
2533
case CSSSelector::PseudoMediaControlsTimeRemainingDisplay:
2534
dynamicPseudo = MEDIA_CONTROLS_TIME_REMAINING_DISPLAY;
2399
2536
case CSSSelector::PseudoMediaControlsTimeline:
2400
dynamicPseudo = RenderStyle::MEDIA_CONTROLS_TIMELINE;
2537
dynamicPseudo = MEDIA_CONTROLS_TIMELINE;
2539
case CSSSelector::PseudoMediaControlsVolumeSlider:
2540
dynamicPseudo = MEDIA_CONTROLS_VOLUME_SLIDER;
2402
2542
case CSSSelector::PseudoMediaControlsSeekBackButton:
2403
dynamicPseudo = RenderStyle::MEDIA_CONTROLS_SEEK_BACK_BUTTON;
2543
dynamicPseudo = MEDIA_CONTROLS_SEEK_BACK_BUTTON;
2405
2545
case CSSSelector::PseudoMediaControlsSeekForwardButton:
2406
dynamicPseudo = RenderStyle::MEDIA_CONTROLS_SEEK_FORWARD_BUTTON;
2546
dynamicPseudo = MEDIA_CONTROLS_SEEK_FORWARD_BUTTON;
2548
case CSSSelector::PseudoMediaControlsRewindButton:
2549
dynamicPseudo = MEDIA_CONTROLS_REWIND_BUTTON;
2551
case CSSSelector::PseudoMediaControlsReturnToRealtimeButton:
2552
dynamicPseudo = MEDIA_CONTROLS_RETURN_TO_REALTIME_BUTTON;
2554
case CSSSelector::PseudoMediaControlsStatusDisplay:
2555
dynamicPseudo = MEDIA_CONTROLS_STATUS_DISPLAY;
2408
2557
case CSSSelector::PseudoMediaControlsFullscreenButton:
2409
dynamicPseudo = RenderStyle::MEDIA_CONTROLS_FULLSCREEN_BUTTON;
2558
dynamicPseudo = MEDIA_CONTROLS_FULLSCREEN_BUTTON;
2411
2560
case CSSSelector::PseudoScrollbar:
2412
dynamicPseudo = RenderStyle::SCROLLBAR;
2561
dynamicPseudo = SCROLLBAR;
2414
2563
case CSSSelector::PseudoScrollbarButton:
2415
dynamicPseudo = RenderStyle::SCROLLBAR_BUTTON;
2564
dynamicPseudo = SCROLLBAR_BUTTON;
2417
2566
case CSSSelector::PseudoScrollbarCorner:
2418
dynamicPseudo = RenderStyle::SCROLLBAR_CORNER;
2567
dynamicPseudo = SCROLLBAR_CORNER;
2420
2569
case CSSSelector::PseudoScrollbarThumb:
2421
dynamicPseudo = RenderStyle::SCROLLBAR_THUMB;
2570
dynamicPseudo = SCROLLBAR_THUMB;
2423
2572
case CSSSelector::PseudoScrollbarTrack:
2424
dynamicPseudo = RenderStyle::SCROLLBAR_TRACK;
2573
dynamicPseudo = SCROLLBAR_TRACK;
2426
2575
case CSSSelector::PseudoScrollbarTrackPiece:
2427
dynamicPseudo = RenderStyle::SCROLLBAR_TRACK_PIECE;
2576
dynamicPseudo = SCROLLBAR_TRACK_PIECE;
2429
2578
case CSSSelector::PseudoResizer:
2430
dynamicPseudo = RenderStyle::RESIZER;
2579
dynamicPseudo = RESIZER;
2432
2581
case CSSSelector::PseudoUnknown:
2433
2582
case CSSSelector::PseudoNotParsed:
2652
2801
// -------------------------------------------------------------------------------------
2653
2802
// this is mostly boring stuff on how to apply a certain rule to the renderstyle...
2655
static Length convertToLength(CSSPrimitiveValue *primitiveValue, RenderStyle *style, bool *ok = 0)
2804
static Length convertToLength(CSSPrimitiveValue* primitiveValue, RenderStyle* style, RenderStyle* rootStyle, double multiplier = 1, bool *ok = 0)
2806
// This function is tolerant of a null style value. The only place style is used is in
2807
// length measurements, like 'ems' and 'px'. And in those cases style is only used
2808
// when the units are EMS or EXS. So we will just fail in those cases.
2658
2810
if (!primitiveValue) {
2662
2814
int type = primitiveValue->primitiveType();
2663
if (type > CSSPrimitiveValue::CSS_PERCENTAGE && type < CSSPrimitiveValue::CSS_DEG)
2664
l = Length(primitiveValue->computeLengthIntForLength(style), Fixed);
2816
if (!style && (type == CSSPrimitiveValue::CSS_EMS || type == CSSPrimitiveValue::CSS_EXS || type == CSSPrimitiveValue::CSS_REMS)) {
2819
} else if (CSSPrimitiveValue::isUnitTypeLength(type))
2820
l = Length(primitiveValue->computeLengthIntForLength(style, rootStyle, multiplier), Fixed);
2665
2821
else if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
2666
2822
l = Length(primitiveValue->getDoubleValue(), Percent);
2667
2823
else if (type == CSSPrimitiveValue::CSS_NUMBER)
2788
2944
case CSSPropertyBackgroundAttachment:
2789
2945
HANDLE_BACKGROUND_VALUE(attachment, Attachment, value)
2947
case CSSPropertyBackgroundClip:
2791
2948
case CSSPropertyWebkitBackgroundClip:
2792
2949
HANDLE_BACKGROUND_VALUE(clip, Clip, value)
2794
2951
case CSSPropertyWebkitBackgroundComposite:
2795
2952
HANDLE_BACKGROUND_VALUE(composite, Composite, value)
2954
case CSSPropertyBackgroundOrigin:
2797
2955
case CSSPropertyWebkitBackgroundOrigin:
2798
2956
HANDLE_BACKGROUND_VALUE(origin, Origin, value)
2800
case CSSPropertyBackgroundRepeat:
2801
HANDLE_BACKGROUND_VALUE(repeat, Repeat, value)
2803
case CSSPropertyWebkitBackgroundSize:
2958
case CSSPropertyBackgroundSize:
2804
2959
HANDLE_BACKGROUND_VALUE(size, Size, value)
2806
2961
case CSSPropertyWebkitMaskAttachment:
2840
2991
case CSSPropertyBorderTopStyle:
2841
HANDLE_INHERIT_AND_INITIAL_WITH_VALUE(borderTopStyle, BorderTopStyle, BorderStyle)
2843
m_style->setBorderTopStyle(*primitiveValue);
2992
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE_WITH_VALUE(borderTopStyle, BorderTopStyle, BorderStyle)
2845
2994
case CSSPropertyBorderRightStyle:
2846
HANDLE_INHERIT_AND_INITIAL_WITH_VALUE(borderRightStyle, BorderRightStyle, BorderStyle)
2848
m_style->setBorderRightStyle(*primitiveValue);
2995
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE_WITH_VALUE(borderRightStyle, BorderRightStyle, BorderStyle)
2850
2997
case CSSPropertyBorderBottomStyle:
2851
HANDLE_INHERIT_AND_INITIAL_WITH_VALUE(borderBottomStyle, BorderBottomStyle, BorderStyle)
2853
m_style->setBorderBottomStyle(*primitiveValue);
2998
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE_WITH_VALUE(borderBottomStyle, BorderBottomStyle, BorderStyle)
2855
3000
case CSSPropertyBorderLeftStyle:
2856
HANDLE_INHERIT_AND_INITIAL_WITH_VALUE(borderLeftStyle, BorderLeftStyle, BorderStyle)
2858
m_style->setBorderLeftStyle(*primitiveValue);
3001
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE_WITH_VALUE(borderLeftStyle, BorderLeftStyle, BorderStyle)
2860
3003
case CSSPropertyOutlineStyle:
2861
3004
HANDLE_INHERIT_AND_INITIAL_WITH_VALUE(outlineStyle, OutlineStyle, BorderStyle)
2869
3012
case CSSPropertyCaptionSide:
2871
HANDLE_INHERIT_AND_INITIAL(captionSide, CaptionSide)
2873
m_style->setCaptionSide(*primitiveValue);
3013
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(captionSide, CaptionSide)
2876
3015
case CSSPropertyClear:
2878
HANDLE_INHERIT_AND_INITIAL(clear, Clear)
2880
m_style->setClear(*primitiveValue);
3016
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(clear, Clear)
2883
3018
case CSSPropertyDirection:
2885
HANDLE_INHERIT_AND_INITIAL(direction, Direction)
2887
m_style->setDirection(*primitiveValue);
3019
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(direction, Direction)
2890
3021
case CSSPropertyDisplay:
2892
HANDLE_INHERIT_AND_INITIAL(display, Display)
2894
m_style->setDisplay(*primitiveValue);
3022
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(display, Display)
3024
if (primitiveValue) {
3025
if (primitiveValue->getIdent() == CSSValueWapMarquee) {
3026
// Initialize Wap Marquee style
3027
m_style->setOverflowX(OMARQUEE);
3028
m_style->setOverflowY(OMARQUEE);
3029
m_style->setWhiteSpace(NOWRAP);
3030
m_style->setMarqueeDirection(MLEFT);
3031
m_style->setMarqueeSpeed(85); // Normal speed
3032
m_style->setMarqueeLoopCount(1);
3033
m_style->setMarqueeBehavior(MSCROLL);
3036
m_style->setDisplay(m_parentStyle->display());
3038
m_style->setDisplay(*primitiveValue);
3040
m_style->setDisplay(*primitiveValue);
2898
3044
case CSSPropertyEmptyCells:
2900
HANDLE_INHERIT_AND_INITIAL(emptyCells, EmptyCells)
2902
m_style->setEmptyCells(*primitiveValue);
3045
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(emptyCells, EmptyCells)
2905
3047
case CSSPropertyFloat:
2907
HANDLE_INHERIT_AND_INITIAL(floating, Floating)
2909
m_style->setFloating(*primitiveValue);
3048
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(floating, Floating)
2913
3050
case CSSPropertyFontStyle:
2915
3052
FontDescription fontDescription = m_style->fontDescription();
3059
3186
case CSSPropertyOverflowX:
3061
HANDLE_INHERIT_AND_INITIAL(overflowX, OverflowX)
3062
m_style->setOverflowX(*primitiveValue);
3187
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(overflowX, OverflowX)
3066
3189
case CSSPropertyOverflowY:
3068
HANDLE_INHERIT_AND_INITIAL(overflowY, OverflowY)
3069
m_style->setOverflowY(*primitiveValue);
3190
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(overflowY, OverflowY)
3073
3192
case CSSPropertyPageBreakBefore:
3075
HANDLE_INHERIT_AND_INITIAL_WITH_VALUE(pageBreakBefore, PageBreakBefore, PageBreak)
3077
m_style->setPageBreakBefore(*primitiveValue);
3193
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE_WITH_VALUE(pageBreakBefore, PageBreakBefore, PageBreak)
3081
3195
case CSSPropertyPageBreakAfter:
3083
HANDLE_INHERIT_AND_INITIAL_WITH_VALUE(pageBreakAfter, PageBreakAfter, PageBreak)
3085
m_style->setPageBreakAfter(*primitiveValue);
3196
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE_WITH_VALUE(pageBreakAfter, PageBreakAfter, PageBreak)
3089
3198
case CSSPropertyPageBreakInside: {
3090
3199
HANDLE_INHERIT_AND_INITIAL_WITH_VALUE(pageBreakInside, PageBreakInside, PageBreak)
3091
3200
if (!primitiveValue)
3118
case CSSPropertyUnicodeBidi: {
3119
HANDLE_INHERIT_AND_INITIAL(unicodeBidi, UnicodeBidi)
3120
m_style->setUnicodeBidi(*primitiveValue);
3123
case CSSPropertyTextTransform: {
3124
HANDLE_INHERIT_AND_INITIAL(textTransform, TextTransform)
3125
m_style->setTextTransform(*primitiveValue);
3222
case CSSPropertyUnicodeBidi:
3223
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(unicodeBidi, UnicodeBidi)
3225
case CSSPropertyTextTransform:
3226
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(textTransform, TextTransform)
3129
3228
case CSSPropertyVisibility:
3131
HANDLE_INHERIT_AND_INITIAL(visibility, Visibility)
3132
m_style->setVisibility(*primitiveValue);
3229
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(visibility, Visibility)
3135
3231
case CSSPropertyWhiteSpace:
3136
HANDLE_INHERIT_AND_INITIAL(whiteSpace, WhiteSpace)
3137
m_style->setWhiteSpace(*primitiveValue);
3232
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(whiteSpace, WhiteSpace)
3140
3235
case CSSPropertyBackgroundPosition:
3161
3256
HANDLE_MASK_VALUE(yPosition, YPosition, value)
3259
case CSSPropertyBackgroundRepeat:
3260
HANDLE_BACKGROUND_INHERIT_AND_INITIAL(repeatX, RepeatX);
3261
HANDLE_BACKGROUND_INHERIT_AND_INITIAL(repeatY, RepeatY);
3263
case CSSPropertyBackgroundRepeatX:
3264
HANDLE_BACKGROUND_VALUE(repeatX, RepeatX, value)
3266
case CSSPropertyBackgroundRepeatY:
3267
HANDLE_BACKGROUND_VALUE(repeatY, RepeatY, value)
3269
case CSSPropertyWebkitMaskRepeat:
3270
HANDLE_MASK_INHERIT_AND_INITIAL(repeatX, RepeatX);
3271
HANDLE_MASK_INHERIT_AND_INITIAL(repeatY, RepeatY);
3273
case CSSPropertyWebkitMaskRepeatX:
3274
HANDLE_MASK_VALUE(repeatX, RepeatX, value)
3276
case CSSPropertyWebkitMaskRepeatY:
3277
HANDLE_MASK_VALUE(repeatY, RepeatY, value)
3164
3279
case CSSPropertyBorderSpacing: {
3165
3280
if (isInherit) {
3166
3281
m_style->setHorizontalBorderSpacing(m_parentStyle->horizontalBorderSpacing());
3430
case CSSPropertyWordBreak: {
3431
HANDLE_INHERIT_AND_INITIAL(wordBreak, WordBreak)
3432
m_style->setWordBreak(*primitiveValue);
3436
case CSSPropertyWordWrap: {
3437
HANDLE_INHERIT_AND_INITIAL(wordWrap, WordWrap)
3438
m_style->setWordWrap(*primitiveValue);
3580
case CSSPropertyWordBreak:
3581
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(wordBreak, WordBreak)
3583
case CSSPropertyWordWrap:
3584
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(wordWrap, WordWrap)
3442
3586
case CSSPropertyWebkitNbspMode:
3444
HANDLE_INHERIT_AND_INITIAL(nbspMode, NBSPMode)
3445
m_style->setNBSPMode(*primitiveValue);
3587
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(nbspMode, NBSPMode)
3449
3589
case CSSPropertyWebkitLineBreak:
3451
HANDLE_INHERIT_AND_INITIAL(khtmlLineBreak, KHTMLLineBreak)
3452
m_style->setKHTMLLineBreak(*primitiveValue);
3590
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(khtmlLineBreak, KHTMLLineBreak)
3456
3592
case CSSPropertyWebkitMatchNearestMailBlockquoteColor:
3458
HANDLE_INHERIT_AND_INITIAL(matchNearestMailBlockquoteColor, MatchNearestMailBlockquoteColor)
3459
m_style->setMatchNearestMailBlockquoteColor(*primitiveValue);
3593
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(matchNearestMailBlockquoteColor, MatchNearestMailBlockquoteColor)
3463
3596
case CSSPropertyResize:
3838
3971
int type = primitiveValue->primitiveType();
3839
3972
if (primitiveValue->getIdent() == CSSValueNormal)
3840
3973
lineHeight = Length(-100.0, Percent);
3841
else if (type > CSSPrimitiveValue::CSS_PERCENTAGE && type < CSSPrimitiveValue::CSS_DEG) {
3974
else if (CSSPrimitiveValue::isUnitTypeLength(type)) {
3842
3975
double multiplier = m_style->effectiveZoom();
3843
3976
if (m_style->textSizeAdjust() && m_checker.m_document->frame() && m_checker.m_document->frame()->shouldApplyTextZoom())
3844
3977
multiplier *= m_checker.m_document->frame()->textZoomFactor();
3845
lineHeight = Length(primitiveValue->computeLengthIntForLength(style(), multiplier), Fixed);
3978
lineHeight = Length(primitiveValue->computeLengthIntForLength(style(), m_rootElementStyle, multiplier), Fixed);
3846
3979
} else if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
3847
3980
lineHeight = Length((m_style->fontSize() * primitiveValue->getIntValue()) / 100, Fixed);
3848
3981
else if (type == CSSPrimitiveValue::CSS_NUMBER)
3897
4029
Rect* rect = primitiveValue->getRectValue();
3900
top = convertToLength(rect->top(), style());
3901
right = convertToLength(rect->right(), style());
3902
bottom = convertToLength(rect->bottom(), style());
3903
left = convertToLength(rect->left(), style());
4032
top = convertToLength(rect->top(), style(), m_rootElementStyle, zoomFactor);
4033
right = convertToLength(rect->right(), style(), m_rootElementStyle, zoomFactor);
4034
bottom = convertToLength(rect->bottom(), style(), m_rootElementStyle, zoomFactor);
4035
left = convertToLength(rect->left(), style(), m_rootElementStyle, zoomFactor);
3905
4036
} else if (primitiveValue->getIdent() != CSSValueAuto) {
4016
if (!value->isValueList()) return;
4146
if (!value->isValueList())
4017
4148
FontDescription fontDescription = m_style->fontDescription();
4018
CSSValueList *list = static_cast<CSSValueList*>(value);
4149
CSSValueList* list = static_cast<CSSValueList*>(value);
4019
4150
int len = list->length();
4020
4151
FontFamily& firstFamily = fontDescription.firstFamily();
4021
FontFamily *currFamily = 0;
4152
FontFamily* currFamily = 0;
4023
4154
// Before mapping in a new font-family property, we should reset the generic family.
4024
bool oldFamilyIsMonospace = fontDescription.genericFamily() == FontDescription::MonospaceFamily;
4155
bool oldFamilyUsedFixedDefaultSize = fontDescription.useFixedDefaultSize();
4025
4156
fontDescription.setGenericFamily(FontDescription::NoFamily);
4027
4158
for (int i = 0; i < len; i++) {
4028
CSSValue *item = list->itemWithoutBoundsCheck(i);
4029
if (!item->isPrimitiveValue()) continue;
4030
CSSPrimitiveValue *val = static_cast<CSSPrimitiveValue*>(item);
4159
CSSValue* item = list->itemWithoutBoundsCheck(i);
4160
if (!item->isPrimitiveValue())
4162
CSSPrimitiveValue* val = static_cast<CSSPrimitiveValue*>(item);
4031
4163
AtomicString face;
4032
4164
Settings* settings = m_checker.m_document->settings();
4033
4165
if (val->primitiveType() == CSSPrimitiveValue::CSS_STRING)
4063
4195
if (!face.isEmpty()) {
4064
4196
if (!currFamily) {
4065
4197
// Filling in the first family.
4066
4198
firstFamily.setFamily(face);
4199
firstFamily.appendFamily(0); // Remove any inherited family-fallback list.
4067
4200
currFamily = &firstFamily;
4070
4202
RefPtr<SharedFontFamily> newFamily = SharedFontFamily::create();
4071
4203
newFamily->setFamily(face);
4072
4204
currFamily->appendFamily(newFamily);
4073
4205
currFamily = newFamily.get();
4076
if (fontDescription.keywordSize() && (fontDescription.genericFamily() == FontDescription::MonospaceFamily) != oldFamilyIsMonospace)
4077
setFontSize(fontDescription, fontSizeForKeyword(CSSValueXxSmall + fontDescription.keywordSize() - 1, m_style->htmlHacks(), !oldFamilyIsMonospace));
4079
if (m_style->setFontDescription(fontDescription))
4210
// We can't call useFixedDefaultSize() until all new font families have been added
4211
// If currFamily is non-zero then we set at least one family on this description.
4213
if (fontDescription.keywordSize() && fontDescription.useFixedDefaultSize() != oldFamilyUsedFixedDefaultSize)
4214
setFontSize(fontDescription, fontSizeForKeyword(CSSValueXxSmall + fontDescription.keywordSize() - 1, m_style->htmlHacks(), !oldFamilyUsedFixedDefaultSize));
4216
if (m_style->setFontDescription(fontDescription))
4085
4221
case CSSPropertyTextDecoration: {
4086
4222
// list of ident
4431
4574
// Fall through
4432
case CSSPropertyWebkitBorderTopLeftRadius:
4433
case CSSPropertyWebkitBorderTopRightRadius:
4434
case CSSPropertyWebkitBorderBottomLeftRadius:
4435
case CSSPropertyWebkitBorderBottomRightRadius: {
4575
case CSSPropertyBorderTopLeftRadius:
4576
case CSSPropertyBorderTopRightRadius:
4577
case CSSPropertyBorderBottomLeftRadius:
4578
case CSSPropertyBorderBottomRightRadius: {
4436
4579
if (isInherit) {
4437
HANDLE_INHERIT_COND(CSSPropertyWebkitBorderTopLeftRadius, borderTopLeftRadius, BorderTopLeftRadius)
4438
HANDLE_INHERIT_COND(CSSPropertyWebkitBorderTopRightRadius, borderTopRightRadius, BorderTopRightRadius)
4439
HANDLE_INHERIT_COND(CSSPropertyWebkitBorderBottomLeftRadius, borderBottomLeftRadius, BorderBottomLeftRadius)
4440
HANDLE_INHERIT_COND(CSSPropertyWebkitBorderBottomRightRadius, borderBottomRightRadius, BorderBottomRightRadius)
4580
HANDLE_INHERIT_COND(CSSPropertyBorderTopLeftRadius, borderTopLeftRadius, BorderTopLeftRadius)
4581
HANDLE_INHERIT_COND(CSSPropertyBorderTopRightRadius, borderTopRightRadius, BorderTopRightRadius)
4582
HANDLE_INHERIT_COND(CSSPropertyBorderBottomLeftRadius, borderBottomLeftRadius, BorderBottomLeftRadius)
4583
HANDLE_INHERIT_COND(CSSPropertyBorderBottomRightRadius, borderBottomRightRadius, BorderBottomRightRadius)
4444
4587
if (isInitial) {
4445
HANDLE_INITIAL_COND_WITH_VALUE(CSSPropertyWebkitBorderTopLeftRadius, BorderTopLeftRadius, BorderRadius)
4446
HANDLE_INITIAL_COND_WITH_VALUE(CSSPropertyWebkitBorderTopRightRadius, BorderTopRightRadius, BorderRadius)
4447
HANDLE_INITIAL_COND_WITH_VALUE(CSSPropertyWebkitBorderBottomLeftRadius, BorderBottomLeftRadius, BorderRadius)
4448
HANDLE_INITIAL_COND_WITH_VALUE(CSSPropertyWebkitBorderBottomRightRadius, BorderBottomRightRadius, BorderRadius)
4588
HANDLE_INITIAL_COND_WITH_VALUE(CSSPropertyBorderTopLeftRadius, BorderTopLeftRadius, BorderRadius)
4589
HANDLE_INITIAL_COND_WITH_VALUE(CSSPropertyBorderTopRightRadius, BorderTopRightRadius, BorderRadius)
4590
HANDLE_INITIAL_COND_WITH_VALUE(CSSPropertyBorderBottomLeftRadius, BorderBottomLeftRadius, BorderRadius)
4591
HANDLE_INITIAL_COND_WITH_VALUE(CSSPropertyBorderBottomRightRadius, BorderBottomRightRadius, BorderRadius)
4509
4652
int len = list->length();
4510
4653
for (int i = 0; i < len; i++) {
4511
4654
ShadowValue* item = static_cast<ShadowValue*>(list->itemWithoutBoundsCheck(i));
4512
int x = item->x->computeLengthInt(style(), zoomFactor);
4513
int y = item->y->computeLengthInt(style(), zoomFactor);
4514
int blur = item->blur ? item->blur->computeLengthInt(style(), zoomFactor) : 0;
4655
int x = item->x->computeLengthInt(style(), m_rootElementStyle, zoomFactor);
4656
int y = item->y->computeLengthInt(style(), m_rootElementStyle, zoomFactor);
4657
int blur = item->blur ? item->blur->computeLengthInt(style(), m_rootElementStyle, zoomFactor) : 0;
4658
int spread = item->spread ? item->spread->computeLengthInt(style(), m_rootElementStyle, zoomFactor) : 0;
4659
ShadowStyle shadowStyle = item->style && item->style->getIdent() == CSSValueInset ? Inset : Normal;
4516
4661
if (item->color)
4517
4662
color = getColorFromPrimitiveValue(item->color.get());
4518
ShadowData* shadowData = new ShadowData(x, y, blur, color.isValid() ? color : Color::transparent);
4663
ShadowData* shadowData = new ShadowData(x, y, blur, spread, shadowStyle, color.isValid() ? color : Color::transparent);
4519
4664
if (id == CSSPropertyTextShadow)
4520
4665
m_style->setTextShadow(shadowData, i != 0);
4568
4713
case CSSPropertyUnicodeRange: // Only used in @font-face rules.
4715
case CSSPropertyWebkitBackfaceVisibility:
4716
HANDLE_INHERIT_AND_INITIAL(backfaceVisibility, BackfaceVisibility)
4718
m_style->setBackfaceVisibility((primitiveValue->getIdent() == CSSValueVisible) ? BackfaceVisibilityVisible : BackfaceVisibilityHidden);
4570
4720
case CSSPropertyWebkitBoxDirection:
4571
HANDLE_INHERIT_AND_INITIAL(boxDirection, BoxDirection)
4573
m_style->setBoxDirection(*primitiveValue);
4721
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(boxDirection, BoxDirection)
4575
4723
case CSSPropertyWebkitBoxLines:
4576
HANDLE_INHERIT_AND_INITIAL(boxLines, BoxLines)
4578
m_style->setBoxLines(*primitiveValue);
4724
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(boxLines, BoxLines)
4580
4726
case CSSPropertyWebkitBoxOrient:
4581
HANDLE_INHERIT_AND_INITIAL(boxOrient, BoxOrient)
4583
m_style->setBoxOrient(*primitiveValue);
4727
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(boxOrient, BoxOrient)
4585
4729
case CSSPropertyWebkitBoxPack:
4587
4731
HANDLE_INHERIT_AND_INITIAL(boxPack, BoxPack)
4658
4802
m_style->setHasAutoColumnWidth();
4661
m_style->setColumnWidth(primitiveValue->computeLengthFloat(style(), zoomFactor));
4805
m_style->setColumnWidth(primitiveValue->computeLengthFloat(style(), m_rootElementStyle, zoomFactor));
4664
4808
case CSSPropertyWebkitColumnRuleStyle:
4665
HANDLE_INHERIT_AND_INITIAL_WITH_VALUE(columnRuleStyle, ColumnRuleStyle, BorderStyle)
4666
m_style->setColumnRuleStyle(*primitiveValue);
4668
case CSSPropertyWebkitColumnBreakBefore: {
4669
HANDLE_INHERIT_AND_INITIAL_WITH_VALUE(columnBreakBefore, ColumnBreakBefore, PageBreak)
4670
m_style->setColumnBreakBefore(*primitiveValue);
4673
case CSSPropertyWebkitColumnBreakAfter: {
4674
HANDLE_INHERIT_AND_INITIAL_WITH_VALUE(columnBreakAfter, ColumnBreakAfter, PageBreak)
4675
m_style->setColumnBreakAfter(*primitiveValue);
4809
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE_WITH_VALUE(columnRuleStyle, ColumnRuleStyle, BorderStyle)
4811
case CSSPropertyWebkitColumnBreakBefore:
4812
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE_WITH_VALUE(columnBreakBefore, ColumnBreakBefore, PageBreak)
4814
case CSSPropertyWebkitColumnBreakAfter:
4815
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE_WITH_VALUE(columnBreakAfter, ColumnBreakAfter, PageBreak)
4678
4817
case CSSPropertyWebkitColumnBreakInside: {
4679
4818
HANDLE_INHERIT_AND_INITIAL_WITH_VALUE(columnBreakInside, ColumnBreakInside, PageBreak)
4680
4819
EPageBreak pb = *primitiveValue;
4767
4912
bool ok = true;
4768
Length l = convertToLength(primitiveValue, style(), &ok);
4913
Length l = convertToLength(primitiveValue, style(), m_rootElementStyle, 1, &ok);
4770
4915
m_style->setMarqueeIncrement(l);
4774
case CSSPropertyWebkitMarqueeStyle: {
4775
HANDLE_INHERIT_AND_INITIAL(marqueeBehavior, MarqueeBehavior)
4777
m_style->setMarqueeBehavior(*primitiveValue);
4920
case CSSPropertyWapMarqueeStyle:
4922
case CSSPropertyWebkitMarqueeStyle:
4923
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(marqueeBehavior, MarqueeBehavior)
4780
case CSSPropertyWebkitMarqueeDirection: {
4926
case CSSPropertyWapMarqueeDir:
4781
4927
HANDLE_INHERIT_AND_INITIAL(marqueeDirection, MarqueeDirection)
4783
m_style->setMarqueeDirection(*primitiveValue);
4786
case CSSPropertyWebkitUserDrag: {
4787
HANDLE_INHERIT_AND_INITIAL(userDrag, UserDrag)
4789
m_style->setUserDrag(*primitiveValue);
4792
case CSSPropertyWebkitUserModify: {
4793
HANDLE_INHERIT_AND_INITIAL(userModify, UserModify)
4795
m_style->setUserModify(*primitiveValue);
4798
case CSSPropertyWebkitUserSelect: {
4799
HANDLE_INHERIT_AND_INITIAL(userSelect, UserSelect)
4801
m_style->setUserSelect(*primitiveValue);
4928
if (primitiveValue && primitiveValue->getIdent()) {
4929
switch (primitiveValue->getIdent()) {
4931
m_style->setMarqueeDirection(MRIGHT);
4934
m_style->setMarqueeDirection(MLEFT);
4937
m_style->setMarqueeDirection(*primitiveValue);
4943
case CSSPropertyWebkitMarqueeDirection:
4944
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(marqueeDirection, MarqueeDirection)
4946
case CSSPropertyWebkitUserDrag:
4947
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(userDrag, UserDrag)
4949
case CSSPropertyWebkitUserModify:
4950
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(userModify, UserModify)
4952
case CSSPropertyWebkitUserSelect:
4953
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(userSelect, UserSelect)
4804
4956
case CSSPropertyTextOverflow: {
4805
4957
// This property is supported by WinIE, and so we leave off the "-webkit-" in order to
4806
4958
// work with WinIE-specific pages that use the property.
4889
5034
DashboardRegion *first = region;
4890
5035
while (region) {
4891
Length top = convertToLength(region->top(), style());
4892
Length right = convertToLength(region->right(), style());
4893
Length bottom = convertToLength(region->bottom(), style());
4894
Length left = convertToLength(region->left(), style());
5036
Length top = convertToLength(region->top(), style(), m_rootElementStyle);
5037
Length right = convertToLength(region->right(), style(), m_rootElementStyle);
5038
Length bottom = convertToLength(region->bottom(), style(), m_rootElementStyle);
5039
Length left = convertToLength(region->left(), style(), m_rootElementStyle);
4895
5040
if (region->m_isCircle)
4896
5041
m_style->setDashboardRegion(StyleDashboardRegion::Circle, region->m_label, top, right, bottom, left, region == first ? false : true);
4897
5042
else if (region->m_isRectangle)
4935
5080
case CSSPropertyWebkitTransform: {
4936
5081
HANDLE_INHERIT_AND_INITIAL(transform, Transform);
4937
5082
TransformOperations operations;
4938
createTransformOperations(value, style(), operations);
5083
createTransformOperations(value, style(), m_rootElementStyle, operations);
4939
5084
m_style->setTransform(operations);
4942
5087
case CSSPropertyWebkitTransformOrigin:
4943
5088
HANDLE_INHERIT_AND_INITIAL(transformOriginX, TransformOriginX)
4944
5089
HANDLE_INHERIT_AND_INITIAL(transformOriginY, TransformOriginY)
5090
HANDLE_INHERIT_AND_INITIAL(transformOriginZ, TransformOriginZ)
4946
5092
case CSSPropertyWebkitTransformOriginX: {
4947
5093
HANDLE_INHERIT_AND_INITIAL(transformOriginX, TransformOriginX)
4948
5094
CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
4950
5096
int type = primitiveValue->primitiveType();
4951
if (type > CSSPrimitiveValue::CSS_PERCENTAGE && type < CSSPrimitiveValue::CSS_DEG)
4952
l = Length(primitiveValue->computeLengthIntForLength(style(), zoomFactor), Fixed);
5097
if (CSSPrimitiveValue::isUnitTypeLength(type))
5098
l = Length(primitiveValue->computeLengthIntForLength(style(), m_rootElementStyle, zoomFactor), Fixed);
4953
5099
else if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
4954
5100
l = Length(primitiveValue->getDoubleValue(), Percent);
4962
5108
CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
4964
5110
int type = primitiveValue->primitiveType();
4965
if (type > CSSPrimitiveValue::CSS_PERCENTAGE && type < CSSPrimitiveValue::CSS_DEG)
4966
l = Length(primitiveValue->computeLengthIntForLength(style(), zoomFactor), Fixed);
4967
else if(type == CSSPrimitiveValue::CSS_PERCENTAGE)
5111
if (CSSPrimitiveValue::isUnitTypeLength(type))
5112
l = Length(primitiveValue->computeLengthIntForLength(style(), m_rootElementStyle, zoomFactor), Fixed);
5113
else if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
4968
5114
l = Length(primitiveValue->getDoubleValue(), Percent);
4971
5117
m_style->setTransformOriginY(l);
5120
case CSSPropertyWebkitTransformOriginZ: {
5121
HANDLE_INHERIT_AND_INITIAL(transformOriginZ, TransformOriginZ)
5122
CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
5124
int type = primitiveValue->primitiveType();
5125
if (CSSPrimitiveValue::isUnitTypeLength(type))
5126
f = static_cast<float>(primitiveValue->computeLengthIntForLength(style(), m_rootElementStyle));
5129
m_style->setTransformOriginZ(f);
5132
case CSSPropertyWebkitTransformStyle:
5133
HANDLE_INHERIT_AND_INITIAL(transformStyle3D, TransformStyle3D)
5135
m_style->setTransformStyle3D((primitiveValue->getIdent() == CSSValuePreserve3d) ? TransformStyle3DPreserve3D : TransformStyle3DFlat);
5137
case CSSPropertyWebkitPerspective: {
5138
HANDLE_INHERIT_AND_INITIAL(perspective, Perspective)
5139
if (primitiveValue && primitiveValue->getIdent() == CSSValueNone) {
5140
m_style->setPerspective(0);
5144
float perspectiveValue;
5145
int type = primitiveValue->primitiveType();
5146
if (CSSPrimitiveValue::isUnitTypeLength(type))
5147
perspectiveValue = static_cast<float>(primitiveValue->computeLengthIntForLength(style(), m_rootElementStyle, zoomFactor));
5148
else if (type == CSSPrimitiveValue::CSS_NUMBER) {
5149
// For backward compatibility, treat valueless numbers as px.
5150
perspectiveValue = CSSPrimitiveValue::create(primitiveValue->getDoubleValue(), CSSPrimitiveValue::CSS_PX)->computeLengthFloat(style(), m_rootElementStyle, zoomFactor);
5154
if (perspectiveValue >= 0.0f)
5155
m_style->setPerspective(perspectiveValue);
5158
case CSSPropertyWebkitPerspectiveOrigin:
5159
HANDLE_INHERIT_AND_INITIAL(perspectiveOriginX, PerspectiveOriginX)
5160
HANDLE_INHERIT_AND_INITIAL(perspectiveOriginY, PerspectiveOriginY)
5162
case CSSPropertyWebkitPerspectiveOriginX: {
5163
HANDLE_INHERIT_AND_INITIAL(perspectiveOriginX, PerspectiveOriginX)
5164
CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
5166
int type = primitiveValue->primitiveType();
5167
if (CSSPrimitiveValue::isUnitTypeLength(type))
5168
l = Length(primitiveValue->computeLengthIntForLength(style(), m_rootElementStyle, zoomFactor), Fixed);
5169
else if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
5170
l = Length(primitiveValue->getDoubleValue(), Percent);
5173
m_style->setPerspectiveOriginX(l);
5176
case CSSPropertyWebkitPerspectiveOriginY: {
5177
HANDLE_INHERIT_AND_INITIAL(perspectiveOriginY, PerspectiveOriginY)
5178
CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
5180
int type = primitiveValue->primitiveType();
5181
if (CSSPrimitiveValue::isUnitTypeLength(type))
5182
l = Length(primitiveValue->computeLengthIntForLength(style(), m_rootElementStyle, zoomFactor), Fixed);
5183
else if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
5184
l = Length(primitiveValue->getDoubleValue(), Percent);
5187
m_style->setPerspectiveOriginY(l);
4974
5190
case CSSPropertyWebkitAnimation:
4976
5192
m_style->clearAnimations();
5150
5370
layer->setImage(styleImage(value));
5153
void CSSStyleSelector::mapFillRepeat(FillLayer* layer, CSSValue* value)
5155
if (value->cssValueType() == CSSValue::CSS_INITIAL) {
5156
layer->setRepeat(FillLayer::initialFillRepeat(layer->type()));
5160
if (!value->isPrimitiveValue())
5163
CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
5164
layer->setRepeat(*primitiveValue);
5373
void CSSStyleSelector::mapFillRepeatX(FillLayer* layer, CSSValue* value)
5375
if (value->cssValueType() == CSSValue::CSS_INITIAL) {
5376
layer->setRepeatX(FillLayer::initialFillRepeatX(layer->type()));
5380
if (!value->isPrimitiveValue())
5383
CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
5384
layer->setRepeatX(*primitiveValue);
5387
void CSSStyleSelector::mapFillRepeatY(FillLayer* layer, CSSValue* value)
5389
if (value->cssValueType() == CSSValue::CSS_INITIAL) {
5390
layer->setRepeatY(FillLayer::initialFillRepeatY(layer->type()));
5394
if (!value->isPrimitiveValue())
5397
CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
5398
layer->setRepeatY(*primitiveValue);
5167
5401
void CSSStyleSelector::mapFillSize(FillLayer* layer, CSSValue* value)
5169
LengthSize b = FillLayer::initialFillSize(layer->type());
5171
if (value->cssValueType() == CSSValue::CSS_INITIAL) {
5403
if (!value->isPrimitiveValue()) {
5404
layer->setSizeType(SizeNone);
5176
if (!value->isPrimitiveValue())
5179
5408
CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
5409
if (primitiveValue->getIdent() == CSSValueContain)
5410
layer->setSizeType(Contain);
5411
else if (primitiveValue->getIdent() == CSSValueCover)
5412
layer->setSizeType(Cover);
5414
layer->setSizeType(SizeLength);
5416
LengthSize b = FillLayer::initialFillSizeLength(layer->type());
5418
if (value->cssValueType() == CSSValue::CSS_INITIAL || primitiveValue->getIdent() == CSSValueContain
5419
|| primitiveValue->getIdent() == CSSValueCover) {
5420
layer->setSizeLength(b);
5180
5424
Pair* pair = primitiveValue->getPairValue();
5504
5748
// If the font uses a keyword size, then we refetch from the table rather than
5505
5749
// multiplying by our scale factor.
5507
if (childFont.keywordSize()) {
5508
size = fontSizeForKeyword(CSSValueXxSmall + childFont.keywordSize() - 1, style->htmlHacks(),
5509
childFont.genericFamily() == FontDescription::MonospaceFamily);
5751
if (childFont.keywordSize())
5752
size = fontSizeForKeyword(CSSValueXxSmall + childFont.keywordSize() - 1, style->htmlHacks(), childFont.useFixedDefaultSize());
5511
5754
Settings* settings = m_checker.m_document->settings();
5512
5755
float fixedScaleFactor = settings
5513
5756
? static_cast<float>(settings->defaultFixedFontSize()) / settings->defaultFontSize()
5515
size = (parentFont.genericFamily() == FontDescription::MonospaceFamily) ?
5516
childFont.specifiedSize()/fixedScaleFactor :
5517
childFont.specifiedSize()*fixedScaleFactor;
5758
size = parentFont.useFixedDefaultSize() ?
5759
childFont.specifiedSize() / fixedScaleFactor :
5760
childFont.specifiedSize() * fixedScaleFactor;
5520
5763
FontDescription newFontDescription(childFont);
5748
5991
for (Node* node = m_document; node; node = node->traverseNextNode()) {
5749
5992
const AtomicString* attr = linkAttribute(node);
5750
5993
if (attr && visitedLinkHash(m_document->baseURL(), *attr) == visitedHash)
5994
node->setNeedsStyleRecalc();
5755
TransformOperation::OperationType getTransformOperationType(WebKitCSSTransformValue::TransformOperationType type)
5998
static TransformOperation::OperationType getTransformOperationType(WebKitCSSTransformValue::TransformOperationType type)
5757
6000
switch (type) {
5758
6001
case WebKitCSSTransformValue::ScaleTransformOperation: return TransformOperation::SCALE;
5759
6002
case WebKitCSSTransformValue::ScaleXTransformOperation: return TransformOperation::SCALE_X;
5760
6003
case WebKitCSSTransformValue::ScaleYTransformOperation: return TransformOperation::SCALE_Y;
6004
case WebKitCSSTransformValue::ScaleZTransformOperation: return TransformOperation::SCALE_Z;
6005
case WebKitCSSTransformValue::Scale3DTransformOperation: return TransformOperation::SCALE_3D;
5761
6006
case WebKitCSSTransformValue::TranslateTransformOperation: return TransformOperation::TRANSLATE;
5762
6007
case WebKitCSSTransformValue::TranslateXTransformOperation: return TransformOperation::TRANSLATE_X;
5763
6008
case WebKitCSSTransformValue::TranslateYTransformOperation: return TransformOperation::TRANSLATE_Y;
6009
case WebKitCSSTransformValue::TranslateZTransformOperation: return TransformOperation::TRANSLATE_Z;
6010
case WebKitCSSTransformValue::Translate3DTransformOperation: return TransformOperation::TRANSLATE_3D;
5764
6011
case WebKitCSSTransformValue::RotateTransformOperation: return TransformOperation::ROTATE;
6012
case WebKitCSSTransformValue::RotateXTransformOperation: return TransformOperation::ROTATE_X;
6013
case WebKitCSSTransformValue::RotateYTransformOperation: return TransformOperation::ROTATE_Y;
6014
case WebKitCSSTransformValue::RotateZTransformOperation: return TransformOperation::ROTATE_Z;
6015
case WebKitCSSTransformValue::Rotate3DTransformOperation: return TransformOperation::ROTATE_3D;
5765
6016
case WebKitCSSTransformValue::SkewTransformOperation: return TransformOperation::SKEW;
5766
6017
case WebKitCSSTransformValue::SkewXTransformOperation: return TransformOperation::SKEW_X;
5767
6018
case WebKitCSSTransformValue::SkewYTransformOperation: return TransformOperation::SKEW_Y;
5768
6019
case WebKitCSSTransformValue::MatrixTransformOperation: return TransformOperation::MATRIX;
6020
case WebKitCSSTransformValue::Matrix3DTransformOperation: return TransformOperation::MATRIX_3D;
6021
case WebKitCSSTransformValue::PerspectiveTransformOperation: return TransformOperation::PERSPECTIVE;
5769
6022
case WebKitCSSTransformValue::UnknownTransformOperation: return TransformOperation::NONE;
5771
6024
return TransformOperation::NONE;
5774
bool CSSStyleSelector::createTransformOperations(CSSValue* inValue, RenderStyle* inStyle, TransformOperations& outOperations)
6027
bool CSSStyleSelector::createTransformOperations(CSSValue* inValue, RenderStyle* style, RenderStyle* rootStyle, TransformOperations& outOperations)
6029
float zoomFactor = style ? style->effectiveZoom() : 1;
5776
6031
TransformOperations operations;
5777
6032
if (inValue && !inValue->isPrimitiveValue()) {
5778
6033
CSSValueList* list = static_cast<CSSValueList*>(inValue);
5803
operations.operations().append(ScaleTransformOperation::create(sx, sy, getTransformOperationType(val->operationType())));
6058
operations.operations().append(ScaleTransformOperation::create(sx, sy, 1.0, getTransformOperationType(val->operationType())));
6061
case WebKitCSSTransformValue::ScaleZTransformOperation:
6062
case WebKitCSSTransformValue::Scale3DTransformOperation: {
6066
if (val->operationType() == WebKitCSSTransformValue::ScaleZTransformOperation)
6067
sz = firstValue->getDoubleValue();
6068
else if (val->operationType() == WebKitCSSTransformValue::ScaleYTransformOperation)
6069
sy = firstValue->getDoubleValue();
6071
sx = firstValue->getDoubleValue();
6072
if (val->operationType() != WebKitCSSTransformValue::ScaleXTransformOperation) {
6073
if (val->length() > 2) {
6074
CSSPrimitiveValue* thirdValue = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(2));
6075
sz = thirdValue->getDoubleValue();
6077
if (val->length() > 1) {
6078
CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(1));
6079
sy = secondValue->getDoubleValue();
6084
operations.operations().append(ScaleTransformOperation::create(sx, sy, sz, getTransformOperationType(val->operationType())));
5806
6087
case WebKitCSSTransformValue::TranslateTransformOperation:
5810
6091
Length tx = Length(0, Fixed);
5811
6092
Length ty = Length(0, Fixed);
5812
6093
if (val->operationType() == WebKitCSSTransformValue::TranslateYTransformOperation)
5813
ty = convertToLength(firstValue, inStyle, &ok);
5815
tx = convertToLength(firstValue, inStyle, &ok);
5816
if (val->operationType() != WebKitCSSTransformValue::TranslateXTransformOperation) {
5817
if (val->length() > 1) {
5818
CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(1));
5819
ty = convertToLength(secondValue, inStyle, &ok);
5827
operations.operations().append(TranslateTransformOperation::create(tx, ty, getTransformOperationType(val->operationType())));
6094
ty = convertToLength(firstValue, style, rootStyle, zoomFactor, &ok);
6096
tx = convertToLength(firstValue, style, rootStyle, zoomFactor, &ok);
6097
if (val->operationType() != WebKitCSSTransformValue::TranslateXTransformOperation) {
6098
if (val->length() > 1) {
6099
CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(1));
6100
ty = convertToLength(secondValue, style, rootStyle, zoomFactor, &ok);
6108
operations.operations().append(TranslateTransformOperation::create(tx, ty, Length(0, Fixed), getTransformOperationType(val->operationType())));
6111
case WebKitCSSTransformValue::TranslateZTransformOperation:
6112
case WebKitCSSTransformValue::Translate3DTransformOperation: {
6114
Length tx = Length(0, Fixed);
6115
Length ty = Length(0, Fixed);
6116
Length tz = Length(0, Fixed);
6117
if (val->operationType() == WebKitCSSTransformValue::TranslateZTransformOperation)
6118
tz = convertToLength(firstValue, style, rootStyle, zoomFactor, &ok);
6119
else if (val->operationType() == WebKitCSSTransformValue::TranslateYTransformOperation)
6120
ty = convertToLength(firstValue, style, rootStyle, zoomFactor, &ok);
6122
tx = convertToLength(firstValue, style, rootStyle, zoomFactor, &ok);
6123
if (val->operationType() != WebKitCSSTransformValue::TranslateXTransformOperation) {
6124
if (val->length() > 2) {
6125
CSSPrimitiveValue* thirdValue = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(2));
6126
tz = convertToLength(thirdValue, style, rootStyle, zoomFactor, &ok);
6128
if (val->length() > 1) {
6129
CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(1));
6130
ty = convertToLength(secondValue, style, rootStyle, zoomFactor, &ok);
6138
operations.operations().append(TranslateTransformOperation::create(tx, ty, tz, getTransformOperationType(val->operationType())));
5830
6141
case WebKitCSSTransformValue::RotateTransformOperation: {
5836
6147
else if (firstValue->primitiveType() == CSSPrimitiveValue::CSS_TURN)
5837
6148
angle = turn2deg(angle);
5839
operations.operations().append(RotateTransformOperation::create(angle, getTransformOperationType(val->operationType())));
6150
operations.operations().append(RotateTransformOperation::create(0, 0, 1, angle, getTransformOperationType(val->operationType())));
6153
case WebKitCSSTransformValue::RotateXTransformOperation:
6154
case WebKitCSSTransformValue::RotateYTransformOperation:
6155
case WebKitCSSTransformValue::RotateZTransformOperation: {
6159
double angle = firstValue->getDoubleValue();
6160
if (firstValue->primitiveType() == CSSPrimitiveValue::CSS_RAD)
6161
angle = rad2deg(angle);
6162
else if (firstValue->primitiveType() == CSSPrimitiveValue::CSS_GRAD)
6163
angle = grad2deg(angle);
6165
if (val->operationType() == WebKitCSSTransformValue::RotateXTransformOperation)
6167
else if (val->operationType() == WebKitCSSTransformValue::RotateYTransformOperation)
6171
operations.operations().append(RotateTransformOperation::create(x, y, z, angle, getTransformOperationType(val->operationType())));
6174
case WebKitCSSTransformValue::Rotate3DTransformOperation: {
6175
CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(1));
6176
CSSPrimitiveValue* thirdValue = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(2));
6177
CSSPrimitiveValue* fourthValue = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(3));
6178
double x = firstValue->getDoubleValue();
6179
double y = secondValue->getDoubleValue();
6180
double z = thirdValue->getDoubleValue();
6181
double angle = fourthValue->getDoubleValue();
6182
if (fourthValue->primitiveType() == CSSPrimitiveValue::CSS_RAD)
6183
angle = rad2deg(angle);
6184
else if (fourthValue->primitiveType() == CSSPrimitiveValue::CSS_GRAD)
6185
angle = grad2deg(angle);
6186
operations.operations().append(RotateTransformOperation::create(x, y, z, angle, getTransformOperationType(val->operationType())));
5842
6189
case WebKitCSSTransformValue::SkewTransformOperation:
5874
6221
case WebKitCSSTransformValue::MatrixTransformOperation: {
5875
float a = firstValue->getFloatValue();
5876
float b = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(1))->getFloatValue();
5877
float c = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(2))->getFloatValue();
5878
float d = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(3))->getFloatValue();
5879
float e = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(4))->getFloatValue();
5880
float f = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(5))->getFloatValue();
6222
double a = firstValue->getDoubleValue();
6223
double b = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(1))->getDoubleValue();
6224
double c = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(2))->getDoubleValue();
6225
double d = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(3))->getDoubleValue();
6226
double e = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(4))->getDoubleValue();
6227
double f = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(5))->getDoubleValue();
5881
6228
operations.operations().append(MatrixTransformOperation::create(a, b, c, d, e, f));
6231
case WebKitCSSTransformValue::Matrix3DTransformOperation: {
6232
TransformationMatrix matrix(static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(0))->getDoubleValue(),
6233
static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(1))->getDoubleValue(),
6234
static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(2))->getDoubleValue(),
6235
static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(3))->getDoubleValue(),
6236
static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(4))->getDoubleValue(),
6237
static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(5))->getDoubleValue(),
6238
static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(6))->getDoubleValue(),
6239
static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(7))->getDoubleValue(),
6240
static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(8))->getDoubleValue(),
6241
static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(9))->getDoubleValue(),
6242
static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(10))->getDoubleValue(),
6243
static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(11))->getDoubleValue(),
6244
static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(12))->getDoubleValue(),
6245
static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(13))->getDoubleValue(),
6246
static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(14))->getDoubleValue(),
6247
static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(15))->getDoubleValue());
6248
operations.operations().append(Matrix3DTransformOperation::create(matrix));
6251
case WebKitCSSTransformValue::PerspectiveTransformOperation: {
6252
double p = firstValue->getDoubleValue();
6255
operations.operations().append(PerspectiveTransformOperation::create(p));
5884
6258
case WebKitCSSTransformValue::UnknownTransformOperation:
5885
6259
ASSERT_NOT_REACHED();