~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to src/3rdparty/webkit/WebCore/css/CSSStyleSelector.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2009-11-02 18:30:08 UTC
  • mfrom: (1.2.2 upstream)
  • mto: (15.2.5 experimental)
  • mto: This revision was merged to the branch mainline in revision 88.
  • Revision ID: james.westby@ubuntu.com-20091102183008-b6a4gcs128mvfb3m
Tags: upstream-4.6.0~beta1
ImportĀ upstreamĀ versionĀ 4.6.0~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3
3
 *           (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
4
4
 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
5
 
 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
 
5
 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
6
6
 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
7
7
 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
8
 
 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
 
8
 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
9
9
 *
10
10
 * This library is free software; you can redistribute it and/or
11
11
 * modify it under the terms of the GNU Library General Public
62
62
#include "HTMLNames.h"
63
63
#include "HTMLTextAreaElement.h"
64
64
#include "LinkHash.h"
 
65
#include "MappedAttribute.h"
65
66
#include "MatrixTransformOperation.h"
 
67
#include "Matrix3DTransformOperation.h"
66
68
#include "MediaList.h"
67
69
#include "MediaQueryEvaluator.h"
68
70
#include "NodeRenderStyle.h"
69
71
#include "Page.h"
70
72
#include "PageGroup.h"
71
73
#include "Pair.h"
 
74
#include "PerspectiveTransformOperation.h"
72
75
#include "Rect.h"
73
76
#include "RenderScrollbar.h"
74
77
#include "RenderScrollbarTheme.h"
 
78
#include "RenderStyleConstants.h"
75
79
#include "RenderTheme.h"
76
80
#include "RotateTransformOperation.h"
77
81
#include "ScaleTransformOperation.h"
83
87
#include "StyleGeneratedImage.h"
84
88
#include "StyleSheetList.h"
85
89
#include "Text.h"
 
90
#include "TransformationMatrix.h"
86
91
#include "TranslateTransformOperation.h"
87
92
#include "UserAgentStyleSheets.h"
88
93
#include "WebKitCSSKeyframeRule.h"
138
143
    return;\
139
144
}
140
145
 
 
146
#define HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(prop, Prop) \
 
147
HANDLE_INHERIT_AND_INITIAL(prop, Prop) \
 
148
if (primitiveValue) \
 
149
    m_style->set##Prop(*primitiveValue);
 
150
 
 
151
#define HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE_WITH_VALUE(prop, Prop, Value) \
 
152
HANDLE_INHERIT_AND_INITIAL_WITH_VALUE(prop, Prop, Value) \
 
153
if (primitiveValue) \
 
154
    m_style->set##Prop(*primitiveValue);
 
155
 
141
156
#define HANDLE_FILL_LAYER_INHERIT_AND_INITIAL(layerType, LayerType, prop, Prop) \
142
157
if (isInherit) { \
143
158
    FillLayer* currChild = m_style->access##LayerType##Layers(); \
374
389
static void loadFullDefaultStyle();
375
390
static void loadSimpleDefaultStyle();
376
391
// FIXME: It would be nice to use some mechanism that guarantees this is in sync with the real UA stylesheet.
377
 
static const char* simpleUserAgentStyleSheet = "html,body,div{display:block}body{margin:8px}div:focus,span:focus{outline:auto 5px -webkit-focus-ring-color}";
 
392
static const char* simpleUserAgentStyleSheet = "html,body,div{display:block}body{margin:8px}div:focus,span:focus{outline:auto 5px -webkit-focus-ring-color}a:-webkit-any-link{color:-webkit-link;text-decoration:underline}a:-webkit-any-link:active{color:-webkit-activelink}";
378
393
 
379
394
static bool elementCanUseSimpleDefaultStyle(Element* e)
380
395
{
381
 
    return e->hasTagName(htmlTag) || e->hasTagName(bodyTag) || e->hasTagName(divTag) || e->hasTagName(spanTag) || e->hasTagName(brTag);
 
396
    return e->hasTagName(htmlTag) || e->hasTagName(bodyTag) || e->hasTagName(divTag) || e->hasTagName(spanTag) || e->hasTagName(brTag) || e->hasTagName(aTag);
382
397
}
383
398
 
384
399
static const MediaQueryEvaluator& screenEval()
393
408
    return staticPrintEval;
394
409
}
395
410
 
396
 
CSSStyleSelector::CSSStyleSelector(Document* doc, const String& userStyleSheet, StyleSheetList* styleSheets, CSSStyleSheet* mappedElementSheet, bool strictParsing, bool matchAuthorAndUserStyles)
 
411
CSSStyleSelector::CSSStyleSelector(Document* doc, StyleSheetList* styleSheets, CSSStyleSheet* mappedElementSheet,
 
412
                                   CSSStyleSheet* pageUserSheet, const Vector<RefPtr<CSSStyleSheet> >* pageGroupUserSheets,
 
413
                                   bool strictParsing, bool matchAuthorAndUserStyles)
397
414
    : m_backgroundData(BackgroundFillLayer)
398
415
    , m_checker(doc, strictParsing)
399
416
    , m_fontSelector(CSSFontSelector::create(doc))
434
451
    }
435
452
 
436
453
    // FIXME: This sucks! The user sheet is reparsed every time!
437
 
    if (!userStyleSheet.isEmpty()) {
438
 
        m_userSheet = CSSStyleSheet::create(doc);
439
 
        m_userSheet->parseString(userStyleSheet, strictParsing);
440
 
 
 
454
    if (pageUserSheet || pageGroupUserSheets) {
441
455
        m_userStyle = new CSSRuleSet();
442
 
        m_userStyle->addRulesFromSheet(m_userSheet.get(), *m_medium, this);
 
456
        if (pageUserSheet)
 
457
            m_userStyle->addRulesFromSheet(pageUserSheet, *m_medium, this);
 
458
        if (pageGroupUserSheets) {
 
459
            unsigned length = pageGroupUserSheets->size();
 
460
            for (unsigned i = 0; i < length; i++)
 
461
                m_userStyle->addRulesFromSheet(pageGroupUserSheets->at(i).get(), *m_medium, this);
 
462
        }
443
463
    }
444
464
 
445
465
    // add stylesheets from document
511
531
    }
512
532
 
513
533
    // Strict-mode rules.
514
 
    String defaultRules = String(html4UserAgentStyleSheet, sizeof(html4UserAgentStyleSheet)) + theme()->extraDefaultStyleSheet();
 
534
    String defaultRules = String(htmlUserAgentStyleSheet, sizeof(htmlUserAgentStyleSheet)) + RenderTheme::defaultTheme()->extraDefaultStyleSheet();
515
535
    CSSStyleSheet* defaultSheet = parseUASheet(defaultRules);
516
536
    defaultStyle->addRulesFromSheet(defaultSheet, screenEval());
517
537
    defaultPrintStyle->addRulesFromSheet(defaultSheet, printEval());
518
538
 
519
539
    // Quirks-mode rules.
520
 
    String quirksRules = String(quirksUserAgentStyleSheet, sizeof(quirksUserAgentStyleSheet)) + theme()->extraQuirksStyleSheet();
 
540
    String quirksRules = String(quirksUserAgentStyleSheet, sizeof(quirksUserAgentStyleSheet)) + RenderTheme::defaultTheme()->extraQuirksStyleSheet();
521
541
    CSSStyleSheet* quirksSheet = parseUASheet(quirksRules);
522
542
    defaultQuirksStyle->addRulesFromSheet(quirksSheet, screenEval());
523
543
}
687
707
            
688
708
            // If we're matching normal rules, set a pseudo bit if 
689
709
            // we really just matched a pseudo-element.
690
 
            if (m_dynamicPseudo != RenderStyle::NOPSEUDO && m_checker.m_pseudoStyle == RenderStyle::NOPSEUDO) {
 
710
            if (m_dynamicPseudo != NOPSEUDO && m_checker.m_pseudoStyle == NOPSEUDO) {
691
711
                if (m_checker.m_collectRulesOnly)
692
712
                    return;
693
 
                if (m_dynamicPseudo < RenderStyle::FIRST_INTERNAL_PSEUDOID)
 
713
                if (m_dynamicPseudo < FIRST_INTERNAL_PSEUDOID)
694
714
                    m_style->setHasPseudoStyle(m_dynamicPseudo);
695
715
            } else {
696
716
                // Update our first/last rule indices in the matched rules array.
705
725
    }
706
726
}
707
727
 
708
 
bool operator >(CSSRuleData& r1, CSSRuleData& r2)
 
728
static bool operator >(CSSRuleData& r1, CSSRuleData& r2)
709
729
{
710
730
    int spec1 = r1.selector()->specificity();
711
731
    int spec2 = r2.selector()->specificity();
712
732
    return (spec1 == spec2) ? r1.position() > r2.position() : spec1 > spec2; 
713
733
}
714
 
bool operator <=(CSSRuleData& r1, CSSRuleData& r2)
 
734
    
 
735
static bool operator <=(CSSRuleData& r1, CSSRuleData& r2)
715
736
{
716
737
    return !(r1 > r2);
717
738
}
756
777
    // We have to merge sort.  Ensure our merge buffer is big enough to hold
757
778
    // all the items.
758
779
    Vector<CSSRuleData*> rulesMergeBuffer;
759
 
    rulesMergeBuffer.reserveCapacity(end - start); 
 
780
    rulesMergeBuffer.reserveInitialCapacity(end - start); 
760
781
 
761
782
    unsigned i1 = start;
762
783
    unsigned i2 = mid;
790
811
    pseudoState = PseudoUnknown;
791
812
}
792
813
 
793
 
void CSSStyleSelector::initForStyleResolve(Element* e, RenderStyle* parentStyle, RenderStyle::PseudoId pseudoID)
 
814
void CSSStyleSelector::initForStyleResolve(Element* e, RenderStyle* parentStyle, PseudoId pseudoID)
794
815
{
795
816
    m_checker.m_pseudoStyle = pseudoID;
796
817
 
806
827
    else
807
828
        m_parentStyle = m_parentNode ? m_parentNode->renderStyle() : 0;
808
829
 
 
830
    Node* docElement = e ? e->document()->documentElement() : 0;
 
831
    RenderStyle* docStyle = m_checker.m_document->renderStyle();
 
832
    m_rootElementStyle = docElement && e != docElement ? docElement->renderStyle() : docStyle;
 
833
 
809
834
    m_style = 0;
810
835
 
811
836
    m_matchedDecls.clear();
848
873
    : m_document(document)
849
874
    , m_strictParsing(strictParsing)
850
875
    , m_collectRulesOnly(false)
851
 
    , m_pseudoStyle(RenderStyle::NOPSEUDO)
 
876
    , m_pseudoStyle(NOPSEUDO)
852
877
    , m_documentIsHTML(document->isHTMLDocument())
853
878
{
854
879
}
862
887
    if (!checkVisited)
863
888
        return PseudoAnyLink;
864
889
 
865
 
    Frame* frame = m_document->frame();
866
 
    if (!frame)
867
 
        return PseudoLink;
868
 
 
869
 
    Page* page = frame->page();
870
 
    if (!page)
871
 
        return PseudoLink;
872
 
 
 
890
#if PLATFORM(QT)
873
891
    Vector<UChar, 512> url;
874
892
    visitedURL(m_document->baseURL(), *attr, url);
875
893
    if (url.isEmpty())
876
894
        return PseudoLink;
877
895
 
878
 
#if PLATFORM(QT)
879
896
    // If the Qt4.4 interface for the history is used, we will have to fallback
880
897
    // to the old global history.
881
898
    QWebHistoryInterface* iface = QWebHistoryInterface::defaultInterface();
882
899
    if (iface)
883
900
        return iface->historyContains(QString(reinterpret_cast<QChar*>(url.data()), url.size())) ? PseudoVisited : PseudoLink;
884
 
#endif
885
901
 
886
902
    LinkHash hash = visitedLinkHash(url.data(), url.size());
887
903
    if (!hash)
888
904
        return PseudoLink;
 
905
#else
 
906
    LinkHash hash = visitedLinkHash(m_document->baseURL(), *attr);
 
907
    if (!hash)
 
908
        return PseudoLink;
 
909
#endif
 
910
 
 
911
    Frame* frame = m_document->frame();
 
912
    if (!frame)
 
913
        return PseudoLink;
 
914
 
 
915
    Page* page = frame->page();
 
916
    if (!page)
 
917
        return PseudoLink;
 
918
 
889
919
    m_linksCheckedForVisitedState.add(hash);
890
920
    return page->group().isLinkVisited(hash) ? PseudoVisited : PseudoLink;
891
921
}
893
923
bool CSSStyleSelector::SelectorChecker::checkSelector(CSSSelector* sel, Element* element) const
894
924
{
895
925
    pseudoState = PseudoUnknown;
896
 
    RenderStyle::PseudoId dynamicPseudo = RenderStyle::NOPSEUDO;
 
926
    PseudoId dynamicPseudo = NOPSEUDO;
897
927
 
898
928
    return checkSelector(sel, element, 0, dynamicPseudo, true, false) == SelectorMatches;
899
929
}
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())
959
 
                return false;
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()))
964
 
                return false;
965
 
            
 
987
            bool isControl = s->isFormControlElement();
 
988
            if (isControl != m_element->isFormControlElement())
 
989
                return false;
 
990
            if (isControl) {
 
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()))
 
997
                    return false;
 
998
                } else
 
999
                    return false;
 
1000
 
 
1001
                if (s->isEnabledFormControl() != m_element->isEnabledFormControl())
 
1002
                    return false;
 
1003
 
 
1004
                if (s->isDefaultButtonForForm() != m_element->isDefaultButtonForForm())
 
1005
                    return false;
 
1006
 
 
1007
                if ((s->willValidate() && s->isValidFormControlElement()) !=
 
1008
                    (m_element->willValidate() && m_element->isValidFormControlElement()))
 
1009
                    return false;
 
1010
            }
 
1011
 
966
1012
            if (style->transitions() || style->animations())
967
1013
                return false;
968
1014
 
1093
1139
    }
1094
1140
#endif
1095
1141
 
 
1142
#if ENABLE(MATHML)
 
1143
    static bool loadedMathMLUserAgentSheet;
 
1144
    if (e->isMathMLElement() && !loadedMathMLUserAgentSheet) {
 
1145
        // MathML rules.
 
1146
        loadedMathMLUserAgentSheet = true;
 
1147
        CSSStyleSheet* mathMLSheet = parseUASheet(mathmlUserAgentStyleSheet, sizeof(mathmlUserAgentStyleSheet));
 
1148
        defaultStyle->addRulesFromSheet(mathMLSheet, screenEval());
 
1149
        defaultPrintStyle->addRulesFromSheet(mathMLSheet, printEval());
 
1150
    }
 
1151
#endif
 
1152
 
1096
1153
#if ENABLE(WML)
1097
1154
    static bool loadedWMLUserAgentSheet;
1098
1155
    if (e->isWMLElement() && !loadedWMLUserAgentSheet) {
1108
1165
    static bool loadedMediaStyleSheet;
1109
1166
    if (!loadedMediaStyleSheet && (e->hasTagName(videoTag) || e->hasTagName(audioTag))) {
1110
1167
        loadedMediaStyleSheet = true;
1111
 
        String mediaRules = String(mediaControlsUserAgentStyleSheet, sizeof(mediaControlsUserAgentStyleSheet)) + theme()->extraMediaControlsStyleSheet();
 
1168
        String mediaRules = String(mediaControlsUserAgentStyleSheet, sizeof(mediaControlsUserAgentStyleSheet)) + RenderTheme::defaultTheme()->extraMediaControlsStyleSheet();
1112
1169
        CSSStyleSheet* mediaControlsSheet = parseUASheet(mediaRules);
1113
1170
        defaultStyle->addRulesFromSheet(mediaControlsSheet, screenEval());
1114
1171
        defaultPrintStyle->addRulesFromSheet(mediaControlsSheet, printEval());
1226
1283
        m_style->setPseudoState(pseudoState);
1227
1284
 
1228
1285
    // If we have first-letter pseudo style, do not share this style
1229
 
    if (m_style->hasPseudoStyle(RenderStyle::FIRST_LETTER))
 
1286
    if (m_style->hasPseudoStyle(FIRST_LETTER))
1230
1287
        m_style->setUnique();
1231
1288
 
1232
1289
    // Now return the style.
1284
1341
 
1285
1342
        // Add all the animating properties to the list
1286
1343
        CSSMutableStyleDeclaration::const_iterator end = kf->style()->end();
1287
 
        for (CSSMutableStyleDeclaration::const_iterator it = kf->style()->begin(); it != end; ++it)
1288
 
            list.addProperty((*it).id());
 
1344
        for (CSSMutableStyleDeclaration::const_iterator it = kf->style()->begin(); it != end; ++it) {
 
1345
            int property = (*it).id();
 
1346
            // Timing-function within keyframes is special, because it is not animated; it just
 
1347
            // describes the timing function between this keyframe and the next.
 
1348
            if (property != CSSPropertyWebkitAnimationTimingFunction)
 
1349
                list.addProperty(property);
 
1350
        }
1289
1351
        
1290
1352
        // Add this keyframe style to all the indicated key times
1291
1353
        Vector<float> keys;
1308
1370
        list.clear();
1309
1371
}
1310
1372
 
1311
 
PassRefPtr<RenderStyle> CSSStyleSelector::pseudoStyleForElement(RenderStyle::PseudoId pseudo, Element* e, RenderStyle* parentStyle)
 
1373
PassRefPtr<RenderStyle> CSSStyleSelector::pseudoStyleForElement(PseudoId pseudo, Element* e, RenderStyle* parentStyle)
1312
1374
{
1313
1375
    if (!e)
1314
1376
        return 0;
1375
1437
    return m_style.release();
1376
1438
}
1377
1439
 
 
1440
#if ENABLE(DATAGRID)
 
1441
 
 
1442
PassRefPtr<RenderStyle> CSSStyleSelector::pseudoStyleForDataGridColumn(DataGridColumn*, RenderStyle*)
 
1443
{
 
1444
    // FIXME: Implement
 
1445
    return 0;
 
1446
}
 
1447
 
 
1448
PassRefPtr<RenderStyle> CSSStyleSelector::pseudoStyleForDataGridColumnHeader(DataGridColumn*, RenderStyle*)
 
1449
{
 
1450
    // FIXME: Implement
 
1451
    return 0;
 
1452
}
 
1453
 
 
1454
#endif
 
1455
 
1378
1456
static void addIntrinsicMargins(RenderStyle* style)
1379
1457
{
1380
1458
    // Intrinsic margin value.
1442
1520
        // Table headers with a text-align of auto will change the text-align to center.
1443
1521
        if (e && e->hasTagName(thTag) && style->textAlign() == TAAUTO)
1444
1522
            style->setTextAlign(CENTER);
1445
 
        
 
1523
 
 
1524
        if (e && e->hasTagName(legendTag))
 
1525
            style->setDisplay(BLOCK);
 
1526
 
1446
1527
        // Mutate the display to BLOCK or TABLE for certain cases, e.g., if someone attempts to
1447
1528
        // position or float an inline, compact, or run-in.  Cache the original display, since it
1448
1529
        // may be needed for positioned elements that have to compute their static normal flow
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);
1486
1567
    
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)
1493
1575
#endif
1494
1576
       )) {
1495
1577
        if (style->width().isAuto())
1496
1578
            style->setWidth(Length(Intrinsic));
 
1579
 
 
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());
 
1584
        }
1497
1585
    }
1498
1586
 
1499
1587
    // Finally update our text decorations in effect, but don't allow text-decoration to percolate through
1540
1628
 
1541
1629
    // Important: Intrinsic margins get added to controls before the theme has adjusted the style, since the theme will
1542
1630
    // alter fonts and heights/widths.
1543
 
    if (e && e->isControl() && style->fontSize() >= 11) {
 
1631
    if (e && e->isFormControlElement() && style->fontSize() >= 11) {
1544
1632
        // Don't apply intrinsic margins to image buttons.  The designer knows how big the images are,
1545
1633
        // so we have to treat all image buttons as though they were explicitly sized.
1546
1634
        if (!e->hasTagName(inputTag) || static_cast<HTMLInputElement*>(e)->inputType() != HTMLInputElement::IMAGE)
1549
1637
 
1550
1638
    // Let the theme also have a crack at adjusting the style.
1551
1639
    if (style->hasAppearance())
1552
 
        theme()->adjustStyle(this, style, e, m_hasUAAppearance, m_borderData, m_backgroundData, m_backgroundColor);
 
1640
        RenderTheme::defaultTheme()->adjustStyle(this, style, e, m_hasUAAppearance, m_borderData, m_backgroundData, m_backgroundColor);
1553
1641
 
1554
1642
#if ENABLE(SVG)
1555
1643
    if (e && e->isSVGElement()) {
1631
1719
 
1632
1720
bool CSSStyleSelector::checkSelector(CSSSelector* sel)
1633
1721
{
1634
 
    m_dynamicPseudo = RenderStyle::NOPSEUDO;
 
1722
    m_dynamicPseudo = NOPSEUDO;
1635
1723
 
1636
1724
    // Check the selector
1637
1725
    SelectorMatch match = m_checker.checkSelector(sel, m_element, &m_selectorAttrs, m_dynamicPseudo, true, false, style(), m_parentStyle);
1638
1726
    if (match != SelectorMatches)
1639
1727
        return false;
1640
1728
 
1641
 
    if (m_checker.m_pseudoStyle != RenderStyle::NOPSEUDO && m_checker.m_pseudoStyle != m_dynamicPseudo)
 
1729
    if (m_checker.m_pseudoStyle != NOPSEUDO && m_checker.m_pseudoStyle != m_dynamicPseudo)
1642
1730
        return false;
1643
1731
 
1644
1732
    return true;
1649
1737
// * SelectorMatches         - the selector matches the element e
1650
1738
// * SelectorFailsLocally    - the selector fails for the element e
1651
1739
// * SelectorFailsCompletely - the selector fails for e and any sibling or ancestor of e
1652
 
CSSStyleSelector::SelectorMatch CSSStyleSelector::SelectorChecker::checkSelector(CSSSelector* sel, Element* e, HashSet<AtomicStringImpl*>* selectorAttrs, RenderStyle::PseudoId& dynamicPseudo, bool isAncestor, bool isSubSelector, RenderStyle* elementStyle, RenderStyle* elementParentStyle) const
 
1740
CSSStyleSelector::SelectorMatch CSSStyleSelector::SelectorChecker::checkSelector(CSSSelector* sel, Element* e, HashSet<AtomicStringImpl*>* selectorAttrs, PseudoId& dynamicPseudo, bool isAncestor, bool isSubSelector, RenderStyle* elementStyle, RenderStyle* elementParentStyle) const
1653
1741
{
1654
1742
#if ENABLE(SVG)
1655
1743
    // Spec: CSS2 selectors cannot be applied to the (conceptually) cloned DOM tree
1672
1760
 
1673
1761
    if (relation != CSSSelector::SubSelector)
1674
1762
        // Bail-out if this selector is irrelevant for the pseudoStyle
1675
 
        if (m_pseudoStyle != RenderStyle::NOPSEUDO && m_pseudoStyle != dynamicPseudo)
 
1763
        if (m_pseudoStyle != NOPSEUDO && m_pseudoStyle != dynamicPseudo)
1676
1764
            return SelectorFailsCompletely;
1677
1765
 
1678
1766
    switch (relation) {
1732
1820
            // a selector is invalid if something follows a pseudo-element
1733
1821
            // We make an exception for scrollbar pseudo elements and allow a set of pseudo classes (but nothing else)
1734
1822
            // to follow the pseudo elements.
1735
 
            if (elementStyle && dynamicPseudo != RenderStyle::NOPSEUDO && 
1736
 
                !((RenderScrollbar::scrollbarForStyleResolve() || dynamicPseudo == RenderStyle::SCROLLBAR_CORNER || dynamicPseudo == RenderStyle::RESIZER) && sel->m_match == CSSSelector::PseudoClass))
 
1823
            if (elementStyle && dynamicPseudo != NOPSEUDO && dynamicPseudo != SELECTION &&
 
1824
                !((RenderScrollbar::scrollbarForStyleResolve() || dynamicPseudo == SCROLLBAR_CORNER || dynamicPseudo == RESIZER) && sel->m_match == CSSSelector::PseudoClass))
1737
1825
                return SelectorFailsCompletely;
1738
1826
            return checkSelector(sel, e, selectorAttrs, dynamicPseudo, isAncestor, true, elementStyle, elementParentStyle);
1739
1827
    }
1808
1896
    return isPossibleHTMLAttr && htmlCaseInsensitiveAttributesSet->contains(attr.localName().impl());
1809
1897
}
1810
1898
 
1811
 
bool CSSStyleSelector::SelectorChecker::checkOneSelector(CSSSelector* sel, Element* e, HashSet<AtomicStringImpl*>* selectorAttrs, RenderStyle::PseudoId& dynamicPseudo, bool isAncestor, bool isSubSelector, RenderStyle* elementStyle, RenderStyle* elementParentStyle) const
 
1899
bool CSSStyleSelector::SelectorChecker::checkOneSelector(CSSSelector* sel, Element* e, HashSet<AtomicStringImpl*>* selectorAttrs, PseudoId& dynamicPseudo, bool isAncestor, bool isSubSelector, RenderStyle* elementStyle, RenderStyle* elementParentStyle) const
1812
1900
{
1813
1901
    if (!e)
1814
1902
        return false;
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())
1910
 
                    break;
 
1997
                // the parser enforces that this never occurs
 
1998
                ASSERT(!subSel->simpleSelector());
 
1999
 
1911
2000
                if (!checkOneSelector(subSel, e, selectorAttrs, dynamicPseudo, isAncestor, true, elementStyle, elementParentStyle))
1912
2001
                    return true;
1913
2002
            }
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();
1918
2010
        }
1919
2011
        
1920
2012
        // Normal element pseudo class checking.
2209
2301
                break;
2210
2302
            }
2211
2303
            case CSSSelector::PseudoTarget:
2212
 
                if (e == e->document()->getCSSTarget())
 
2304
                if (e == e->document()->cssTarget())
2213
2305
                    return true;
2214
2306
                break;
2215
2307
            case CSSSelector::PseudoAnyLink:
2218
2310
                if (pseudoState == PseudoAnyLink || pseudoState == PseudoLink || pseudoState == PseudoVisited)
2219
2311
                    return true;
2220
2312
                break;
2221
 
            case CSSSelector::PseudoAutofill:
2222
 
                if (e)
2223
 
                    return e->isAutofilled();
 
2313
            case CSSSelector::PseudoAutofill: {
 
2314
                if (!e || !e->isFormControlElement())
 
2315
                    break;
 
2316
                if (InputElement* inputElement = toInputElement(e))
 
2317
                    return inputElement->isAutofilled();
2224
2318
                break;
 
2319
            }
2225
2320
            case CSSSelector::PseudoLink:
2226
2321
                if (pseudoState == PseudoUnknown || pseudoState == PseudoAnyLink)
2227
2322
                    pseudoState = checkPseudoState(e);
2273
2368
                }
2274
2369
                break;
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())
 
2374
                        break;
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();
 
2379
                }
2281
2380
                break;
2282
2381
            case CSSSelector::PseudoFullPageMedia:
2283
2382
                return e && e->document() && e->document()->isMediaDocument();
2284
2383
                break;
 
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())
 
2390
                        break;
 
2391
 
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();
 
2396
                }
2291
2397
                break;
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())
 
2400
                    return false;
 
2401
                return e->isTextFormControl() && e->isReadOnlyFormControl();
 
2402
            }
 
2403
            case CSSSelector::PseudoReadWrite: {
 
2404
                if (!e || !e->isFormControlElement())
 
2405
                    return false;
 
2406
                return e->isTextFormControl() && !e->isReadOnlyFormControl();
 
2407
            }
 
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())
 
2418
                    break;
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())
2301
 
                    return true;
2302
 
                break;
2303
 
            case CSSSelector::PseudoIndeterminate:
2304
 
                if (e && e->isIndeterminate())
2305
 
                    return true;
2306
 
                break;
 
2422
                InputElement* inputElement = toInputElement(e);
 
2423
                if (inputElement && inputElement->isChecked() && !inputElement->isIndeterminate())
 
2424
                    return true;
 
2425
                break;
 
2426
            }
 
2427
            case CSSSelector::PseudoIndeterminate: {
 
2428
                if (!e || !e->isFormControlElement())
 
2429
                    break;
 
2430
                InputElement* inputElement = toInputElement(e);
 
2431
                if (inputElement && inputElement->isIndeterminate())
 
2432
                    return true;
 
2433
                break;
 
2434
            }
2307
2435
            case CSSSelector::PseudoRoot:
2308
2436
                if (e == e->document()->documentElement())
2309
2437
                    return true;
2347
2475
        switch (sel->pseudoType()) {
2348
2476
            // Pseudo-elements:
2349
2477
            case CSSSelector::PseudoFirstLine:
2350
 
                dynamicPseudo = RenderStyle::FIRST_LINE;
 
2478
                dynamicPseudo = FIRST_LINE;
2351
2479
                return true;
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);
2356
2484
                return true;
2357
2485
            case CSSSelector::PseudoSelection:
2358
 
                dynamicPseudo = RenderStyle::SELECTION;
 
2486
                dynamicPseudo = SELECTION;
2359
2487
                return true;
2360
2488
            case CSSSelector::PseudoBefore:
2361
 
                dynamicPseudo = RenderStyle::BEFORE;
 
2489
                dynamicPseudo = BEFORE;
2362
2490
                return true;
2363
2491
            case CSSSelector::PseudoAfter:
2364
 
                dynamicPseudo = RenderStyle::AFTER;
 
2492
                dynamicPseudo = AFTER;
2365
2493
                return true;
2366
2494
            case CSSSelector::PseudoFileUploadButton:
2367
 
                dynamicPseudo = RenderStyle::FILE_UPLOAD_BUTTON;
 
2495
                dynamicPseudo = FILE_UPLOAD_BUTTON;
2368
2496
                return true;
2369
2497
            case CSSSelector::PseudoInputPlaceholder:
2370
 
                dynamicPseudo = RenderStyle::INPUT_PLACEHOLDER;
 
2498
                dynamicPseudo = INPUT_PLACEHOLDER;
2371
2499
                return true;
2372
2500
            case CSSSelector::PseudoSliderThumb:
2373
 
                dynamicPseudo = RenderStyle::SLIDER_THUMB;
 
2501
                dynamicPseudo = SLIDER_THUMB;
2374
2502
                return true; 
2375
2503
            case CSSSelector::PseudoSearchCancelButton:
2376
 
                dynamicPseudo = RenderStyle::SEARCH_CANCEL_BUTTON;
 
2504
                dynamicPseudo = SEARCH_CANCEL_BUTTON;
2377
2505
                return true; 
2378
2506
            case CSSSelector::PseudoSearchDecoration:
2379
 
                dynamicPseudo = RenderStyle::SEARCH_DECORATION;
 
2507
                dynamicPseudo = SEARCH_DECORATION;
2380
2508
                return true;
2381
2509
            case CSSSelector::PseudoSearchResultsDecoration:
2382
 
                dynamicPseudo = RenderStyle::SEARCH_RESULTS_DECORATION;
 
2510
                dynamicPseudo = SEARCH_RESULTS_DECORATION;
2383
2511
                return true;
2384
2512
            case CSSSelector::PseudoSearchResultsButton:
2385
 
                dynamicPseudo = RenderStyle::SEARCH_RESULTS_BUTTON;
 
2513
                dynamicPseudo = SEARCH_RESULTS_BUTTON;
2386
2514
                return true;
2387
2515
            case CSSSelector::PseudoMediaControlsPanel:
2388
 
                dynamicPseudo = RenderStyle::MEDIA_CONTROLS_PANEL;
 
2516
                dynamicPseudo = MEDIA_CONTROLS_PANEL;
2389
2517
                return true;
2390
2518
            case CSSSelector::PseudoMediaControlsMuteButton:
2391
 
                dynamicPseudo = RenderStyle::MEDIA_CONTROLS_MUTE_BUTTON;
 
2519
                dynamicPseudo = MEDIA_CONTROLS_MUTE_BUTTON;
2392
2520
                return true;
2393
2521
            case CSSSelector::PseudoMediaControlsPlayButton:
2394
 
                dynamicPseudo = RenderStyle::MEDIA_CONTROLS_PLAY_BUTTON;
2395
 
                return true;
2396
 
            case CSSSelector::PseudoMediaControlsTimeDisplay:
2397
 
                dynamicPseudo = RenderStyle::MEDIA_CONTROLS_TIME_DISPLAY;
 
2522
                dynamicPseudo = MEDIA_CONTROLS_PLAY_BUTTON;
 
2523
                return true;
 
2524
            case CSSSelector::PseudoMediaControlsTimelineContainer:
 
2525
                dynamicPseudo = MEDIA_CONTROLS_TIMELINE_CONTAINER;
 
2526
                return true;
 
2527
            case CSSSelector::PseudoMediaControlsVolumeSliderContainer:
 
2528
                dynamicPseudo = MEDIA_CONTROLS_VOLUME_SLIDER_CONTAINER;
 
2529
                return true;
 
2530
            case CSSSelector::PseudoMediaControlsCurrentTimeDisplay:
 
2531
                dynamicPseudo = MEDIA_CONTROLS_CURRENT_TIME_DISPLAY;
 
2532
                return true;
 
2533
            case CSSSelector::PseudoMediaControlsTimeRemainingDisplay:
 
2534
                dynamicPseudo = MEDIA_CONTROLS_TIME_REMAINING_DISPLAY;
2398
2535
                return true;
2399
2536
            case CSSSelector::PseudoMediaControlsTimeline:
2400
 
                dynamicPseudo = RenderStyle::MEDIA_CONTROLS_TIMELINE;
 
2537
                dynamicPseudo = MEDIA_CONTROLS_TIMELINE;
 
2538
                return true;
 
2539
            case CSSSelector::PseudoMediaControlsVolumeSlider:
 
2540
                dynamicPseudo = MEDIA_CONTROLS_VOLUME_SLIDER;
2401
2541
                return true;
2402
2542
            case CSSSelector::PseudoMediaControlsSeekBackButton:
2403
 
                dynamicPseudo = RenderStyle::MEDIA_CONTROLS_SEEK_BACK_BUTTON;
 
2543
                dynamicPseudo = MEDIA_CONTROLS_SEEK_BACK_BUTTON;
2404
2544
                return true;
2405
2545
            case CSSSelector::PseudoMediaControlsSeekForwardButton:
2406
 
                dynamicPseudo = RenderStyle::MEDIA_CONTROLS_SEEK_FORWARD_BUTTON;
 
2546
                dynamicPseudo = MEDIA_CONTROLS_SEEK_FORWARD_BUTTON;
 
2547
                return true;
 
2548
            case CSSSelector::PseudoMediaControlsRewindButton:
 
2549
                dynamicPseudo = MEDIA_CONTROLS_REWIND_BUTTON;
 
2550
                return true;
 
2551
            case CSSSelector::PseudoMediaControlsReturnToRealtimeButton:
 
2552
                dynamicPseudo = MEDIA_CONTROLS_RETURN_TO_REALTIME_BUTTON;
 
2553
                return true;
 
2554
            case CSSSelector::PseudoMediaControlsStatusDisplay:
 
2555
                dynamicPseudo = MEDIA_CONTROLS_STATUS_DISPLAY;
2407
2556
                return true;
2408
2557
            case CSSSelector::PseudoMediaControlsFullscreenButton:
2409
 
                dynamicPseudo = RenderStyle::MEDIA_CONTROLS_FULLSCREEN_BUTTON;
 
2558
                dynamicPseudo = MEDIA_CONTROLS_FULLSCREEN_BUTTON;
2410
2559
                return true;
2411
2560
            case CSSSelector::PseudoScrollbar:
2412
 
                dynamicPseudo = RenderStyle::SCROLLBAR;
 
2561
                dynamicPseudo = SCROLLBAR;
2413
2562
                return true;
2414
2563
            case CSSSelector::PseudoScrollbarButton:
2415
 
                dynamicPseudo = RenderStyle::SCROLLBAR_BUTTON;
 
2564
                dynamicPseudo = SCROLLBAR_BUTTON;
2416
2565
                return true;
2417
2566
            case CSSSelector::PseudoScrollbarCorner:
2418
 
                dynamicPseudo = RenderStyle::SCROLLBAR_CORNER;
 
2567
                dynamicPseudo = SCROLLBAR_CORNER;
2419
2568
                return true;
2420
2569
            case CSSSelector::PseudoScrollbarThumb:
2421
 
                dynamicPseudo = RenderStyle::SCROLLBAR_THUMB;
 
2570
                dynamicPseudo = SCROLLBAR_THUMB;
2422
2571
                return true;
2423
2572
            case CSSSelector::PseudoScrollbarTrack:
2424
 
                dynamicPseudo = RenderStyle::SCROLLBAR_TRACK;
 
2573
                dynamicPseudo = SCROLLBAR_TRACK;
2425
2574
                return true;
2426
2575
            case CSSSelector::PseudoScrollbarTrackPiece:
2427
 
                dynamicPseudo = RenderStyle::SCROLLBAR_TRACK_PIECE;
 
2576
                dynamicPseudo = SCROLLBAR_TRACK_PIECE;
2428
2577
                return true;
2429
2578
            case CSSSelector::PseudoResizer:
2430
 
                dynamicPseudo = RenderStyle::RESIZER;
 
2579
                dynamicPseudo = RESIZER;
2431
2580
                return true;
2432
2581
            case CSSSelector::PseudoUnknown:
2433
2582
            case CSSSelector::PseudoNotParsed:
2441
2590
    return true;
2442
2591
}
2443
2592
 
2444
 
bool CSSStyleSelector::SelectorChecker::checkScrollbarPseudoClass(CSSSelector* sel, RenderStyle::PseudoId&) const
 
2593
bool CSSStyleSelector::SelectorChecker::checkScrollbarPseudoClass(CSSSelector* sel, PseudoId&) const
2445
2594
{
2446
2595
    RenderScrollbar* scrollbar = RenderScrollbar::scrollbarForStyleResolve();
2447
2596
    ScrollbarPart part = RenderScrollbar::partForStyleResolve();
2652
2801
// -------------------------------------------------------------------------------------
2653
2802
// this is mostly boring stuff on how to apply a certain rule to the renderstyle...
2654
2803
 
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)
2656
2805
{
 
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.
2657
2809
    Length l;
2658
2810
    if (!primitiveValue) {
2659
2811
        if (ok)
2660
2812
            *ok = false;
2661
2813
    } else {
2662
2814
        int type = primitiveValue->primitiveType();
2663
 
        if (type > CSSPrimitiveValue::CSS_PERCENTAGE && type < CSSPrimitiveValue::CSS_DEG)
2664
 
            l = Length(primitiveValue->computeLengthIntForLength(style), Fixed);
 
2815
        
 
2816
        if (!style && (type == CSSPrimitiveValue::CSS_EMS || type == CSSPrimitiveValue::CSS_EXS || type == CSSPrimitiveValue::CSS_REMS)) {
 
2817
            if (ok)
 
2818
                *ok = false;
 
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)
2790
2946
        return;
 
2947
    case CSSPropertyBackgroundClip:
2791
2948
    case CSSPropertyWebkitBackgroundClip:
2792
2949
        HANDLE_BACKGROUND_VALUE(clip, Clip, value)
2793
2950
        return;
2794
2951
    case CSSPropertyWebkitBackgroundComposite:
2795
2952
        HANDLE_BACKGROUND_VALUE(composite, Composite, value)
2796
2953
        return;
 
2954
    case CSSPropertyBackgroundOrigin:
2797
2955
    case CSSPropertyWebkitBackgroundOrigin:
2798
2956
        HANDLE_BACKGROUND_VALUE(origin, Origin, value)
2799
2957
        return;
2800
 
    case CSSPropertyBackgroundRepeat:
2801
 
        HANDLE_BACKGROUND_VALUE(repeat, Repeat, value)
2802
 
        return;
2803
 
    case CSSPropertyWebkitBackgroundSize:
 
2958
    case CSSPropertyBackgroundSize:
2804
2959
        HANDLE_BACKGROUND_VALUE(size, Size, value)
2805
2960
        return;
2806
2961
    case CSSPropertyWebkitMaskAttachment:
2815
2970
    case CSSPropertyWebkitMaskOrigin:
2816
2971
        HANDLE_MASK_VALUE(origin, Origin, value)
2817
2972
        return;
2818
 
    case CSSPropertyWebkitMaskRepeat:
2819
 
        HANDLE_MASK_VALUE(repeat, Repeat, value)
2820
 
        return;
2821
2973
    case CSSPropertyWebkitMaskSize:
2822
2974
        HANDLE_MASK_VALUE(size, Size, value)
2823
2975
        return;
2836
2988
                return;
2837
2989
        }
2838
2990
        return;
2839
 
        
2840
2991
    case CSSPropertyBorderTopStyle:
2841
 
        HANDLE_INHERIT_AND_INITIAL_WITH_VALUE(borderTopStyle, BorderTopStyle, BorderStyle)
2842
 
        if (primitiveValue)
2843
 
            m_style->setBorderTopStyle(*primitiveValue);
 
2992
        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE_WITH_VALUE(borderTopStyle, BorderTopStyle, BorderStyle)
2844
2993
        return;
2845
2994
    case CSSPropertyBorderRightStyle:
2846
 
        HANDLE_INHERIT_AND_INITIAL_WITH_VALUE(borderRightStyle, BorderRightStyle, BorderStyle)
2847
 
        if (primitiveValue)
2848
 
            m_style->setBorderRightStyle(*primitiveValue);
 
2995
        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE_WITH_VALUE(borderRightStyle, BorderRightStyle, BorderStyle)
2849
2996
        return;
2850
2997
    case CSSPropertyBorderBottomStyle:
2851
 
        HANDLE_INHERIT_AND_INITIAL_WITH_VALUE(borderBottomStyle, BorderBottomStyle, BorderStyle)
2852
 
        if (primitiveValue)
2853
 
            m_style->setBorderBottomStyle(*primitiveValue);
 
2998
        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE_WITH_VALUE(borderBottomStyle, BorderBottomStyle, BorderStyle)
2854
2999
        return;
2855
3000
    case CSSPropertyBorderLeftStyle:
2856
 
        HANDLE_INHERIT_AND_INITIAL_WITH_VALUE(borderLeftStyle, BorderLeftStyle, BorderStyle)
2857
 
        if (primitiveValue)
2858
 
            m_style->setBorderLeftStyle(*primitiveValue);
 
3001
        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE_WITH_VALUE(borderLeftStyle, BorderLeftStyle, BorderStyle)
2859
3002
        return;
2860
3003
    case CSSPropertyOutlineStyle:
2861
3004
        HANDLE_INHERIT_AND_INITIAL_WITH_VALUE(outlineStyle, OutlineStyle, BorderStyle)
2867
3010
        }
2868
3011
        return;
2869
3012
    case CSSPropertyCaptionSide:
2870
 
    {
2871
 
        HANDLE_INHERIT_AND_INITIAL(captionSide, CaptionSide)
2872
 
        if (primitiveValue)
2873
 
            m_style->setCaptionSide(*primitiveValue);
 
3013
        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(captionSide, CaptionSide)
2874
3014
        return;
2875
 
    }
2876
3015
    case CSSPropertyClear:
2877
 
    {
2878
 
        HANDLE_INHERIT_AND_INITIAL(clear, Clear)
2879
 
        if (primitiveValue)
2880
 
            m_style->setClear(*primitiveValue);
 
3016
        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(clear, Clear)
2881
3017
        return;
2882
 
    }
2883
3018
    case CSSPropertyDirection:
2884
 
    {
2885
 
        HANDLE_INHERIT_AND_INITIAL(direction, Direction)
2886
 
        if (primitiveValue)
2887
 
            m_style->setDirection(*primitiveValue);
 
3019
        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(direction, Direction)
2888
3020
        return;
2889
 
    }
2890
3021
    case CSSPropertyDisplay:
2891
 
    {
2892
 
        HANDLE_INHERIT_AND_INITIAL(display, Display)
2893
 
        if (primitiveValue)
2894
 
            m_style->setDisplay(*primitiveValue);
 
3022
        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(display, Display)
 
3023
#if ENABLE(WCSS)
 
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);
 
3034
 
 
3035
                if (m_parentStyle)
 
3036
                    m_style->setDisplay(m_parentStyle->display());
 
3037
                else
 
3038
                    m_style->setDisplay(*primitiveValue);
 
3039
            } else
 
3040
                m_style->setDisplay(*primitiveValue);
 
3041
        }
 
3042
#endif
2895
3043
        return;
2896
 
    }
2897
 
 
2898
3044
    case CSSPropertyEmptyCells:
2899
 
    {
2900
 
        HANDLE_INHERIT_AND_INITIAL(emptyCells, EmptyCells)
2901
 
        if (primitiveValue)
2902
 
            m_style->setEmptyCells(*primitiveValue);
 
3045
        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(emptyCells, EmptyCells)
2903
3046
        return;
2904
 
    }
2905
3047
    case CSSPropertyFloat:
2906
 
    {
2907
 
        HANDLE_INHERIT_AND_INITIAL(floating, Floating)
2908
 
        if (primitiveValue)
2909
 
            m_style->setFloating(*primitiveValue);
 
3048
        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(floating, Floating)
2910
3049
        return;
2911
 
    }
2912
 
 
2913
3050
    case CSSPropertyFontStyle:
2914
3051
    {
2915
3052
        FontDescription fontDescription = m_style->fontDescription();
2958
3095
        }
2959
3096
        if (m_style->setFontDescription(fontDescription))
2960
3097
            m_fontDirty = true;
2961
 
        return;        
 
3098
        return;
2962
3099
    }
2963
3100
 
2964
3101
    case CSSPropertyFontWeight:
3020
3157
    }
3021
3158
        
3022
3159
    case CSSPropertyListStylePosition:
3023
 
    {
3024
 
        HANDLE_INHERIT_AND_INITIAL(listStylePosition, ListStylePosition)
3025
 
        if (primitiveValue)
3026
 
            m_style->setListStylePosition(*primitiveValue);
 
3160
        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(listStylePosition, ListStylePosition)
3027
3161
        return;
3028
 
    }
3029
 
 
3030
3162
    case CSSPropertyListStyleType:
3031
 
    {
3032
 
        HANDLE_INHERIT_AND_INITIAL(listStyleType, ListStyleType)
3033
 
        if (primitiveValue)
3034
 
            m_style->setListStyleType(*primitiveValue);
 
3163
        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(listStyleType, ListStyleType)
3035
3164
        return;
3036
 
    }
3037
 
 
3038
3165
    case CSSPropertyOverflow:
3039
3166
    {
3040
3167
        if (isInherit) {
3057
3184
    }
3058
3185
 
3059
3186
    case CSSPropertyOverflowX:
3060
 
    {
3061
 
        HANDLE_INHERIT_AND_INITIAL(overflowX, OverflowX)
3062
 
        m_style->setOverflowX(*primitiveValue);
 
3187
        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(overflowX, OverflowX)
3063
3188
        return;
3064
 
    }
3065
 
 
3066
3189
    case CSSPropertyOverflowY:
3067
 
    {
3068
 
        HANDLE_INHERIT_AND_INITIAL(overflowY, OverflowY)
3069
 
        m_style->setOverflowY(*primitiveValue);
 
3190
        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(overflowY, OverflowY)
3070
3191
        return;
3071
 
    }
3072
 
 
3073
3192
    case CSSPropertyPageBreakBefore:
3074
 
    {
3075
 
        HANDLE_INHERIT_AND_INITIAL_WITH_VALUE(pageBreakBefore, PageBreakBefore, PageBreak)
3076
 
        if (primitiveValue)
3077
 
            m_style->setPageBreakBefore(*primitiveValue);
 
3193
        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE_WITH_VALUE(pageBreakBefore, PageBreakBefore, PageBreak)
3078
3194
        return;
3079
 
    }
3080
 
 
3081
3195
    case CSSPropertyPageBreakAfter:
3082
 
    {
3083
 
        HANDLE_INHERIT_AND_INITIAL_WITH_VALUE(pageBreakAfter, PageBreakAfter, PageBreak)
3084
 
        if (primitiveValue)
3085
 
            m_style->setPageBreakAfter(*primitiveValue);
 
3196
        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE_WITH_VALUE(pageBreakAfter, PageBreakAfter, PageBreak)
3086
3197
        return;
3087
 
    }
3088
 
 
3089
3198
    case CSSPropertyPageBreakInside: {
3090
3199
        HANDLE_INHERIT_AND_INITIAL_WITH_VALUE(pageBreakInside, PageBreakInside, PageBreak)
3091
3200
        if (!primitiveValue)
3097
3206
    }
3098
3207
        
3099
3208
    case CSSPropertyPosition:
3100
 
    {
3101
 
        HANDLE_INHERIT_AND_INITIAL(position, Position)
3102
 
        if (primitiveValue)
3103
 
            m_style->setPosition(*primitiveValue);
 
3209
        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(position, Position)
3104
3210
        return;
3105
 
    }
3106
 
 
3107
3211
    case CSSPropertyTableLayout: {
3108
3212
        HANDLE_INHERIT_AND_INITIAL(tableLayout, TableLayout)
3109
3213
 
3115
3219
        return;
3116
3220
    }
3117
3221
        
3118
 
    case CSSPropertyUnicodeBidi: {
3119
 
        HANDLE_INHERIT_AND_INITIAL(unicodeBidi, UnicodeBidi)
3120
 
        m_style->setUnicodeBidi(*primitiveValue);
3121
 
        return;
3122
 
    }
3123
 
    case CSSPropertyTextTransform: {
3124
 
        HANDLE_INHERIT_AND_INITIAL(textTransform, TextTransform)
3125
 
        m_style->setTextTransform(*primitiveValue);
3126
 
        return;
3127
 
    }
3128
 
 
 
3222
    case CSSPropertyUnicodeBidi: 
 
3223
        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(unicodeBidi, UnicodeBidi)
 
3224
        return;
 
3225
    case CSSPropertyTextTransform: 
 
3226
        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(textTransform, TextTransform)
 
3227
        return;
3129
3228
    case CSSPropertyVisibility:
3130
 
    {
3131
 
        HANDLE_INHERIT_AND_INITIAL(visibility, Visibility)
3132
 
        m_style->setVisibility(*primitiveValue);
 
3229
        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(visibility, Visibility)
3133
3230
        return;
3134
 
    }
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)
3138
3233
        return;
3139
3234
 
3140
3235
    case CSSPropertyBackgroundPosition:
3161
3256
        HANDLE_MASK_VALUE(yPosition, YPosition, value)
3162
3257
        return;
3163
3258
    }
 
3259
    case CSSPropertyBackgroundRepeat:
 
3260
        HANDLE_BACKGROUND_INHERIT_AND_INITIAL(repeatX, RepeatX);
 
3261
        HANDLE_BACKGROUND_INHERIT_AND_INITIAL(repeatY, RepeatY);
 
3262
        return;
 
3263
    case CSSPropertyBackgroundRepeatX:
 
3264
        HANDLE_BACKGROUND_VALUE(repeatX, RepeatX, value)
 
3265
        return;
 
3266
    case CSSPropertyBackgroundRepeatY:
 
3267
        HANDLE_BACKGROUND_VALUE(repeatY, RepeatY, value)
 
3268
        return;
 
3269
    case CSSPropertyWebkitMaskRepeat:
 
3270
        HANDLE_MASK_INHERIT_AND_INITIAL(repeatX, RepeatX);
 
3271
        HANDLE_MASK_INHERIT_AND_INITIAL(repeatY, RepeatY);
 
3272
        return;
 
3273
    case CSSPropertyWebkitMaskRepeatX:
 
3274
        HANDLE_MASK_VALUE(repeatX, RepeatX, value)
 
3275
        return;
 
3276
    case CSSPropertyWebkitMaskRepeatY:
 
3277
        HANDLE_MASK_VALUE(repeatY, RepeatY, value)
 
3278
        return;
3164
3279
    case CSSPropertyBorderSpacing: {
3165
3280
        if (isInherit) {
3166
3281
            m_style->setHorizontalBorderSpacing(m_parentStyle->horizontalBorderSpacing());
3176
3291
        HANDLE_INHERIT_AND_INITIAL(horizontalBorderSpacing, HorizontalBorderSpacing)
3177
3292
        if (!primitiveValue)
3178
3293
            return;
3179
 
        short spacing =  primitiveValue->computeLengthShort(style(), zoomFactor);
 
3294
        short spacing = primitiveValue->computeLengthShort(style(), m_rootElementStyle, zoomFactor);
3180
3295
        m_style->setHorizontalBorderSpacing(spacing);
3181
3296
        return;
3182
3297
    }
3184
3299
        HANDLE_INHERIT_AND_INITIAL(verticalBorderSpacing, VerticalBorderSpacing)
3185
3300
        if (!primitiveValue)
3186
3301
            return;
3187
 
        short spacing =  primitiveValue->computeLengthShort(style(), zoomFactor);
 
3302
        short spacing = primitiveValue->computeLengthShort(style(), m_rootElementStyle, zoomFactor);
3188
3303
        m_style->setVerticalBorderSpacing(spacing);
3189
3304
        return;
3190
3305
    }
3223
3338
            }
3224
3339
        } else if (primitiveValue) {
3225
3340
            int type = primitiveValue->primitiveType();
3226
 
            if (type == CSSPrimitiveValue::CSS_IDENT)
 
3341
            if (type == CSSPrimitiveValue::CSS_IDENT && m_style->cursor() != ECursor(*primitiveValue))
3227
3342
                m_style->setCursor(*primitiveValue);
3228
3343
        }
3229
3344
        return;
3359
3474
            width = 5;
3360
3475
            break;
3361
3476
        case CSSValueInvalid:
3362
 
            width = primitiveValue->computeLengthShort(style(), zoomFactor);
 
3477
            width = primitiveValue->computeLengthShort(style(), m_rootElementStyle, zoomFactor);
3363
3478
            break;
3364
3479
        default:
3365
3480
            return;
3391
3506
        return;
3392
3507
    }
3393
3508
 
 
3509
    case CSSPropertyWebkitFontSmoothing: {
 
3510
        FontDescription fontDescription = m_style->fontDescription();
 
3511
        if (isInherit) 
 
3512
            fontDescription.setFontSmoothing(m_parentStyle->fontDescription().fontSmoothing());
 
3513
        else if (isInitial)
 
3514
            fontDescription.setFontSmoothing(AutoSmoothing);
 
3515
        else {
 
3516
            if (!primitiveValue)
 
3517
                return;
 
3518
            int id = primitiveValue->getIdent();
 
3519
            FontSmoothingMode smoothing;
 
3520
            switch (id) {
 
3521
                case CSSValueAuto:
 
3522
                    smoothing = AutoSmoothing;
 
3523
                    break;
 
3524
                case CSSValueNone:
 
3525
                    smoothing = NoSmoothing;
 
3526
                    break;
 
3527
                case CSSValueAntialiased:
 
3528
                    smoothing = Antialiased;
 
3529
                    break;
 
3530
                case CSSValueSubpixelAntialiased:
 
3531
                    smoothing = SubpixelAntialiased;
 
3532
                    break;
 
3533
                default:
 
3534
                    ASSERT_NOT_REACHED();
 
3535
                    smoothing = AutoSmoothing;
 
3536
            }
 
3537
            fontDescription.setFontSmoothing(smoothing);
 
3538
        }
 
3539
        if (m_style->setFontDescription(fontDescription))
 
3540
            m_fontDirty = true;
 
3541
        return;
 
3542
    }
 
3543
 
3394
3544
    case CSSPropertyLetterSpacing:
3395
3545
    case CSSPropertyWordSpacing:
3396
3546
    {
3407
3557
        }
3408
3558
        
3409
3559
        int width = 0;
3410
 
        if (primitiveValue && primitiveValue->getIdent() == CSSValueNormal){
 
3560
        if (primitiveValue && primitiveValue->getIdent() == CSSValueNormal) {
3411
3561
            width = 0;
3412
3562
        } else {
3413
3563
            if (!primitiveValue)
3414
3564
                return;
3415
 
            width = primitiveValue->computeLengthInt(style(), zoomFactor);
 
3565
            width = primitiveValue->computeLengthInt(style(), m_rootElementStyle, zoomFactor);
3416
3566
        }
3417
3567
        switch (id) {
3418
3568
        case CSSPropertyLetterSpacing:
3427
3577
        return;
3428
3578
    }
3429
3579
 
3430
 
    case CSSPropertyWordBreak: {
3431
 
        HANDLE_INHERIT_AND_INITIAL(wordBreak, WordBreak)
3432
 
        m_style->setWordBreak(*primitiveValue);
3433
 
        return;
3434
 
    }
3435
 
 
3436
 
    case CSSPropertyWordWrap: {
3437
 
        HANDLE_INHERIT_AND_INITIAL(wordWrap, WordWrap)
3438
 
        m_style->setWordWrap(*primitiveValue);
3439
 
        return;
3440
 
    }
3441
 
 
 
3580
    case CSSPropertyWordBreak:
 
3581
        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(wordBreak, WordBreak)
 
3582
        return;
 
3583
    case CSSPropertyWordWrap:
 
3584
        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(wordWrap, WordWrap)
 
3585
        return;
3442
3586
    case CSSPropertyWebkitNbspMode:
3443
 
    {
3444
 
        HANDLE_INHERIT_AND_INITIAL(nbspMode, NBSPMode)
3445
 
        m_style->setNBSPMode(*primitiveValue);
 
3587
        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(nbspMode, NBSPMode)
3446
3588
        return;
3447
 
    }
3448
 
 
3449
3589
    case CSSPropertyWebkitLineBreak:
3450
 
    {
3451
 
        HANDLE_INHERIT_AND_INITIAL(khtmlLineBreak, KHTMLLineBreak)
3452
 
        m_style->setKHTMLLineBreak(*primitiveValue);
 
3590
        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(khtmlLineBreak, KHTMLLineBreak)
3453
3591
        return;
3454
 
    }
3455
 
 
3456
3592
    case CSSPropertyWebkitMatchNearestMailBlockquoteColor:
3457
 
    {
3458
 
        HANDLE_INHERIT_AND_INITIAL(matchNearestMailBlockquoteColor, MatchNearestMailBlockquoteColor)
3459
 
        m_style->setMatchNearestMailBlockquoteColor(*primitiveValue);
 
3593
        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(matchNearestMailBlockquoteColor, MatchNearestMailBlockquoteColor)
3460
3594
        return;
3461
 
    }
3462
3595
 
3463
3596
    case CSSPropertyResize:
3464
3597
    {
3554
3687
 
3555
3688
        if (primitiveValue && !apply) {
3556
3689
            int type = primitiveValue->primitiveType();
3557
 
            if (type > CSSPrimitiveValue::CSS_PERCENTAGE && type < CSSPrimitiveValue::CSS_DEG)
 
3690
            if (CSSPrimitiveValue::isUnitTypeLength(type))
3558
3691
                // Handle our quirky margin units if we have them.
3559
 
                l = Length(primitiveValue->computeLengthIntForLength(style(), zoomFactor), Fixed, 
 
3692
                l = Length(primitiveValue->computeLengthIntForLength(style(), m_rootElementStyle, zoomFactor), Fixed, 
3560
3693
                           primitiveValue->isQuirkValue());
3561
3694
            else if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
3562
3695
                l = Length(primitiveValue->getDoubleValue(), Percent);
3655
3788
 
3656
3789
        if (primitiveValue && !apply) {
3657
3790
            unsigned short type = primitiveValue->primitiveType();
3658
 
            if (type > CSSPrimitiveValue::CSS_PERCENTAGE && type < CSSPrimitiveValue::CSS_DEG)
3659
 
                l = Length(primitiveValue->computeLengthIntForLength(style(), zoomFactor), Fixed);
 
3791
            if (CSSPrimitiveValue::isUnitTypeLength(type))
 
3792
                l = Length(primitiveValue->computeLengthIntForLength(style(), m_rootElementStyle, zoomFactor), Fixed);
3660
3793
            else if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
3661
3794
                l = Length(primitiveValue->getDoubleValue(), Percent);
3662
3795
            else
3711
3844
        } else {
3712
3845
          int type = primitiveValue->primitiveType();
3713
3846
          Length l;
3714
 
          if (type > CSSPrimitiveValue::CSS_PERCENTAGE && type < CSSPrimitiveValue::CSS_DEG)
3715
 
            l = Length(primitiveValue->computeLengthIntForLength(style(), zoomFactor), Fixed);
 
3847
          if (CSSPrimitiveValue::isUnitTypeLength(type))
 
3848
            l = Length(primitiveValue->computeLengthIntForLength(style(), m_rootElementStyle, zoomFactor), Fixed);
3716
3849
          else if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
3717
3850
            l = Length(primitiveValue->getDoubleValue(), Percent);
3718
3851
 
3725
3858
    {
3726
3859
        FontDescription fontDescription = m_style->fontDescription();
3727
3860
        fontDescription.setKeywordSize(0);
3728
 
        bool familyIsFixed = fontDescription.genericFamily() == FontDescription::MonospaceFamily;
3729
3861
        float oldSize = 0;
3730
3862
        float size = 0;
3731
3863
        
3740
3872
            if (m_parentNode)
3741
3873
                fontDescription.setKeywordSize(m_parentStyle->fontDescription().keywordSize());
3742
3874
        } else if (isInitial) {
3743
 
            size = fontSizeForKeyword(CSSValueMedium, m_style->htmlHacks(), familyIsFixed);
 
3875
            size = fontSizeForKeyword(CSSValueMedium, m_style->htmlHacks(), fontDescription.useFixedDefaultSize());
3744
3876
            fontDescription.setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1);
3745
3877
        } else if (primitiveValue->getIdent()) {
3746
3878
            // Keywords are being used.
3753
3885
                case CSSValueXLarge:
3754
3886
                case CSSValueXxLarge:
3755
3887
                case CSSValueWebkitXxxLarge:
3756
 
                    size = fontSizeForKeyword(primitiveValue->getIdent(), m_style->htmlHacks(), familyIsFixed);
 
3888
                    size = fontSizeForKeyword(primitiveValue->getIdent(), m_style->htmlHacks(), fontDescription.useFixedDefaultSize());
3757
3889
                    fontDescription.setKeywordSize(primitiveValue->getIdent() - CSSValueXxSmall + 1);
3758
3890
                    break;
3759
3891
                case CSSValueLarger:
3774
3906
            fontDescription.setIsAbsoluteSize(parentIsAbsoluteSize ||
3775
3907
                                              (type != CSSPrimitiveValue::CSS_PERCENTAGE &&
3776
3908
                                               type != CSSPrimitiveValue::CSS_EMS && 
3777
 
                                               type != CSSPrimitiveValue::CSS_EXS));
3778
 
            if (type > CSSPrimitiveValue::CSS_PERCENTAGE && type < CSSPrimitiveValue::CSS_DEG)
3779
 
                size = primitiveValue->computeLengthFloat(m_parentStyle, true);
 
3909
                                               type != CSSPrimitiveValue::CSS_EXS &&
 
3910
                                               type != CSSPrimitiveValue::CSS_REMS));
 
3911
            if (CSSPrimitiveValue::isUnitTypeLength(type))
 
3912
                size = primitiveValue->computeLengthFloat(m_parentStyle, m_rootElementStyle, true);
3780
3913
            else if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
3781
3914
                size = (primitiveValue->getFloatValue() * oldSize) / 100.0f;
3782
3915
            else
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)
3883
4016
                right = m_parentStyle->clipRight();
3884
4017
                bottom = m_parentStyle->clipBottom();
3885
4018
                left = m_parentStyle->clipLeft();
3886
 
            }
3887
 
            else {
 
4019
            } else {
3888
4020
                hasClip = false;
3889
4021
                top = right = bottom = left = Length();
3890
4022
            }
3897
4029
            Rect* rect = primitiveValue->getRectValue();
3898
4030
            if (!rect)
3899
4031
                return;
3900
 
            top = convertToLength(rect->top(), style());
3901
 
            right = convertToLength(rect->right(), style());
3902
 
            bottom = convertToLength(rect->bottom(), style());
3903
 
            left = convertToLength(rect->left(), style());
3904
 
 
 
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) {
3906
4037
            return;
3907
4038
        }
3949
4080
                    break;
3950
4081
                case CSSPrimitiveValue::CSS_ATTR: {
3951
4082
                    // FIXME: Can a namespace be specified for an attr(foo)?
3952
 
                    if (m_style->styleType() == RenderStyle::NOPSEUDO)
 
4083
                    if (m_style->styleType() == NOPSEUDO)
3953
4084
                        m_style->setUnique();
3954
4085
                    else
3955
4086
                        m_parentStyle->setUnique();
3997
4128
            if (m_style->setFontDescription(fontDescription))
3998
4129
                m_fontDirty = true;
3999
4130
            return;
4000
 
        }
4001
 
        else if (isInitial) {
 
4131
        } else if (isInitial) {
4002
4132
            FontDescription initialDesc = FontDescription();
4003
4133
            FontDescription fontDescription = m_style->fontDescription();
4004
4134
            // We need to adjust the size to account for the generic family change from monospace
4005
4135
            // to non-monospace.
4006
 
            if (fontDescription.keywordSize() && fontDescription.genericFamily() == FontDescription::MonospaceFamily)
 
4136
            if (fontDescription.keywordSize() && fontDescription.useFixedDefaultSize())
4007
4137
                setFontSize(fontDescription, fontSizeForKeyword(CSSValueXxSmall + fontDescription.keywordSize() - 1, m_style->htmlHacks(), false));
4008
4138
            fontDescription.setGenericFamily(initialDesc.genericFamily());
4009
4139
            if (!initialDesc.firstFamily().familyIsEmpty())
4013
4143
            return;
4014
4144
        }
4015
4145
        
4016
 
        if (!value->isValueList()) return;
 
4146
        if (!value->isValueList())
 
4147
            return;
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;
4022
4153
        
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);
4026
4157
 
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())
 
4161
                continue;
 
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)
4059
4191
                        break;
4060
4192
                }
4061
4193
            }
4062
 
    
 
4194
 
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;
4068
 
                }
4069
 
                else {
 
4201
                } else {
4070
4202
                    RefPtr<SharedFontFamily> newFamily = SharedFontFamily::create();
4071
4203
                    newFamily->setFamily(face);
4072
4204
                    currFamily->appendFamily(newFamily);
4073
4205
                    currFamily = newFamily.get();
4074
4206
                }
4075
 
    
4076
 
                if (fontDescription.keywordSize() && (fontDescription.genericFamily() == FontDescription::MonospaceFamily) != oldFamilyIsMonospace)
4077
 
                    setFontSize(fontDescription, fontSizeForKeyword(CSSValueXxSmall + fontDescription.keywordSize() - 1, m_style->htmlHacks(), !oldFamilyIsMonospace));
4078
 
            
4079
 
                if (m_style->setFontDescription(fontDescription))
4080
 
                    m_fontDirty = true;
4081
4207
            }
4082
4208
        }
4083
 
      return;
 
4209
 
 
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.
 
4212
        if (currFamily) {
 
4213
            if (fontDescription.keywordSize() && fontDescription.useFixedDefaultSize() != oldFamilyUsedFixedDefaultSize)
 
4214
                setFontSize(fontDescription, fontSizeForKeyword(CSSValueXxSmall + fontDescription.keywordSize() - 1, m_style->htmlHacks(), !oldFamilyUsedFixedDefaultSize));
 
4215
 
 
4216
            if (m_style->setFontDescription(fontDescription))
 
4217
                m_fontDirty = true;
 
4218
        }
 
4219
        return;
4084
4220
    }
4085
4221
    case CSSPropertyTextDecoration: {
4086
4222
        // list of ident
4282
4418
                m_fontDirty = true;
4283
4419
        } else if (isInitial) {
4284
4420
            Settings* settings = m_checker.m_document->settings();
 
4421
            ASSERT(settings); // If we're doing style resolution, this document should always be in a frame and thus have settings
 
4422
            if (!settings)
 
4423
                return;
4285
4424
            FontDescription fontDescription;
4286
4425
            fontDescription.setGenericFamily(FontDescription::StandardFamily);
4287
4426
            fontDescription.setRenderingMode(settings->fontRenderingMode());
4302
4441
            m_lineHeightValue = 0;
4303
4442
            
4304
4443
            FontDescription fontDescription;
4305
 
            theme()->systemFont(primitiveValue->getIdent(), fontDescription);
 
4444
            RenderTheme::defaultTheme()->systemFont(primitiveValue->getIdent(), fontDescription);
4306
4445
 
4307
4446
            // Double-check and see if the theme did anything.  If not, don't bother updating the font.
4308
4447
            if (fontDescription.isAbsoluteSize()) {
4309
4448
                // Make sure the rendering mode and printer font settings are updated.
4310
4449
                Settings* settings = m_checker.m_document->settings();
 
4450
                ASSERT(settings); // If we're doing style resolution, this document should always be in a frame and thus have settings
 
4451
                if (!settings)
 
4452
                    return;
4311
4453
                fontDescription.setRenderingMode(settings->fontRenderingMode());
4312
4454
                fontDescription.setUsePrinterFont(m_checker.m_document->printing());
4313
4455
           
4416
4558
        return;
4417
4559
    }
4418
4560
 
 
4561
    case CSSPropertyBorderRadius:
4419
4562
    case CSSPropertyWebkitBorderRadius:
4420
4563
        if (isInherit) {
4421
4564
            m_style->setBorderTopLeftRadius(m_parentStyle->borderTopLeftRadius());
4429
4572
            return;
4430
4573
        }
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)
4441
4584
            return;
4442
4585
        }
4443
4586
        
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)
4449
4592
            return;
4450
4593
        }
4451
4594
 
4456
4599
        if (!pair)
4457
4600
            return;
4458
4601
 
4459
 
        int width = pair->first()->computeLengthInt(style(), zoomFactor);
4460
 
        int height = pair->second()->computeLengthInt(style(), zoomFactor);
 
4602
        int width = pair->first()->computeLengthInt(style(), m_rootElementStyle, zoomFactor);
 
4603
        int height = pair->second()->computeLengthInt(style(), m_rootElementStyle,  zoomFactor);
4461
4604
        if (width < 0 || height < 0)
4462
4605
            return;
4463
4606
 
4468
4611
 
4469
4612
        IntSize size(width, height);
4470
4613
        switch (id) {
4471
 
            case CSSPropertyWebkitBorderTopLeftRadius:
 
4614
            case CSSPropertyBorderTopLeftRadius:
4472
4615
                m_style->setBorderTopLeftRadius(size);
4473
4616
                break;
4474
 
            case CSSPropertyWebkitBorderTopRightRadius:
 
4617
            case CSSPropertyBorderTopRightRadius:
4475
4618
                m_style->setBorderTopRightRadius(size);
4476
4619
                break;
4477
 
            case CSSPropertyWebkitBorderBottomLeftRadius:
 
4620
            case CSSPropertyBorderBottomLeftRadius:
4478
4621
                m_style->setBorderBottomLeftRadius(size);
4479
4622
                break;
4480
 
            case CSSPropertyWebkitBorderBottomRightRadius:
 
4623
            case CSSPropertyBorderBottomRightRadius:
4481
4624
                m_style->setBorderBottomRightRadius(size);
4482
4625
                break;
4483
4626
            default:
4489
4632
 
4490
4633
    case CSSPropertyOutlineOffset:
4491
4634
        HANDLE_INHERIT_AND_INITIAL(outlineOffset, OutlineOffset)
4492
 
        m_style->setOutlineOffset(primitiveValue->computeLengthInt(style(), zoomFactor));
 
4635
        m_style->setOutlineOffset(primitiveValue->computeLengthInt(style(), m_rootElementStyle, zoomFactor));
4493
4636
        return;
4494
4637
 
4495
4638
    case CSSPropertyTextShadow:
4496
 
    case CSSPropertyWebkitBoxShadow: {
 
4639
    case CSSPropertyBoxShadow: {
4497
4640
        if (isInherit) {
4498
4641
            if (id == CSSPropertyTextShadow)
4499
4642
                return m_style->setTextShadow(m_parentStyle->textShadow() ? new ShadowData(*m_parentStyle->textShadow()) : 0);
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;
4515
4660
            Color color;
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);
4521
4666
            else
4537
4682
            if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
4538
4683
                reflection->setOffset(Length(reflectValue->offset()->getDoubleValue(), Percent));
4539
4684
            else
4540
 
                reflection->setOffset(Length(reflectValue->offset()->computeLengthIntForLength(style(), zoomFactor), Fixed));
 
4685
                reflection->setOffset(Length(reflectValue->offset()->computeLengthIntForLength(style(), m_rootElementStyle, zoomFactor), Fixed));
4541
4686
        }
4542
4687
        NinePieceImage mask;
4543
4688
        mapNinePieceImage(reflectValue->mask(), mask);
4567
4712
        return;
4568
4713
    case CSSPropertyUnicodeRange: // Only used in @font-face rules.
4569
4714
        return;
 
4715
    case CSSPropertyWebkitBackfaceVisibility:
 
4716
        HANDLE_INHERIT_AND_INITIAL(backfaceVisibility, BackfaceVisibility)
 
4717
        if (primitiveValue)
 
4718
            m_style->setBackfaceVisibility((primitiveValue->getIdent() == CSSValueVisible) ? BackfaceVisibilityVisible : BackfaceVisibilityHidden);
 
4719
        return;
4570
4720
    case CSSPropertyWebkitBoxDirection:
4571
 
        HANDLE_INHERIT_AND_INITIAL(boxDirection, BoxDirection)
4572
 
        if (primitiveValue)
4573
 
            m_style->setBoxDirection(*primitiveValue);
4574
 
        return;        
 
4721
        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(boxDirection, BoxDirection)
 
4722
        return;
4575
4723
    case CSSPropertyWebkitBoxLines:
4576
 
        HANDLE_INHERIT_AND_INITIAL(boxLines, BoxLines)
4577
 
        if (primitiveValue)
4578
 
            m_style->setBoxLines(*primitiveValue);
4579
 
        return;     
 
4724
        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(boxLines, BoxLines)
 
4725
        return;
4580
4726
    case CSSPropertyWebkitBoxOrient:
4581
 
        HANDLE_INHERIT_AND_INITIAL(boxOrient, BoxOrient)
4582
 
        if (primitiveValue)
4583
 
            m_style->setBoxOrient(*primitiveValue);
4584
 
        return;     
 
4727
        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(boxOrient, BoxOrient)
 
4728
        return;
4585
4729
    case CSSPropertyWebkitBoxPack:
4586
4730
    {
4587
4731
        HANDLE_INHERIT_AND_INITIAL(boxPack, BoxPack)
4603
4747
        if (!primitiveValue || primitiveValue->primitiveType() != CSSPrimitiveValue::CSS_NUMBER)
4604
4748
            return; // Error case.
4605
4749
        m_style->setBoxFlexGroup((unsigned int)(primitiveValue->getDoubleValue()));
4606
 
        return;        
 
4750
        return;
4607
4751
    case CSSPropertyWebkitBoxOrdinalGroup:
4608
4752
        HANDLE_INHERIT_AND_INITIAL(boxOrdinalGroup, BoxOrdinalGroup)
4609
4753
        if (!primitiveValue || primitiveValue->primitiveType() != CSSPrimitiveValue::CSS_NUMBER)
4644
4788
            m_style->setHasNormalColumnGap();
4645
4789
            return;
4646
4790
        }
4647
 
        m_style->setColumnGap(primitiveValue->computeLengthFloat(style(), zoomFactor));
 
4791
        m_style->setColumnGap(primitiveValue->computeLengthFloat(style(), m_rootElementStyle, zoomFactor));
4648
4792
        return;
4649
4793
    }
4650
4794
    case CSSPropertyWebkitColumnWidth: {
4658
4802
            m_style->setHasAutoColumnWidth();
4659
4803
            return;
4660
4804
        }
4661
 
        m_style->setColumnWidth(primitiveValue->computeLengthFloat(style(), zoomFactor));
 
4805
        m_style->setColumnWidth(primitiveValue->computeLengthFloat(style(), m_rootElementStyle, zoomFactor));
4662
4806
        return;
4663
4807
    }
4664
4808
    case CSSPropertyWebkitColumnRuleStyle:
4665
 
        HANDLE_INHERIT_AND_INITIAL_WITH_VALUE(columnRuleStyle, ColumnRuleStyle, BorderStyle)
4666
 
        m_style->setColumnRuleStyle(*primitiveValue);
4667
 
        return;
4668
 
    case CSSPropertyWebkitColumnBreakBefore: {
4669
 
        HANDLE_INHERIT_AND_INITIAL_WITH_VALUE(columnBreakBefore, ColumnBreakBefore, PageBreak)
4670
 
        m_style->setColumnBreakBefore(*primitiveValue);
4671
 
        return;
4672
 
    }
4673
 
    case CSSPropertyWebkitColumnBreakAfter: {
4674
 
        HANDLE_INHERIT_AND_INITIAL_WITH_VALUE(columnBreakAfter, ColumnBreakAfter, PageBreak)
4675
 
        m_style->setColumnBreakAfter(*primitiveValue);
4676
 
        return;
4677
 
    }
 
4809
        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE_WITH_VALUE(columnRuleStyle, ColumnRuleStyle, BorderStyle)
 
4810
        return;
 
4811
    case CSSPropertyWebkitColumnBreakBefore:
 
4812
        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE_WITH_VALUE(columnBreakBefore, ColumnBreakBefore, PageBreak)
 
4813
        return;
 
4814
    case CSSPropertyWebkitColumnBreakAfter:
 
4815
        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE_WITH_VALUE(columnBreakAfter, ColumnBreakAfter, PageBreak)
 
4816
        return;
4678
4817
    case CSSPropertyWebkitColumnBreakInside: {
4679
4818
        HANDLE_INHERIT_AND_INITIAL_WITH_VALUE(columnBreakInside, ColumnBreakInside, PageBreak)
4680
4819
        EPageBreak pb = *primitiveValue;
4711
4850
        m_style->setMarqueeLoopCount(m_parentStyle->marqueeLoopCount());
4712
4851
        m_style->setMarqueeBehavior(m_parentStyle->marqueeBehavior());
4713
4852
        return;
 
4853
#if ENABLE(WCSS)
 
4854
    case CSSPropertyWapMarqueeLoop:
 
4855
#endif
4714
4856
    case CSSPropertyWebkitMarqueeRepetition: {
4715
4857
        HANDLE_INHERIT_AND_INITIAL(marqueeLoopCount, MarqueeLoopCount)
4716
4858
        if (!primitiveValue)
4721
4863
            m_style->setMarqueeLoopCount(primitiveValue->getIntValue());
4722
4864
        return;
4723
4865
    }
 
4866
#if ENABLE(WCSS)
 
4867
    case CSSPropertyWapMarqueeSpeed:
 
4868
#endif
4724
4869
    case CSSPropertyWebkitMarqueeSpeed: {
4725
4870
        HANDLE_INHERIT_AND_INITIAL(marqueeSpeed, MarqueeSpeed)      
4726
4871
        if (!primitiveValue)
4765
4910
        }
4766
4911
        else {
4767
4912
            bool ok = true;
4768
 
            Length l = convertToLength(primitiveValue, style(), &ok);
 
4913
            Length l = convertToLength(primitiveValue, style(), m_rootElementStyle, 1, &ok);
4769
4914
            if (ok)
4770
4915
                m_style->setMarqueeIncrement(l);
4771
4916
        }
4772
4917
        return;
4773
4918
    }
4774
 
    case CSSPropertyWebkitMarqueeStyle: {
4775
 
        HANDLE_INHERIT_AND_INITIAL(marqueeBehavior, MarqueeBehavior)      
4776
 
        if (primitiveValue)
4777
 
            m_style->setMarqueeBehavior(*primitiveValue);
 
4919
#if ENABLE(WCSS)
 
4920
    case CSSPropertyWapMarqueeStyle:
 
4921
#endif
 
4922
    case CSSPropertyWebkitMarqueeStyle:
 
4923
        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(marqueeBehavior, MarqueeBehavior)      
4778
4924
        return;
4779
 
    }
4780
 
    case CSSPropertyWebkitMarqueeDirection: {
 
4925
#if ENABLE(WCSS)
 
4926
    case CSSPropertyWapMarqueeDir:
4781
4927
        HANDLE_INHERIT_AND_INITIAL(marqueeDirection, MarqueeDirection)
4782
 
        if (primitiveValue)
4783
 
            m_style->setMarqueeDirection(*primitiveValue);
4784
 
        return;
4785
 
    }
4786
 
    case CSSPropertyWebkitUserDrag: {
4787
 
        HANDLE_INHERIT_AND_INITIAL(userDrag, UserDrag)      
4788
 
        if (primitiveValue)
4789
 
            m_style->setUserDrag(*primitiveValue);
4790
 
        return;
4791
 
    }
4792
 
    case CSSPropertyWebkitUserModify: {
4793
 
        HANDLE_INHERIT_AND_INITIAL(userModify, UserModify)      
4794
 
        if (primitiveValue)
4795
 
            m_style->setUserModify(*primitiveValue);
4796
 
        return;
4797
 
    }
4798
 
    case CSSPropertyWebkitUserSelect: {
4799
 
        HANDLE_INHERIT_AND_INITIAL(userSelect, UserSelect)      
4800
 
        if (primitiveValue)
4801
 
            m_style->setUserSelect(*primitiveValue);
4802
 
        return;
4803
 
    }
 
4928
        if (primitiveValue && primitiveValue->getIdent()) {
 
4929
            switch (primitiveValue->getIdent()) {
 
4930
            case CSSValueLtr:
 
4931
                m_style->setMarqueeDirection(MRIGHT);
 
4932
                break;
 
4933
            case CSSValueRtl:
 
4934
                m_style->setMarqueeDirection(MLEFT);
 
4935
                break;
 
4936
            default:
 
4937
                m_style->setMarqueeDirection(*primitiveValue);
 
4938
                break;
 
4939
            }
 
4940
        }
 
4941
        return;
 
4942
#endif
 
4943
    case CSSPropertyWebkitMarqueeDirection:
 
4944
        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(marqueeDirection, MarqueeDirection)
 
4945
        return;
 
4946
    case CSSPropertyWebkitUserDrag:
 
4947
        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(userDrag, UserDrag)      
 
4948
        return;
 
4949
    case CSSPropertyWebkitUserModify:
 
4950
        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(userModify, UserModify)      
 
4951
        return;
 
4952
    case CSSPropertyWebkitUserSelect:
 
4953
        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(userSelect, UserSelect)      
 
4954
        return;
 
4955
 
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.
4821
4973
        }
4822
4974
        return;
4823
4975
    }
4824
 
    case CSSPropertyWebkitMarginTopCollapse: {
4825
 
        HANDLE_INHERIT_AND_INITIAL(marginTopCollapse, MarginTopCollapse)
4826
 
        if (primitiveValue)
4827
 
            m_style->setMarginTopCollapse(*primitiveValue);
4828
 
        return;
4829
 
    }
4830
 
    case CSSPropertyWebkitMarginBottomCollapse: {
4831
 
        HANDLE_INHERIT_AND_INITIAL(marginBottomCollapse, MarginBottomCollapse)
4832
 
        if (primitiveValue)
4833
 
            m_style->setMarginBottomCollapse(*primitiveValue);
4834
 
        return;
4835
 
    }
 
4976
 
 
4977
    case CSSPropertyWebkitMarginTopCollapse:
 
4978
        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(marginTopCollapse, MarginTopCollapse)
 
4979
        return;
 
4980
    case CSSPropertyWebkitMarginBottomCollapse:
 
4981
        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(marginBottomCollapse, MarginBottomCollapse)
 
4982
        return;
4836
4983
 
4837
4984
    // Apple-specific changes.  Do not merge these properties into KHTML.
4838
4985
    case CSSPropertyWebkitLineClamp: {
4865
5012
        m_fontDirty = true;
4866
5013
        return;
4867
5014
    }
4868
 
    case CSSPropertyWebkitTextSecurity: {
4869
 
        HANDLE_INHERIT_AND_INITIAL(textSecurity, TextSecurity)
4870
 
        if (primitiveValue)
4871
 
            m_style->setTextSecurity(*primitiveValue);
 
5015
    case CSSPropertyWebkitTextSecurity:
 
5016
        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(textSecurity, TextSecurity)
4872
5017
        return;
4873
 
    }
 
5018
 
4874
5019
#if ENABLE(DASHBOARD_SUPPORT)
4875
5020
    case CSSPropertyWebkitDashboardRegion: {
4876
5021
        HANDLE_INHERIT_AND_INITIAL(dashboardRegions, DashboardRegions)
4888
5033
            
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)
4922
5067
                    result *= 3;
4923
5068
                else if (primitiveValue->getIdent() == CSSValueThick)
4924
5069
                    result *= 5;
4925
 
                width = CSSPrimitiveValue::create(result, CSSPrimitiveValue::CSS_EMS)->computeLengthFloat(style(), zoomFactor);
 
5070
                width = CSSPrimitiveValue::create(result, CSSPrimitiveValue::CSS_EMS)->computeLengthFloat(style(), m_rootElementStyle, zoomFactor);
4926
5071
                break;
4927
5072
            }
4928
5073
            default:
4929
 
                width = primitiveValue->computeLengthFloat(style(), zoomFactor);
 
5074
                width = primitiveValue->computeLengthFloat(style(), m_rootElementStyle, zoomFactor);
4930
5075
                break;
4931
5076
        }
4932
5077
        m_style->setTextStrokeWidth(width);
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);
4940
5085
        return;
4941
5086
    }
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)
4945
5091
        return;
4946
5092
    case CSSPropertyWebkitTransformOriginX: {
4947
5093
        HANDLE_INHERIT_AND_INITIAL(transformOriginX, TransformOriginX)
4948
5094
        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
4949
5095
        Length l;
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);
4955
5101
        else
4962
5108
        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
4963
5109
        Length l;
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);
4969
5115
        else
4970
5116
            return;
4971
5117
        m_style->setTransformOriginY(l);
4972
5118
        break;
4973
5119
    }
 
5120
    case CSSPropertyWebkitTransformOriginZ: {
 
5121
        HANDLE_INHERIT_AND_INITIAL(transformOriginZ, TransformOriginZ)
 
5122
        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
 
5123
        float f;
 
5124
        int type = primitiveValue->primitiveType();
 
5125
        if (CSSPrimitiveValue::isUnitTypeLength(type))
 
5126
            f = static_cast<float>(primitiveValue->computeLengthIntForLength(style(), m_rootElementStyle));
 
5127
        else
 
5128
            return;
 
5129
        m_style->setTransformOriginZ(f);
 
5130
        break;
 
5131
    }
 
5132
    case CSSPropertyWebkitTransformStyle:
 
5133
        HANDLE_INHERIT_AND_INITIAL(transformStyle3D, TransformStyle3D)
 
5134
        if (primitiveValue)
 
5135
            m_style->setTransformStyle3D((primitiveValue->getIdent() == CSSValuePreserve3d) ? TransformStyle3DPreserve3D : TransformStyle3DFlat);
 
5136
        return;
 
5137
    case CSSPropertyWebkitPerspective: {
 
5138
        HANDLE_INHERIT_AND_INITIAL(perspective, Perspective)
 
5139
        if (primitiveValue && primitiveValue->getIdent() == CSSValueNone) {
 
5140
            m_style->setPerspective(0);
 
5141
            return;
 
5142
        }
 
5143
        
 
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);
 
5151
        } else
 
5152
            return;
 
5153
 
 
5154
        if (perspectiveValue >= 0.0f)
 
5155
            m_style->setPerspective(perspectiveValue);
 
5156
        return;
 
5157
    }
 
5158
    case CSSPropertyWebkitPerspectiveOrigin:
 
5159
        HANDLE_INHERIT_AND_INITIAL(perspectiveOriginX, PerspectiveOriginX)
 
5160
        HANDLE_INHERIT_AND_INITIAL(perspectiveOriginY, PerspectiveOriginY)
 
5161
        return;
 
5162
    case CSSPropertyWebkitPerspectiveOriginX: {
 
5163
        HANDLE_INHERIT_AND_INITIAL(perspectiveOriginX, PerspectiveOriginX)
 
5164
        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
 
5165
        Length l;
 
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);
 
5171
        else
 
5172
            return;
 
5173
        m_style->setPerspectiveOriginX(l);
 
5174
        return;
 
5175
    }
 
5176
    case CSSPropertyWebkitPerspectiveOriginY: {
 
5177
        HANDLE_INHERIT_AND_INITIAL(perspectiveOriginY, PerspectiveOriginY)
 
5178
        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
 
5179
        Length l;
 
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);
 
5185
        else
 
5186
            return;
 
5187
        m_style->setPerspectiveOriginY(l);
 
5188
        return;
 
5189
    }
4974
5190
    case CSSPropertyWebkitAnimation:
4975
5191
        if (isInitial)
4976
5192
            m_style->clearAnimations();
5018
5234
        return;
5019
5235
    case CSSPropertyPointerEvents:
5020
5236
    {
 
5237
#if ENABLE(DASHBOARD_SUPPORT)
 
5238
        // <rdar://problem/6561077> Work around the Stocks widget's misuse of the
 
5239
        // pointer-events property by not applying it in Dashboard.
 
5240
        Settings* settings = m_checker.m_document->settings();
 
5241
        if (settings && settings->usesDashboardBackwardCompatibilityMode())
 
5242
            return;
 
5243
#endif
5021
5244
        HANDLE_INHERIT_AND_INITIAL(pointerEvents, PointerEvents)
5022
5245
        if (!primitiveValue)
5023
5246
            return;
5029
5252
    case CSSPropertyFontStretch:
5030
5253
    case CSSPropertyPage:
5031
5254
    case CSSPropertyQuotes:
5032
 
    case CSSPropertyScrollbar3dlightColor:
5033
 
    case CSSPropertyScrollbarArrowColor:
5034
 
    case CSSPropertyScrollbarDarkshadowColor:
5035
 
    case CSSPropertyScrollbarFaceColor:
5036
 
    case CSSPropertyScrollbarHighlightColor:
5037
 
    case CSSPropertyScrollbarShadowColor:
5038
 
    case CSSPropertyScrollbarTrackColor:
5039
5255
    case CSSPropertySize:
5040
5256
    case CSSPropertyTextLineThrough:
5041
5257
    case CSSPropertyTextLineThroughColor:
5057
5273
    case CSSPropertyWebkitPaddingStart:
5058
5274
    case CSSPropertyWebkitTextDecorationsInEffect:
5059
5275
    case CSSPropertyWebkitTextStroke:
 
5276
    case CSSPropertyWebkitVariableDeclarationBlock:
5060
5277
        return;
5061
5278
#if ENABLE(SVG)
5062
5279
    default:
5079
5296
    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
5080
5297
    switch (primitiveValue->getIdent()) {
5081
5298
        case CSSValueFixed:
5082
 
            layer->setAttachment(false);
 
5299
            layer->setAttachment(FixedBackgroundAttachment);
5083
5300
            break;
5084
5301
        case CSSValueScroll:
5085
 
            layer->setAttachment(true);
 
5302
            layer->setAttachment(ScrollBackgroundAttachment);
 
5303
            break;
 
5304
        case CSSValueLocal:
 
5305
            layer->setAttachment(LocalBackgroundAttachment);
5086
5306
            break;
5087
5307
        default:
5088
5308
            return;
5150
5370
    layer->setImage(styleImage(value));
5151
5371
}
5152
5372
 
5153
 
void CSSStyleSelector::mapFillRepeat(FillLayer* layer, CSSValue* value)
5154
 
{
5155
 
    if (value->cssValueType() == CSSValue::CSS_INITIAL) {
5156
 
        layer->setRepeat(FillLayer::initialFillRepeat(layer->type()));
5157
 
        return;
5158
 
    }
5159
 
    
5160
 
    if (!value->isPrimitiveValue())
5161
 
        return;
5162
 
 
5163
 
    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
5164
 
    layer->setRepeat(*primitiveValue);
 
5373
void CSSStyleSelector::mapFillRepeatX(FillLayer* layer, CSSValue* value)
 
5374
{
 
5375
    if (value->cssValueType() == CSSValue::CSS_INITIAL) {
 
5376
        layer->setRepeatX(FillLayer::initialFillRepeatX(layer->type()));
 
5377
        return;
 
5378
    }
 
5379
    
 
5380
    if (!value->isPrimitiveValue())
 
5381
        return;
 
5382
 
 
5383
    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
 
5384
    layer->setRepeatX(*primitiveValue);
 
5385
}
 
5386
 
 
5387
void CSSStyleSelector::mapFillRepeatY(FillLayer* layer, CSSValue* value)
 
5388
{
 
5389
    if (value->cssValueType() == CSSValue::CSS_INITIAL) {
 
5390
        layer->setRepeatY(FillLayer::initialFillRepeatY(layer->type()));
 
5391
        return;
 
5392
    }
 
5393
    
 
5394
    if (!value->isPrimitiveValue())
 
5395
        return;
 
5396
 
 
5397
    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
 
5398
    layer->setRepeatY(*primitiveValue);
5165
5399
}
5166
5400
 
5167
5401
void CSSStyleSelector::mapFillSize(FillLayer* layer, CSSValue* value)
5168
5402
{
5169
 
    LengthSize b = FillLayer::initialFillSize(layer->type());
5170
 
    
5171
 
    if (value->cssValueType() == CSSValue::CSS_INITIAL) {
5172
 
        layer->setSize(b);
 
5403
    if (!value->isPrimitiveValue()) {
 
5404
        layer->setSizeType(SizeNone);
5173
5405
        return;
5174
5406
    }
5175
 
    
5176
 
    if (!value->isPrimitiveValue())
5177
 
        return;
5178
 
        
 
5407
 
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);
 
5413
    else
 
5414
        layer->setSizeType(SizeLength);
 
5415
    
 
5416
    LengthSize b = FillLayer::initialFillSizeLength(layer->type());
 
5417
    
 
5418
    if (value->cssValueType() == CSSValue::CSS_INITIAL || primitiveValue->getIdent() == CSSValueContain
 
5419
        || primitiveValue->getIdent() == CSSValueCover) {
 
5420
        layer->setSizeLength(b);
 
5421
        return;
 
5422
    }
 
5423
 
5180
5424
    Pair* pair = primitiveValue->getPairValue();
5181
5425
    if (!pair)
5182
5426
        return;
5195
5439
 
5196
5440
    if (firstType == CSSPrimitiveValue::CSS_UNKNOWN)
5197
5441
        firstLength = Length(Auto);
5198
 
    else if (firstType > CSSPrimitiveValue::CSS_PERCENTAGE && firstType < CSSPrimitiveValue::CSS_DEG)
5199
 
        firstLength = Length(first->computeLengthIntForLength(style(), zoomFactor), Fixed);
 
5442
    else if (CSSPrimitiveValue::isUnitTypeLength(firstType))
 
5443
        firstLength = Length(first->computeLengthIntForLength(style(), m_rootElementStyle, zoomFactor), Fixed);
5200
5444
    else if (firstType == CSSPrimitiveValue::CSS_PERCENTAGE)
5201
5445
        firstLength = Length(first->getDoubleValue(), Percent);
5202
5446
    else
5204
5448
 
5205
5449
    if (secondType == CSSPrimitiveValue::CSS_UNKNOWN)
5206
5450
        secondLength = Length(Auto);
5207
 
    else if (secondType > CSSPrimitiveValue::CSS_PERCENTAGE && secondType < CSSPrimitiveValue::CSS_DEG)
5208
 
        secondLength = Length(second->computeLengthIntForLength(style(), zoomFactor), Fixed);
 
5451
    else if (CSSPrimitiveValue::isUnitTypeLength(secondType))
 
5452
        secondLength = Length(second->computeLengthIntForLength(style(), m_rootElementStyle, zoomFactor), Fixed);
5209
5453
    else if (secondType == CSSPrimitiveValue::CSS_PERCENTAGE)
5210
5454
        secondLength = Length(second->getDoubleValue(), Percent);
5211
5455
    else
5213
5457
    
5214
5458
    b.setWidth(firstLength);
5215
5459
    b.setHeight(secondLength);
5216
 
    layer->setSize(b);
 
5460
    layer->setSizeLength(b);
5217
5461
}
5218
5462
 
5219
5463
void CSSStyleSelector::mapFillXPosition(FillLayer* layer, CSSValue* value)
5231
5475
    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
5232
5476
    Length l;
5233
5477
    int type = primitiveValue->primitiveType();
5234
 
    if (type > CSSPrimitiveValue::CSS_PERCENTAGE && type < CSSPrimitiveValue::CSS_DEG)
5235
 
        l = Length(primitiveValue->computeLengthIntForLength(style(), zoomFactor), Fixed);
 
5478
    if (CSSPrimitiveValue::isUnitTypeLength(type))
 
5479
        l = Length(primitiveValue->computeLengthIntForLength(style(), m_rootElementStyle, zoomFactor), Fixed);
5236
5480
    else if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
5237
5481
        l = Length(primitiveValue->getDoubleValue(), Percent);
5238
5482
    else
5255
5499
    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
5256
5500
    Length l;
5257
5501
    int type = primitiveValue->primitiveType();
5258
 
    if (type > CSSPrimitiveValue::CSS_PERCENTAGE && type < CSSPrimitiveValue::CSS_DEG)
5259
 
        l = Length(primitiveValue->computeLengthIntForLength(style(), zoomFactor), Fixed);
 
5502
    if (CSSPrimitiveValue::isUnitTypeLength(type))
 
5503
        l = Length(primitiveValue->computeLengthIntForLength(style(), m_rootElementStyle, zoomFactor), Fixed);
5260
5504
    else if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
5261
5505
        l = Length(primitiveValue->getDoubleValue(), Percent);
5262
5506
    else
5286
5530
    }
5287
5531
 
5288
5532
    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
5289
 
    layer->setDirection(primitiveValue->getIdent() == CSSValueAlternate);
 
5533
    layer->setDirection(primitiveValue->getIdent() == CSSValueAlternate ? Animation::AnimationDirectionAlternate : Animation::AnimationDirectionNormal);
5290
5534
}
5291
5535
 
5292
5536
void CSSStyleSelector::mapAnimationDuration(Animation* animation, CSSValue* value)
5346
5590
    }
5347
5591
 
5348
5592
    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
5349
 
    layer->setPlayState((primitiveValue->getIdent() == CSSValuePaused) ? AnimPlayStatePaused : AnimPlayStatePlaying);
 
5593
    EAnimPlayState playState = (primitiveValue->getIdent() == CSSValuePaused) ? AnimPlayStatePaused : AnimPlayStatePlaying;
 
5594
    layer->setPlayState(playState);
5350
5595
}
5351
5596
 
5352
5597
void CSSStyleSelector::mapAnimationProperty(Animation* animation, CSSValue* value)
5490
5735
        return;
5491
5736
 
5492
5737
    const FontDescription& parentFont = parentStyle->fontDescription();
5493
 
 
5494
 
    if (childFont.genericFamily() == parentFont.genericFamily())
 
5738
    if (childFont.useFixedDefaultSize() == parentFont.useFixedDefaultSize())
5495
5739
        return;
5496
5740
 
5497
5741
    // For now, lump all families but monospace together.
5504
5748
    // If the font uses a keyword size, then we refetch from the table rather than
5505
5749
    // multiplying by our scale factor.
5506
5750
    float size;
5507
 
    if (childFont.keywordSize()) {
5508
 
        size = fontSizeForKeyword(CSSValueXxSmall + childFont.keywordSize() - 1, style->htmlHacks(),
5509
 
                                  childFont.genericFamily() == FontDescription::MonospaceFamily);
5510
 
    } else {
 
5751
    if (childFont.keywordSize())
 
5752
        size = fontSizeForKeyword(CSSValueXxSmall + childFont.keywordSize() - 1, style->htmlHacks(), childFont.useFixedDefaultSize());
 
5753
    else {
5511
5754
        Settings* settings = m_checker.m_document->settings();
5512
5755
        float fixedScaleFactor = settings
5513
5756
            ? static_cast<float>(settings->defaultFixedFontSize()) / settings->defaultFontSize()
5514
5757
            : 1;
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;
5518
5761
    }
5519
5762
 
5520
5763
    FontDescription newFontDescription(childFont);
5678
5921
        if (col->cssValueId == cssValueId)
5679
5922
            return col->color;
5680
5923
    }
5681
 
    return theme()->systemColor(cssValueId);
 
5924
    return RenderTheme::defaultTheme()->systemColor(cssValueId);
5682
5925
}
5683
5926
 
5684
5927
Color CSSStyleSelector::getColorFromPrimitiveValue(CSSPrimitiveValue* primitiveValue)
5701
5944
        } else if (ident == CSSValueWebkitActivelink)
5702
5945
            col = m_element->document()->activeLinkColor();
5703
5946
        else if (ident == CSSValueWebkitFocusRingColor)
5704
 
            col = focusRingColor();
 
5947
            col = RenderTheme::focusRingColor();
5705
5948
        else if (ident == CSSValueCurrentcolor)
5706
5949
            col = m_style->color();
5707
5950
        else
5708
5951
            col = colorForCSSValue(ident);
5709
5952
    } else if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_RGBCOLOR)
5710
 
        col.setRGB(primitiveValue->getRGBColorValue());
 
5953
        col.setRGB(primitiveValue->getRGBA32Value());
5711
5954
    return col;
5712
5955
}
5713
5956
 
5737
5980
        return;
5738
5981
    for (Node* node = m_document; node; node = node->traverseNextNode()) {
5739
5982
        if (node->isLink())
5740
 
            node->setChanged();
 
5983
            node->setNeedsStyleRecalc();
5741
5984
    }
5742
5985
}
5743
5986
 
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)
5751
 
            node->setChanged();
 
5994
            node->setNeedsStyleRecalc();
5752
5995
    }
5753
5996
}
5754
5997
 
5755
 
TransformOperation::OperationType getTransformOperationType(WebKitCSSTransformValue::TransformOperationType type)
 
5998
static TransformOperation::OperationType getTransformOperationType(WebKitCSSTransformValue::TransformOperationType type)
5756
5999
{
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;
5770
6023
    }
5771
6024
    return TransformOperation::NONE;
5772
6025
}
5773
6026
 
5774
 
bool CSSStyleSelector::createTransformOperations(CSSValue* inValue, RenderStyle* inStyle, TransformOperations& outOperations)
 
6027
bool CSSStyleSelector::createTransformOperations(CSSValue* inValue, RenderStyle* style, RenderStyle* rootStyle, TransformOperations& outOperations)
5775
6028
{
 
6029
    float zoomFactor = style ? style->effectiveZoom() : 1;
 
6030
 
5776
6031
    TransformOperations operations;
5777
6032
    if (inValue && !inValue->isPrimitiveValue()) {
5778
6033
        CSSValueList* list = static_cast<CSSValueList*>(inValue);
5800
6055
                                sy = sx;
5801
6056
                        }
5802
6057
                    }
5803
 
                    operations.operations().append(ScaleTransformOperation::create(sx, sy, getTransformOperationType(val->operationType())));
 
6058
                    operations.operations().append(ScaleTransformOperation::create(sx, sy, 1.0, getTransformOperationType(val->operationType())));
 
6059
                    break;
 
6060
                }
 
6061
                case WebKitCSSTransformValue::ScaleZTransformOperation:
 
6062
                case WebKitCSSTransformValue::Scale3DTransformOperation: {
 
6063
                    double sx = 1.0;
 
6064
                    double sy = 1.0;
 
6065
                    double sz = 1.0;
 
6066
                    if (val->operationType() == WebKitCSSTransformValue::ScaleZTransformOperation)
 
6067
                        sz = firstValue->getDoubleValue();
 
6068
                    else if (val->operationType() == WebKitCSSTransformValue::ScaleYTransformOperation)
 
6069
                        sy = firstValue->getDoubleValue();
 
6070
                    else { 
 
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();
 
6076
                            }
 
6077
                            if (val->length() > 1) {
 
6078
                                CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(1));
 
6079
                                sy = secondValue->getDoubleValue();
 
6080
                            } else 
 
6081
                                sy = sx;
 
6082
                        }
 
6083
                    }
 
6084
                    operations.operations().append(ScaleTransformOperation::create(sx, sy, sz, getTransformOperationType(val->operationType())));
5804
6085
                    break;
5805
6086
                }
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);
5814
 
                    else { 
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);
5820
 
                            }
5821
 
                        }
5822
 
                    }
5823
 
 
5824
 
                    if (!ok)
5825
 
                        return false;
5826
 
 
5827
 
                    operations.operations().append(TranslateTransformOperation::create(tx, ty, getTransformOperationType(val->operationType())));
 
6094
                        ty = convertToLength(firstValue, style, rootStyle, zoomFactor, &ok);
 
6095
                    else { 
 
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);
 
6101
                            }
 
6102
                        }
 
6103
                    }
 
6104
 
 
6105
                    if (!ok)
 
6106
                        return false;
 
6107
 
 
6108
                    operations.operations().append(TranslateTransformOperation::create(tx, ty, Length(0, Fixed), getTransformOperationType(val->operationType())));
 
6109
                    break;
 
6110
                }
 
6111
                case WebKitCSSTransformValue::TranslateZTransformOperation:
 
6112
                case WebKitCSSTransformValue::Translate3DTransformOperation: {
 
6113
                    bool ok = true;
 
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);
 
6121
                    else { 
 
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);
 
6127
                            }
 
6128
                            if (val->length() > 1) {
 
6129
                                CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(1));
 
6130
                                ty = convertToLength(secondValue, style, rootStyle, zoomFactor, &ok);
 
6131
                            }
 
6132
                        }
 
6133
                    }
 
6134
 
 
6135
                    if (!ok)
 
6136
                        return false;
 
6137
 
 
6138
                    operations.operations().append(TranslateTransformOperation::create(tx, ty, tz, getTransformOperationType(val->operationType())));
5828
6139
                    break;
5829
6140
                }
5830
6141
                case WebKitCSSTransformValue::RotateTransformOperation: {
5836
6147
                    else if (firstValue->primitiveType() == CSSPrimitiveValue::CSS_TURN)
5837
6148
                        angle = turn2deg(angle);
5838
6149
                    
5839
 
                    operations.operations().append(RotateTransformOperation::create(angle, getTransformOperationType(val->operationType())));
 
6150
                    operations.operations().append(RotateTransformOperation::create(0, 0, 1, angle, getTransformOperationType(val->operationType())));
 
6151
                    break;
 
6152
                }
 
6153
                case WebKitCSSTransformValue::RotateXTransformOperation:
 
6154
                case WebKitCSSTransformValue::RotateYTransformOperation:
 
6155
                case WebKitCSSTransformValue::RotateZTransformOperation: {
 
6156
                    double x = 0;
 
6157
                    double y = 0;
 
6158
                    double z = 0;
 
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);
 
6164
                    
 
6165
                    if (val->operationType() == WebKitCSSTransformValue::RotateXTransformOperation)
 
6166
                        x = 1;
 
6167
                    else if (val->operationType() == WebKitCSSTransformValue::RotateYTransformOperation)
 
6168
                        y = 1;
 
6169
                    else
 
6170
                        z = 1;
 
6171
                    operations.operations().append(RotateTransformOperation::create(x, y, z, angle, getTransformOperationType(val->operationType())));
 
6172
                    break;
 
6173
                }
 
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())));
5840
6187
                    break;
5841
6188
                }
5842
6189
                case WebKitCSSTransformValue::SkewTransformOperation:
5872
6219
                    break;
5873
6220
                }
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));
5882
6229
                    break;
5883
6230
                }
 
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));
 
6249
                    break;
 
6250
                }   
 
6251
                case WebKitCSSTransformValue::PerspectiveTransformOperation: {
 
6252
                    double p = firstValue->getDoubleValue();
 
6253
                    if (p < 0.0)
 
6254
                        return false;
 
6255
                    operations.operations().append(PerspectiveTransformOperation::create(p));
 
6256
                    break;
 
6257
                }
5884
6258
                case WebKitCSSTransformValue::UnknownTransformOperation:
5885
6259
                    ASSERT_NOT_REACHED();
5886
6260
                    break;