Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Peter Kelly (pmk@post.com) | 4 * (C) 2001 Peter Kelly (pmk@post.com) |
| 5 * (C) 2001 Dirk Mueller (mueller@kde.org) | 5 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 6 * (C) 2007 David Smith (catfish.man@gmail.com) | 6 * (C) 2007 David Smith (catfish.man@gmail.com) |
| 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. | 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. |
| 8 * (C) 2007 Eric Seidel (eric@webkit.org) | 8 * (C) 2007 Eric Seidel (eric@webkit.org) |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 901 } | 901 } |
| 902 | 902 |
| 903 IntRect Element::screenRect() const | 903 IntRect Element::screenRect() const |
| 904 { | 904 { |
| 905 if (!renderer()) | 905 if (!renderer()) |
| 906 return IntRect(); | 906 return IntRect(); |
| 907 // FIXME: this should probably respect transforms | 907 // FIXME: this should probably respect transforms |
| 908 return document().view()->contentsToScreen(renderer()->absoluteBoundingBoxRe ctIgnoringTransforms()); | 908 return document().view()->contentsToScreen(renderer()->absoluteBoundingBoxRe ctIgnoringTransforms()); |
| 909 } | 909 } |
| 910 | 910 |
| 911 static inline const QualifiedName& fastAttributeNameFromString(const String& loc alName) | |
| 912 { | |
| 913 unsigned length = localName.length(); | |
| 914 if (!length) | |
| 915 return nullQName(); | |
| 916 const StringImpl& name = *localName.impl(); | |
| 917 | |
| 918 if (length == 2 && name[0] == 'i' && name[1] == 'd') | |
| 919 return HTMLNames::idAttr; | |
| 920 if (length == 4 && name[0] == 'n' && name[1] == 'a' && name[2] == 'm' && nam e[3] == 'e') | |
| 921 return HTMLNames::nameAttr; | |
| 922 if (length == 5 && name[0] == 'c' && name[1] == 'l' && name[2] == 'a' && nam e[3] == 's' && name[4] == 's') | |
| 923 return HTMLNames::classAttr; | |
| 924 if (length == 5 && name[0] == 's' && name[1] == 't' && name[2] == 'y' && nam e[3] == 'l' && name[4] == 'e') | |
| 925 return HTMLNames::styleAttr; | |
| 926 | |
| 927 return nullQName(); | |
| 928 } | |
| 929 | |
| 930 const AtomicString& Element::bindingsGetAttribute(const String& localName) const | |
| 931 { | |
| 932 const QualifiedName& fastName = fastAttributeNameFromString(localName); | |
| 933 if (fastName != nullQName()) | |
| 934 return fastGetAttribute(fastName); | |
| 935 return getAttribute(AtomicString(localName)); | |
| 936 } | |
| 937 | |
| 938 void Element::bindingsSetAttribute(const String& localName, const String& newVal ue, ExceptionState& exceptionState) | |
|
Inactive
2014/03/07 13:23:10
Looks like newValue should be an AtomicString.
| |
| 939 { | |
| 940 const QualifiedName& fastName = fastAttributeNameFromString(localName); | |
| 941 if (fastName != nullQName()) { | |
| 942 setAttribute(fastName, AtomicString(newValue)); | |
| 943 return; | |
| 944 } | |
| 945 setAttribute(AtomicString(localName), AtomicString(newValue), exceptionState ); | |
| 946 } | |
| 947 | |
| 911 const AtomicString& Element::getAttribute(const AtomicString& localName) const | 948 const AtomicString& Element::getAttribute(const AtomicString& localName) const |
| 912 { | 949 { |
| 913 if (!elementData()) | 950 if (!elementData()) |
| 914 return nullAtom; | 951 return nullAtom; |
| 915 synchronizeAttribute(localName); | 952 synchronizeAttribute(localName); |
| 916 if (const Attribute* attribute = elementData()->getAttributeItem(localName, shouldIgnoreAttributeCase())) | 953 if (const Attribute* attribute = elementData()->getAttributeItem(localName, shouldIgnoreAttributeCase())) |
| 917 return attribute->value(); | 954 return attribute->value(); |
| 918 return nullAtom; | 955 return nullAtom; |
| 919 } | 956 } |
| 920 | 957 |
| (...skipping 2619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3540 // Before doing so, we need to resolve issues in HTMLSelectElement::recalcLi stItems | 3577 // Before doing so, we need to resolve issues in HTMLSelectElement::recalcLi stItems |
| 3541 // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cg i?id=88405 | 3578 // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cg i?id=88405 |
| 3542 if (hasTagName(optionTag) || hasTagName(optgroupTag)) | 3579 if (hasTagName(optionTag) || hasTagName(optgroupTag)) |
| 3543 return false; | 3580 return false; |
| 3544 if (FullscreenElementStack::isActiveFullScreenElement(this)) | 3581 if (FullscreenElementStack::isActiveFullScreenElement(this)) |
| 3545 return false; | 3582 return false; |
| 3546 return true; | 3583 return true; |
| 3547 } | 3584 } |
| 3548 | 3585 |
| 3549 } // namespace WebCore | 3586 } // namespace WebCore |
| OLD | NEW |