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

Side by Side Diff: Source/core/html/HTMLElement.cpp

Issue 243403006: Implement contextmenu attribute with basic support of <menu> (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressed review comments Created 6 years, 4 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) 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
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 832 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 parsedColor.setRGB(parseColorStringWithCrazyLegacyRules(colorString)); 894 parsedColor.setRGB(parseColorStringWithCrazyLegacyRules(colorString));
894 895
895 style->setProperty(propertyID, cssValuePool().createColorValue(parsedColor.r gb())); 896 style->setProperty(propertyID, cssValuePool().createColorValue(parsedColor.r gb()));
896 } 897 }
897 898
898 bool HTMLElement::isInteractiveContent() const 899 bool HTMLElement::isInteractiveContent() const
899 { 900 {
900 return false; 901 return false;
901 } 902 }
902 903
904 PassRefPtrWillBeRawPtr<HTMLMenuElement> HTMLElement::contextMenu() const
905 {
906 Element* element = treeScope().getElementById(fastGetAttribute(contextmenuAt tr));
907 return isHTMLMenuElement(element) ? toHTMLMenuElement(element) : 0;
908 }
909
910 void HTMLElement::setContextMenu(PassRefPtrWillBeRawPtr<HTMLMenuElement> context Menu)
911 {
912 setAttribute(contextmenuAttr, contextMenu->elementData()->idForStyleResoluti on());
tkent 2014/07/31 06:07:55 Does this behavior conform to the standard?
pals 2014/08/01 10:03:07 Specification says that the contextmenu attribute
tkent 2014/08/04 02:26:12 The HTML specification must have a detailed algori
pals 2014/08/04 08:58:27 Now I am checking if id is null and I have added
913 }
914
903 void HTMLElement::defaultEventHandler(Event* event) 915 void HTMLElement::defaultEventHandler(Event* event)
904 { 916 {
905 if (event->type() == EventTypeNames::keypress && event->isKeyboardEvent()) { 917 if (event->type() == EventTypeNames::keypress && event->isKeyboardEvent()) {
906 handleKeypressEvent(toKeyboardEvent(event)); 918 handleKeypressEvent(toKeyboardEvent(event));
907 if (event->defaultHandled()) 919 if (event->defaultHandled())
908 return; 920 return;
909 } 921 }
910 922
911 Element::defaultEventHandler(event); 923 Element::defaultEventHandler(event);
912 } 924 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 #ifndef NDEBUG 970 #ifndef NDEBUG
959 971
960 // For use in the debugger 972 // For use in the debugger
961 void dumpInnerHTML(blink::HTMLElement*); 973 void dumpInnerHTML(blink::HTMLElement*);
962 974
963 void dumpInnerHTML(blink::HTMLElement* element) 975 void dumpInnerHTML(blink::HTMLElement* element)
964 { 976 {
965 printf("%s\n", element->innerHTML().ascii().data()); 977 printf("%s\n", element->innerHTML().ascii().data());
966 } 978 }
967 #endif 979 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698