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 * Copyright (C) 2004-2008, 2013, 2014 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004-2008, 2013, 2014 Apple Inc. All rights reserved. |
| 5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) | 5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) |
| 6 * Copyright (C) 2011 Motorola Mobility. All rights reserved. | 6 * Copyright (C) 2011 Motorola Mobility. All rights reserved. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 41 #include "core/dom/Text.h" | 41 #include "core/dom/Text.h" |
| 42 #include "core/dom/shadow/ElementShadow.h" | 42 #include "core/dom/shadow/ElementShadow.h" |
| 43 #include "core/dom/shadow/ShadowRoot.h" | 43 #include "core/dom/shadow/ShadowRoot.h" |
| 44 #include "core/editing/markup.h" | 44 #include "core/editing/markup.h" |
| 45 #include "core/events/EventListener.h" | 45 #include "core/events/EventListener.h" |
| 46 #include "core/events/KeyboardEvent.h" | 46 #include "core/events/KeyboardEvent.h" |
| 47 #include "core/frame/Settings.h" | 47 #include "core/frame/Settings.h" |
| 48 #include "core/html/HTMLBRElement.h" | 48 #include "core/html/HTMLBRElement.h" |
| 49 #include "core/html/HTMLFormElement.h" | 49 #include "core/html/HTMLFormElement.h" |
| 50 #include "core/html/HTMLInputElement.h" | 50 #include "core/html/HTMLInputElement.h" |
| 51 #include "core/html/HTMLMenuElement.h" | |
| 51 #include "core/html/HTMLTemplateElement.h" | 52 #include "core/html/HTMLTemplateElement.h" |
| 52 #include "core/html/HTMLTextFormControlElement.h" | 53 #include "core/html/HTMLTextFormControlElement.h" |
| 53 #include "core/html/parser/HTMLParserIdioms.h" | 54 #include "core/html/parser/HTMLParserIdioms.h" |
| 54 #include "core/rendering/RenderObject.h" | 55 #include "core/rendering/RenderObject.h" |
| 55 #include "platform/text/BidiResolver.h" | 56 #include "platform/text/BidiResolver.h" |
| 56 #include "platform/text/BidiTextRun.h" | 57 #include "platform/text/BidiTextRun.h" |
| 57 #include "platform/text/TextRunIterator.h" | 58 #include "platform/text/TextRunIterator.h" |
| 58 #include "wtf/StdLibExtras.h" | 59 #include "wtf/StdLibExtras.h" |
| 59 #include "wtf/text/CString.h" | 60 #include "wtf/text/CString.h" |
| 60 | 61 |
| (...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 894 parsedColor.setRGB(parseColorStringWithCrazyLegacyRules(colorString)); | 895 parsedColor.setRGB(parseColorStringWithCrazyLegacyRules(colorString)); |
| 895 | 896 |
| 896 style->setProperty(propertyID, cssValuePool().createColorValue(parsedColor.r gb())); | 897 style->setProperty(propertyID, cssValuePool().createColorValue(parsedColor.r gb())); |
| 897 } | 898 } |
| 898 | 899 |
| 899 bool HTMLElement::isInteractiveContent() const | 900 bool HTMLElement::isInteractiveContent() const |
| 900 { | 901 { |
| 901 return false; | 902 return false; |
| 902 } | 903 } |
| 903 | 904 |
| 905 | |
| 906 HTMLMenuElement* HTMLElement::contextMenu() const | |
| 907 { | |
| 908 const AtomicString& contextMenuId(fastGetAttribute(contextmenuAttr)); | |
| 909 if (contextMenuId.isNull()) | |
| 910 return nullptr; | |
| 911 | |
| 912 Element* element = treeScope().getElementById(contextMenuId); | |
| 913 // Not checking if the menu element is of type "popup". | |
| 914 // Ignoring menu element type attribute is intentional according to the stan dard. | |
| 915 return isHTMLMenuElement(element) ? toHTMLMenuElement(element) : nullptr; | |
| 916 } | |
| 917 | |
| 918 void HTMLElement::setContextMenu(HTMLMenuElement* contextMenu) | |
| 919 { | |
| 920 if (!contextMenu) | |
|
tkent
2014/08/19 01:14:41
The specification isn't clear, but I think |elemen
pals
2014/08/19 10:12:32
Done.
| |
| 921 return; | |
| 922 | |
| 923 // http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructur e.html#reflecting-content-attributes-in-idl-attributes | |
| 924 // On setting, if the given element has an id attribute, and has the same ho me | |
| 925 // subtree as the element of the attribute being set, and the given element is the | |
| 926 // first element in that home subtree whose ID is the value of that id attri bute, | |
| 927 // then the content attribute must be set to the value of that id attribute. | |
| 928 // Otherwise, the content attribute must be set to the empty string. | |
| 929 const AtomicString& contextMenuId(contextMenu->fastGetAttribute(idAttr)); | |
| 930 | |
| 931 if (!contextMenuId.isNull() && (contextMenu == treeScope().getElementById(co ntextMenuId)) && contextMenu->isInTreeScope()) | |
|
tkent
2014/08/19 01:14:41
The parentheses on the second condition is unneces
pals
2014/08/19 10:12:32
Done.
| |
| 932 setAttribute(contextmenuAttr, contextMenuId); | |
| 933 else | |
| 934 setAttribute(contextmenuAttr, ""); | |
| 935 } | |
| 936 | |
| 904 void HTMLElement::defaultEventHandler(Event* event) | 937 void HTMLElement::defaultEventHandler(Event* event) |
| 905 { | 938 { |
| 906 if (event->type() == EventTypeNames::keypress && event->isKeyboardEvent()) { | 939 if (event->type() == EventTypeNames::keypress && event->isKeyboardEvent()) { |
| 907 handleKeypressEvent(toKeyboardEvent(event)); | 940 handleKeypressEvent(toKeyboardEvent(event)); |
| 908 if (event->defaultHandled()) | 941 if (event->defaultHandled()) |
| 909 return; | 942 return; |
| 910 } | 943 } |
| 911 | 944 |
| 912 Element::defaultEventHandler(event); | 945 Element::defaultEventHandler(event); |
| 913 } | 946 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 959 #ifndef NDEBUG | 992 #ifndef NDEBUG |
| 960 | 993 |
| 961 // For use in the debugger | 994 // For use in the debugger |
| 962 void dumpInnerHTML(blink::HTMLElement*); | 995 void dumpInnerHTML(blink::HTMLElement*); |
| 963 | 996 |
| 964 void dumpInnerHTML(blink::HTMLElement* element) | 997 void dumpInnerHTML(blink::HTMLElement* element) |
| 965 { | 998 { |
| 966 printf("%s\n", element->innerHTML().ascii().data()); | 999 printf("%s\n", element->innerHTML().ascii().data()); |
| 967 } | 1000 } |
| 968 #endif | 1001 #endif |
| OLD | NEW |