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) { |
| 921 setAttribute(contextmenuAttr, ""); |
| 922 return; |
| 923 } |
| 924 |
| 925 // http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructur
e.html#reflecting-content-attributes-in-idl-attributes |
| 926 // On setting, if the given element has an id attribute, and has the same ho
me |
| 927 // subtree as the element of the attribute being set, and the given element
is the |
| 928 // first element in that home subtree whose ID is the value of that id attri
bute, |
| 929 // then the content attribute must be set to the value of that id attribute. |
| 930 // Otherwise, the content attribute must be set to the empty string. |
| 931 const AtomicString& contextMenuId(contextMenu->fastGetAttribute(idAttr)); |
| 932 |
| 933 if (!contextMenuId.isNull() && contextMenu == treeScope().getElementById(con
textMenuId)) |
| 934 setAttribute(contextmenuAttr, contextMenuId); |
| 935 else |
| 936 setAttribute(contextmenuAttr, ""); |
| 937 } |
| 938 |
904 void HTMLElement::defaultEventHandler(Event* event) | 939 void HTMLElement::defaultEventHandler(Event* event) |
905 { | 940 { |
906 if (event->type() == EventTypeNames::keypress && event->isKeyboardEvent()) { | 941 if (event->type() == EventTypeNames::keypress && event->isKeyboardEvent()) { |
907 handleKeypressEvent(toKeyboardEvent(event)); | 942 handleKeypressEvent(toKeyboardEvent(event)); |
908 if (event->defaultHandled()) | 943 if (event->defaultHandled()) |
909 return; | 944 return; |
910 } | 945 } |
911 | 946 |
912 Element::defaultEventHandler(event); | 947 Element::defaultEventHandler(event); |
913 } | 948 } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
959 #ifndef NDEBUG | 994 #ifndef NDEBUG |
960 | 995 |
961 // For use in the debugger | 996 // For use in the debugger |
962 void dumpInnerHTML(blink::HTMLElement*); | 997 void dumpInnerHTML(blink::HTMLElement*); |
963 | 998 |
964 void dumpInnerHTML(blink::HTMLElement* element) | 999 void dumpInnerHTML(blink::HTMLElement* element) |
965 { | 1000 { |
966 printf("%s\n", element->innerHTML().ascii().data()); | 1001 printf("%s\n", element->innerHTML().ascii().data()); |
967 } | 1002 } |
968 #endif | 1003 #endif |
OLD | NEW |