Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Side by Side Diff: third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp

Issue 1768753003: Implemented the reporting of text style and language information on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated to using HashTable from base and GetInheritedStringAttribute instead of specialized methods… Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 Node* node = m_layoutObject->node(); 817 Node* node = m_layoutObject->node();
818 if (!node) 818 if (!node)
819 return nullAtom; 819 return nullAtom;
820 if (!node->isElementNode()) 820 if (!node->isElementNode())
821 return nullAtom; 821 return nullAtom;
822 return toElement(node)->getAttribute(accesskeyAttr); 822 return toElement(node)->getAttribute(accesskeyAttr);
823 } 823 }
824 824
825 RGBA32 AXLayoutObject::backgroundColor() const 825 RGBA32 AXLayoutObject::backgroundColor() const
826 { 826 {
827 if (!m_layoutObject) 827 if (!layoutObject())
828 return AXNodeObject::backgroundColor(); 828 return AXNodeObject::backgroundColor();
829 829
830 const ComputedStyle* style = m_layoutObject->style(); 830 const ComputedStyle* style = layoutObject()->style();
831 if (!style || !style->hasBackground()) 831 if (!style || !style->hasBackground())
832 return AXNodeObject::backgroundColor(); 832 return AXNodeObject::backgroundColor();
833 833
834 Color color = style->visitedDependentColor(CSSPropertyBackgroundColor); 834 Color color = style->visitedDependentColor(CSSPropertyBackgroundColor);
835 return color.rgb(); 835 return color.rgb();
836 } 836 }
837 837
838 RGBA32 AXLayoutObject::color() const 838 RGBA32 AXLayoutObject::color() const
839 { 839 {
840 if (!m_layoutObject || isColorWell()) 840 if (!layoutObject() || isColorWell())
841 return AXNodeObject::color(); 841 return AXNodeObject::color();
842 842
843 const ComputedStyle* style = m_layoutObject->style(); 843 const ComputedStyle* style = layoutObject()->style();
844 if (!style) 844 if (!style)
845 return AXNodeObject::color(); 845 return AXNodeObject::color();
846 846
847 Color color = style->visitedDependentColor(CSSPropertyColor); 847 Color color = style->visitedDependentColor(CSSPropertyColor);
848 return color.rgb(); 848 return color.rgb();
849 } 849 }
850 850
851 String AXLayoutObject::fontFamily() const
852 {
853 if (!layoutObject())
854 return AXNodeObject::fontFamily();
855
856 const ComputedStyle* style = layoutObject()->style();
857 if (!style)
858 return AXNodeObject::fontFamily();
859
860 FontDescription& fontDescription = const_cast<FontDescription&>(style->fontD escription());
861 return fontDescription.firstFamily().family();
862 }
863
851 // Font size is in pixels. 864 // Font size is in pixels.
852 float AXLayoutObject::fontSize() const 865 float AXLayoutObject::fontSize() const
853 { 866 {
854 if (!m_layoutObject) 867 if (!layoutObject())
855 return AXNodeObject::fontSize(); 868 return AXNodeObject::fontSize();
856 869
857 const ComputedStyle* style = m_layoutObject->style(); 870 const ComputedStyle* style = layoutObject()->style();
858 if (!style) 871 if (!style)
859 return AXNodeObject::fontSize(); 872 return AXNodeObject::fontSize();
860 873
861 return style->computedFontSize(); 874 return style->computedFontSize();
862 } 875 }
863 876
864 String AXLayoutObject::text() const 877 String AXLayoutObject::text() const
865 { 878 {
866 if (isPasswordFieldAndShouldHideValue()) { 879 if (isPasswordFieldAndShouldHideValue()) {
867 if (!m_layoutObject) 880 if (!m_layoutObject)
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 int AXLayoutObject::textLength() const 945 int AXLayoutObject::textLength() const
933 { 946 {
934 if (!isTextControl()) 947 if (!isTextControl())
935 return -1; 948 return -1;
936 949
937 return text().length(); 950 return text().length();
938 } 951 }
939 952
940 TextStyle AXLayoutObject::getTextStyle() const 953 TextStyle AXLayoutObject::getTextStyle() const
941 { 954 {
942 if (!m_layoutObject) 955 if (!layoutObject())
943 return AXNodeObject::getTextStyle(); 956 return AXNodeObject::getTextStyle();
944 957
945 const ComputedStyle* style = m_layoutObject->style(); 958 const ComputedStyle* style = layoutObject()->style();
946 if (!style) 959 if (!style)
947 return AXNodeObject::getTextStyle(); 960 return AXNodeObject::getTextStyle();
948 961
949 unsigned textStyle = TextStyleNone; 962 unsigned textStyle = TextStyleNone;
950 if (style->fontWeight() == FontWeightBold) 963 if (style->fontWeight() == FontWeightBold)
951 textStyle |= TextStyleBold; 964 textStyle |= TextStyleBold;
952 if (style->fontDescription().style() == FontStyleItalic) 965 if (style->fontDescription().style() == FontStyleItalic)
953 textStyle |= TextStyleItalic; 966 textStyle |= TextStyleItalic;
954 if (style->getTextDecoration() == TextDecorationUnderline) 967 if (style->getTextDecoration() == TextDecorationUnderline)
955 textStyle |= TextStyleUnderline; 968 textStyle |= TextStyleUnderline;
(...skipping 1590 matching lines...) Expand 10 before | Expand all | Expand 10 after
2546 if (label && label->layoutObject()) { 2559 if (label && label->layoutObject()) {
2547 LayoutRect labelRect = axObjectCache().getOrCreate(label)->elementRe ct(); 2560 LayoutRect labelRect = axObjectCache().getOrCreate(label)->elementRe ct();
2548 result.unite(labelRect); 2561 result.unite(labelRect);
2549 } 2562 }
2550 } 2563 }
2551 2564
2552 return result; 2565 return result;
2553 } 2566 }
2554 2567
2555 } // namespace blink 2568 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698