| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 820 Node* node = m_layoutObject->node(); | 820 Node* node = m_layoutObject->node(); |
| 821 if (!node) | 821 if (!node) |
| 822 return nullAtom; | 822 return nullAtom; |
| 823 if (!node->isElementNode()) | 823 if (!node->isElementNode()) |
| 824 return nullAtom; | 824 return nullAtom; |
| 825 return toElement(node)->getAttribute(accesskeyAttr); | 825 return toElement(node)->getAttribute(accesskeyAttr); |
| 826 } | 826 } |
| 827 | 827 |
| 828 RGBA32 AXLayoutObject::backgroundColor() const | 828 RGBA32 AXLayoutObject::backgroundColor() const |
| 829 { | 829 { |
| 830 if (!m_layoutObject) | 830 if (!getLayoutObject()) |
| 831 return AXNodeObject::backgroundColor(); | 831 return AXNodeObject::backgroundColor(); |
| 832 | 832 |
| 833 const ComputedStyle* style = m_layoutObject->style(); | 833 const ComputedStyle* style = getLayoutObject()->style(); |
| 834 if (!style || !style->hasBackground()) | 834 if (!style || !style->hasBackground()) |
| 835 return AXNodeObject::backgroundColor(); | 835 return AXNodeObject::backgroundColor(); |
| 836 | 836 |
| 837 Color color = style->visitedDependentColor(CSSPropertyBackgroundColor); | 837 Color color = style->visitedDependentColor(CSSPropertyBackgroundColor); |
| 838 return color.rgb(); | 838 return color.rgb(); |
| 839 } | 839 } |
| 840 | 840 |
| 841 RGBA32 AXLayoutObject::color() const | 841 RGBA32 AXLayoutObject::color() const |
| 842 { | 842 { |
| 843 if (!m_layoutObject || isColorWell()) | 843 if (!getLayoutObject() || isColorWell()) |
| 844 return AXNodeObject::color(); | 844 return AXNodeObject::color(); |
| 845 | 845 |
| 846 const ComputedStyle* style = m_layoutObject->style(); | 846 const ComputedStyle* style = getLayoutObject()->style(); |
| 847 if (!style) | 847 if (!style) |
| 848 return AXNodeObject::color(); | 848 return AXNodeObject::color(); |
| 849 | 849 |
| 850 Color color = style->visitedDependentColor(CSSPropertyColor); | 850 Color color = style->visitedDependentColor(CSSPropertyColor); |
| 851 return color.rgb(); | 851 return color.rgb(); |
| 852 } | 852 } |
| 853 | 853 |
| 854 String AXLayoutObject::fontFamily() const |
| 855 { |
| 856 if (!getLayoutObject()) |
| 857 return AXNodeObject::fontFamily(); |
| 858 |
| 859 const ComputedStyle* style = getLayoutObject()->style(); |
| 860 if (!style) |
| 861 return AXNodeObject::fontFamily(); |
| 862 |
| 863 FontDescription& fontDescription = const_cast<FontDescription&>(style->fontD
escription()); |
| 864 return fontDescription.firstFamily().family(); |
| 865 } |
| 866 |
| 854 // Font size is in pixels. | 867 // Font size is in pixels. |
| 855 float AXLayoutObject::fontSize() const | 868 float AXLayoutObject::fontSize() const |
| 856 { | 869 { |
| 857 if (!m_layoutObject) | 870 if (!getLayoutObject()) |
| 858 return AXNodeObject::fontSize(); | 871 return AXNodeObject::fontSize(); |
| 859 | 872 |
| 860 const ComputedStyle* style = m_layoutObject->style(); | 873 const ComputedStyle* style = getLayoutObject()->style(); |
| 861 if (!style) | 874 if (!style) |
| 862 return AXNodeObject::fontSize(); | 875 return AXNodeObject::fontSize(); |
| 863 | 876 |
| 864 return style->computedFontSize(); | 877 return style->computedFontSize(); |
| 865 } | 878 } |
| 866 | 879 |
| 867 String AXLayoutObject::text() const | 880 String AXLayoutObject::text() const |
| 868 { | 881 { |
| 869 if (isPasswordFieldAndShouldHideValue()) { | 882 if (isPasswordFieldAndShouldHideValue()) { |
| 870 if (!m_layoutObject) | 883 if (!getLayoutObject()) |
| 871 return String(); | 884 return String(); |
| 872 | 885 |
| 873 const ComputedStyle* style = m_layoutObject->style(); | 886 const ComputedStyle* style = getLayoutObject()->style(); |
| 874 if (!style) | 887 if (!style) |
| 875 return String(); | 888 return String(); |
| 876 | 889 |
| 877 unsigned unmaskedTextLength = AXNodeObject::text().length(); | 890 unsigned unmaskedTextLength = AXNodeObject::text().length(); |
| 878 if (!unmaskedTextLength) | 891 if (!unmaskedTextLength) |
| 879 return String(); | 892 return String(); |
| 880 | 893 |
| 881 UChar maskCharacter = 0; | 894 UChar maskCharacter = 0; |
| 882 switch (style->textSecurity()) { | 895 switch (style->textSecurity()) { |
| 883 case TSNONE: | 896 case TSNONE: |
| (...skipping 15 matching lines...) Expand all Loading... |
| 899 maskedText.append(maskCharacter); | 912 maskedText.append(maskCharacter); |
| 900 return maskedText.toString(); | 913 return maskedText.toString(); |
| 901 } | 914 } |
| 902 } | 915 } |
| 903 | 916 |
| 904 return AXNodeObject::text(); | 917 return AXNodeObject::text(); |
| 905 } | 918 } |
| 906 | 919 |
| 907 AccessibilityTextDirection AXLayoutObject::textDirection() const | 920 AccessibilityTextDirection AXLayoutObject::textDirection() const |
| 908 { | 921 { |
| 909 if (!m_layoutObject) | 922 if (!getLayoutObject()) |
| 910 return AXNodeObject::textDirection(); | 923 return AXNodeObject::textDirection(); |
| 911 | 924 |
| 912 const ComputedStyle* style = m_layoutObject->style(); | 925 const ComputedStyle* style = getLayoutObject()->style(); |
| 913 if (!style) | 926 if (!style) |
| 914 return AXNodeObject::textDirection(); | 927 return AXNodeObject::textDirection(); |
| 915 | 928 |
| 916 if (style->isHorizontalWritingMode()) { | 929 if (style->isHorizontalWritingMode()) { |
| 917 switch (style->direction()) { | 930 switch (style->direction()) { |
| 918 case LTR: | 931 case LTR: |
| 919 return AccessibilityTextDirectionLTR; | 932 return AccessibilityTextDirectionLTR; |
| 920 case RTL: | 933 case RTL: |
| 921 return AccessibilityTextDirectionRTL; | 934 return AccessibilityTextDirectionRTL; |
| 922 } | 935 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 935 int AXLayoutObject::textLength() const | 948 int AXLayoutObject::textLength() const |
| 936 { | 949 { |
| 937 if (!isTextControl()) | 950 if (!isTextControl()) |
| 938 return -1; | 951 return -1; |
| 939 | 952 |
| 940 return text().length(); | 953 return text().length(); |
| 941 } | 954 } |
| 942 | 955 |
| 943 TextStyle AXLayoutObject::getTextStyle() const | 956 TextStyle AXLayoutObject::getTextStyle() const |
| 944 { | 957 { |
| 945 if (!m_layoutObject) | 958 if (!getLayoutObject()) |
| 946 return AXNodeObject::getTextStyle(); | 959 return AXNodeObject::getTextStyle(); |
| 947 | 960 |
| 948 const ComputedStyle* style = m_layoutObject->style(); | 961 const ComputedStyle* style = getLayoutObject()->style(); |
| 949 if (!style) | 962 if (!style) |
| 950 return AXNodeObject::getTextStyle(); | 963 return AXNodeObject::getTextStyle(); |
| 951 | 964 |
| 952 unsigned textStyle = TextStyleNone; | 965 unsigned textStyle = TextStyleNone; |
| 953 if (style->fontWeight() == FontWeightBold) | 966 if (style->fontWeight() == FontWeightBold) |
| 954 textStyle |= TextStyleBold; | 967 textStyle |= TextStyleBold; |
| 955 if (style->fontDescription().style() == FontStyleItalic) | 968 if (style->fontDescription().style() == FontStyleItalic) |
| 956 textStyle |= TextStyleItalic; | 969 textStyle |= TextStyleItalic; |
| 957 if (style->getTextDecoration() == TextDecorationUnderline) | 970 if (style->getTextDecoration() == TextDecorationUnderline) |
| 958 textStyle |= TextStyleUnderline; | 971 textStyle |= TextStyleUnderline; |
| (...skipping 1590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2549 if (label && label->layoutObject()) { | 2562 if (label && label->layoutObject()) { |
| 2550 LayoutRect labelRect = axObjectCache().getOrCreate(label)->elementRe
ct(); | 2563 LayoutRect labelRect = axObjectCache().getOrCreate(label)->elementRe
ct(); |
| 2551 result.unite(labelRect); | 2564 result.unite(labelRect); |
| 2552 } | 2565 } |
| 2553 } | 2566 } |
| 2554 | 2567 |
| 2555 return result; | 2568 return result; |
| 2556 } | 2569 } |
| 2557 | 2570 |
| 2558 } // namespace blink | 2571 } // namespace blink |
| OLD | NEW |