OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
4 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) |
5 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) | 5 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) |
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
All rights reserved. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
All rights reserved. |
7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> | 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> |
9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
10 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. | 10 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 } | 565 } |
566 | 566 |
567 void StyleBuilderFunctions::applyValueCSSPropertyWebkitClipPath(StyleResolverSta
te& state, CSSValue* value) | 567 void StyleBuilderFunctions::applyValueCSSPropertyWebkitClipPath(StyleResolverSta
te& state, CSSValue* value) |
568 { | 568 { |
569 if (value->isPrimitiveValue()) { | 569 if (value->isPrimitiveValue()) { |
570 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 570 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
571 if (primitiveValue->getValueID() == CSSValueNone) { | 571 if (primitiveValue->getValueID() == CSSValueNone) { |
572 state.style()->setClipPath(nullptr); | 572 state.style()->setClipPath(nullptr); |
573 } else if (primitiveValue->isShape()) { | 573 } else if (primitiveValue->isShape()) { |
574 state.style()->setClipPath(ShapeClipPathOperation::create(basicShape
ForValue(state, primitiveValue->getShapeValue()))); | 574 state.style()->setClipPath(ShapeClipPathOperation::create(basicShape
ForValue(state, primitiveValue->getShapeValue()))); |
575 } else if (primitiveValue->isURI()) { | |
576 String cssURLValue = primitiveValue->getStringValue(); | |
577 KURL url = state.document().completeURL(cssURLValue); | |
578 // FIXME: It doesn't work with forward or external SVG references (s
ee https://bugs.webkit.org/show_bug.cgi?id=90405) | |
579 state.style()->setClipPath(ReferenceClipPathOperation::create(cssURL
Value, AtomicString(url.fragmentIdentifier()))); | |
580 } | 575 } |
| 576 } else if (value->isStringValue() && toCSSStringValue(value)->serializationT
ype() == CSSStringValue::SerializeAsURI) { |
| 577 String cssURLValue = toCSSStringValue(value)->getStringValue(); |
| 578 KURL url = state.document().completeURL(cssURLValue); |
| 579 // FIXME: It doesn't work with forward or external SVG references (see h
ttps://bugs.webkit.org/show_bug.cgi?id=90405) |
| 580 state.style()->setClipPath(ReferenceClipPathOperation::create(cssURLValu
e, AtomicString(url.fragmentIdentifier()))); |
581 } | 581 } |
582 } | 582 } |
583 | 583 |
584 void StyleBuilderFunctions::applyValueCSSPropertyWebkitFilter(StyleResolverState
& state, CSSValue* value) | 584 void StyleBuilderFunctions::applyValueCSSPropertyWebkitFilter(StyleResolverState
& state, CSSValue* value) |
585 { | 585 { |
586 // FIXME: We should just make this a converter | 586 // FIXME: We should just make this a converter |
587 FilterOperations operations; | 587 FilterOperations operations; |
588 FilterOperationResolver::createFilterOperations(*value, state.cssToLengthCon
versionData(), operations, state); | 588 FilterOperationResolver::createFilterOperations(*value, state.cssToLengthCon
versionData(), operations, state); |
589 state.style()->setFilter(operations); | 589 state.style()->setFilter(operations); |
590 } | 590 } |
(...skipping 21 matching lines...) Expand all Loading... |
612 CSSPrimitiveValue* value = toCSSPrimitiveValue(list->item(i)); | 612 CSSPrimitiveValue* value = toCSSPrimitiveValue(list->item(i)); |
613 if (value->getValueID() == CSSValueFilled || value->getValueID() ==
CSSValueOpen) | 613 if (value->getValueID() == CSSValueFilled || value->getValueID() ==
CSSValueOpen) |
614 state.style()->setTextEmphasisFill(*value); | 614 state.style()->setTextEmphasisFill(*value); |
615 else | 615 else |
616 state.style()->setTextEmphasisMark(*value); | 616 state.style()->setTextEmphasisMark(*value); |
617 } | 617 } |
618 state.style()->setTextEmphasisCustomMark(nullAtom); | 618 state.style()->setTextEmphasisCustomMark(nullAtom); |
619 return; | 619 return; |
620 } | 620 } |
621 | 621 |
| 622 if (value->isStringValue() && toCSSStringValue(value)->serializationType() =
= CSSStringValue::SerializeAsString) { |
| 623 state.style()->setTextEmphasisFill(TextEmphasisFillFilled); |
| 624 state.style()->setTextEmphasisMark(TextEmphasisMarkCustom); |
| 625 state.style()->setTextEmphasisCustomMark(AtomicString(toCSSStringValue(v
alue)->getStringValue())); |
| 626 return; |
| 627 } |
| 628 |
622 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 629 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
623 | |
624 if (primitiveValue->isString()) { | |
625 state.style()->setTextEmphasisFill(TextEmphasisFillFilled); | |
626 state.style()->setTextEmphasisMark(TextEmphasisMarkCustom); | |
627 state.style()->setTextEmphasisCustomMark(AtomicString(primitiveValue->ge
tStringValue())); | |
628 return; | |
629 } | |
630 | |
631 state.style()->setTextEmphasisCustomMark(nullAtom); | 630 state.style()->setTextEmphasisCustomMark(nullAtom); |
632 | 631 |
633 if (primitiveValue->getValueID() == CSSValueFilled || primitiveValue->getVal
ueID() == CSSValueOpen) { | 632 if (primitiveValue->getValueID() == CSSValueFilled || primitiveValue->getVal
ueID() == CSSValueOpen) { |
634 state.style()->setTextEmphasisFill(*primitiveValue); | 633 state.style()->setTextEmphasisFill(*primitiveValue); |
635 state.style()->setTextEmphasisMark(TextEmphasisMarkAuto); | 634 state.style()->setTextEmphasisMark(TextEmphasisMarkAuto); |
636 } else { | 635 } else { |
637 state.style()->setTextEmphasisFill(TextEmphasisFillFilled); | 636 state.style()->setTextEmphasisFill(TextEmphasisFillFilled); |
638 state.style()->setTextEmphasisMark(*primitiveValue); | 637 state.style()->setTextEmphasisMark(*primitiveValue); |
639 } | 638 } |
640 } | 639 } |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 } | 721 } |
723 | 722 |
724 if (item->isFunctionValue()) { | 723 if (item->isFunctionValue()) { |
725 CSSFunctionValue* functionValue = toCSSFunctionValue(item.get()); | 724 CSSFunctionValue* functionValue = toCSSFunctionValue(item.get()); |
726 ASSERT(functionValue->functionType() == CSSValueAttr); | 725 ASSERT(functionValue->functionType() == CSSValueAttr); |
727 // FIXME: Can a namespace be specified for an attr(foo)? | 726 // FIXME: Can a namespace be specified for an attr(foo)? |
728 if (state.style()->styleType() == NOPSEUDO) | 727 if (state.style()->styleType() == NOPSEUDO) |
729 state.style()->setUnique(); | 728 state.style()->setUnique(); |
730 else | 729 else |
731 state.parentStyle()->setUnique(); | 730 state.parentStyle()->setUnique(); |
732 QualifiedName attr(nullAtom, AtomicString(toCSSPrimitiveValue(functi
onValue->item(0))->getStringValue()), nullAtom); | 731 QualifiedName attr(nullAtom, AtomicString(toCSSStringValue(functionV
alue->item(0))->getStringValue()), nullAtom); |
733 const AtomicString& value = state.element()->getAttribute(attr); | 732 const AtomicString& value = state.element()->getAttribute(attr); |
734 state.style()->setContent(value.isNull() ? emptyString() : value.str
ing(), didSet); | 733 state.style()->setContent(value.isNull() ? emptyString() : value.str
ing(), didSet); |
735 didSet = true; | 734 didSet = true; |
736 } | 735 } |
737 | 736 |
738 if (!item->isPrimitiveValue()) | 737 if (!item->isPrimitiveValue() && !item->isStringValue()) |
739 continue; | 738 continue; |
740 | 739 |
741 CSSPrimitiveValue* contentValue = toCSSPrimitiveValue(item.get()); | 740 if (item->isStringValue() && toCSSStringValue(item.get())->serialization
Type() == CSSStringValue::SerializeAsString) { |
742 | 741 CSSStringValue* contentValue = toCSSStringValue(item.get()); |
743 if (contentValue->isString()) { | |
744 state.style()->setContent(contentValue->getStringValue().impl(), did
Set); | 742 state.style()->setContent(contentValue->getStringValue().impl(), did
Set); |
745 didSet = true; | 743 didSet = true; |
746 } else { | 744 } else { |
| 745 CSSPrimitiveValue* contentValue = toCSSPrimitiveValue(item.get()); |
747 switch (contentValue->getValueID()) { | 746 switch (contentValue->getValueID()) { |
748 case CSSValueOpenQuote: | 747 case CSSValueOpenQuote: |
749 state.style()->setContent(OPEN_QUOTE, didSet); | 748 state.style()->setContent(OPEN_QUOTE, didSet); |
750 didSet = true; | 749 didSet = true; |
751 break; | 750 break; |
752 case CSSValueCloseQuote: | 751 case CSSValueCloseQuote: |
753 state.style()->setContent(CLOSE_QUOTE, didSet); | 752 state.style()->setContent(CLOSE_QUOTE, didSet); |
754 didSet = true; | 753 didSet = true; |
755 break; | 754 break; |
756 case CSSValueNoOpenQuote: | 755 case CSSValueNoOpenQuote: |
757 state.style()->setContent(NO_OPEN_QUOTE, didSet); | 756 state.style()->setContent(NO_OPEN_QUOTE, didSet); |
758 didSet = true; | 757 didSet = true; |
759 break; | 758 break; |
760 case CSSValueNoCloseQuote: | 759 case CSSValueNoCloseQuote: |
761 state.style()->setContent(NO_CLOSE_QUOTE, didSet); | 760 state.style()->setContent(NO_CLOSE_QUOTE, didSet); |
762 didSet = true; | 761 didSet = true; |
763 break; | 762 break; |
764 default: | 763 default: |
765 // normal and none do not have any effect. | 764 // normal and none do not have any effect. |
766 { } | 765 { } |
767 } | 766 } |
768 } | 767 } |
769 } | 768 } |
770 if (!didSet) | 769 if (!didSet) |
771 state.style()->clearContent(); | 770 state.style()->clearContent(); |
772 } | 771 } |
773 | 772 |
774 void StyleBuilderFunctions::applyValueCSSPropertyWebkitLocale(StyleResolverState
& state, CSSValue* value) | 773 void StyleBuilderFunctions::applyValueCSSPropertyWebkitLocale(StyleResolverState
& state, CSSValue* value) |
775 { | 774 { |
776 const CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 775 if (value->isPrimitiveValue() && toCSSPrimitiveValue(value)->getValueID() ==
CSSValueAuto) { |
777 if (primitiveValue->getValueID() == CSSValueAuto) { | |
778 state.style()->setLocale(nullAtom); | 776 state.style()->setLocale(nullAtom); |
779 } else { | 777 } else { |
780 ASSERT(primitiveValue->isString()); | 778 ASSERT(value->isStringValue()); |
781 state.style()->setLocale(AtomicString(primitiveValue->getStringValue()))
; | 779 state.style()->setLocale(AtomicString(toCSSStringValue(value)->getString
Value())); |
782 } | 780 } |
783 state.fontBuilder().setScript(state.style()->locale()); | 781 state.fontBuilder().setScript(state.style()->locale()); |
784 } | 782 } |
785 | 783 |
786 void StyleBuilderFunctions::applyInitialCSSPropertyWebkitAppRegion(StyleResolver
State&) | 784 void StyleBuilderFunctions::applyInitialCSSPropertyWebkitAppRegion(StyleResolver
State&) |
787 { | 785 { |
788 } | 786 } |
789 | 787 |
790 void StyleBuilderFunctions::applyInheritCSSPropertyWebkitAppRegion(StyleResolver
State&) | 788 void StyleBuilderFunctions::applyInheritCSSPropertyWebkitAppRegion(StyleResolver
State&) |
791 { | 789 { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
837 return; | 835 return; |
838 case CSSValueSuper: | 836 case CSSValueSuper: |
839 svgStyle.setBaselineShift(BS_SUPER); | 837 svgStyle.setBaselineShift(BS_SUPER); |
840 return; | 838 return; |
841 default: | 839 default: |
842 ASSERT_NOT_REACHED(); | 840 ASSERT_NOT_REACHED(); |
843 } | 841 } |
844 } | 842 } |
845 | 843 |
846 } // namespace blink | 844 } // namespace blink |
OLD | NEW |