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

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: Added unit tests Created 6 years, 7 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, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008 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 27 matching lines...) Expand all
38 #include "core/dom/ExceptionCode.h" 38 #include "core/dom/ExceptionCode.h"
39 #include "core/dom/NodeTraversal.h" 39 #include "core/dom/NodeTraversal.h"
40 #include "core/dom/Text.h" 40 #include "core/dom/Text.h"
41 #include "core/editing/markup.h" 41 #include "core/editing/markup.h"
42 #include "core/events/EventListener.h" 42 #include "core/events/EventListener.h"
43 #include "core/events/KeyboardEvent.h" 43 #include "core/events/KeyboardEvent.h"
44 #include "core/frame/Settings.h" 44 #include "core/frame/Settings.h"
45 #include "core/html/HTMLBRElement.h" 45 #include "core/html/HTMLBRElement.h"
46 #include "core/html/HTMLFormElement.h" 46 #include "core/html/HTMLFormElement.h"
47 #include "core/html/HTMLInputElement.h" 47 #include "core/html/HTMLInputElement.h"
48 #include "core/html/HTMLMenuElement.h"
48 #include "core/html/HTMLTemplateElement.h" 49 #include "core/html/HTMLTemplateElement.h"
49 #include "core/html/HTMLTextFormControlElement.h" 50 #include "core/html/HTMLTextFormControlElement.h"
50 #include "core/html/parser/HTMLParserIdioms.h" 51 #include "core/html/parser/HTMLParserIdioms.h"
51 #include "core/rendering/RenderObject.h" 52 #include "core/rendering/RenderObject.h"
52 #include "platform/text/BidiResolver.h" 53 #include "platform/text/BidiResolver.h"
53 #include "platform/text/BidiTextRun.h" 54 #include "platform/text/BidiTextRun.h"
54 #include "platform/text/TextRunIterator.h" 55 #include "platform/text/TextRunIterator.h"
55 #include "wtf/StdLibExtras.h" 56 #include "wtf/StdLibExtras.h"
56 #include "wtf/text/CString.h" 57 #include "wtf/text/CString.h"
57 58
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 parsedColor.setRGB(parseColorStringWithCrazyLegacyRules(colorString)); 897 parsedColor.setRGB(parseColorStringWithCrazyLegacyRules(colorString));
897 898
898 style->setProperty(propertyID, cssValuePool().createColorValue(parsedColor.r gb())); 899 style->setProperty(propertyID, cssValuePool().createColorValue(parsedColor.r gb()));
899 } 900 }
900 901
901 bool HTMLElement::isInteractiveContent() const 902 bool HTMLElement::isInteractiveContent() const
902 { 903 {
903 return false; 904 return false;
904 } 905 }
905 906
907 HTMLMenuElement* HTMLElement::menuElement() const
908 {
909 Element* element = treeScope().getElementById(fastGetAttribute(contextmenuAt tr));
910 if (!element)
911 return 0;
912 if (!isHTMLMenuElement(*element))
esprehn 2014/06/06 22:30:42 You can combine all these checks into: return isH
pals 2014/06/10 10:42:39 Done.
913 return 0;
914
915 return toHTMLMenuElement(element);
916 }
917
906 void HTMLElement::defaultEventHandler(Event* event) 918 void HTMLElement::defaultEventHandler(Event* event)
907 { 919 {
908 if (event->type() == EventTypeNames::keypress && event->isKeyboardEvent()) { 920 if (event->type() == EventTypeNames::keypress && event->isKeyboardEvent()) {
909 handleKeypressEvent(toKeyboardEvent(event)); 921 handleKeypressEvent(toKeyboardEvent(event));
910 if (event->defaultHandled()) 922 if (event->defaultHandled())
911 return; 923 return;
912 } 924 }
913 925
914 Element::defaultEventHandler(event); 926 Element::defaultEventHandler(event);
915 } 927 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 #ifndef NDEBUG 967 #ifndef NDEBUG
956 968
957 // For use in the debugger 969 // For use in the debugger
958 void dumpInnerHTML(WebCore::HTMLElement*); 970 void dumpInnerHTML(WebCore::HTMLElement*);
959 971
960 void dumpInnerHTML(WebCore::HTMLElement* element) 972 void dumpInnerHTML(WebCore::HTMLElement* element)
961 { 973 {
962 printf("%s\n", element->innerHTML().ascii().data()); 974 printf("%s\n", element->innerHTML().ascii().data());
963 } 975 }
964 #endif 976 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698