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

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

Issue 2801243002: More tweaks to <script nonce> hiding. (Closed)
Patch Set: Moved tests. Created 3 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-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. 5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved.
6 * (http://www.torchmobile.com/) 6 * (http://www.torchmobile.com/)
7 * Copyright (C) 2011 Motorola Mobility. All rights reserved. 7 * Copyright (C) 2011 Motorola Mobility. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #include "core/dom/shadow/ElementShadow.h" 45 #include "core/dom/shadow/ElementShadow.h"
46 #include "core/dom/shadow/FlatTreeTraversal.h" 46 #include "core/dom/shadow/FlatTreeTraversal.h"
47 #include "core/dom/shadow/ShadowRoot.h" 47 #include "core/dom/shadow/ShadowRoot.h"
48 #include "core/editing/EditingUtilities.h" 48 #include "core/editing/EditingUtilities.h"
49 #include "core/editing/serializers/Serialization.h" 49 #include "core/editing/serializers/Serialization.h"
50 #include "core/editing/spellcheck/SpellChecker.h" 50 #include "core/editing/spellcheck/SpellChecker.h"
51 #include "core/events/EventListener.h" 51 #include "core/events/EventListener.h"
52 #include "core/events/KeyboardEvent.h" 52 #include "core/events/KeyboardEvent.h"
53 #include "core/frame/Settings.h" 53 #include "core/frame/Settings.h"
54 #include "core/frame/UseCounter.h" 54 #include "core/frame/UseCounter.h"
55 #include "core/frame/csp/ContentSecurityPolicy.h"
55 #include "core/html/HTMLBRElement.h" 56 #include "core/html/HTMLBRElement.h"
56 #include "core/html/HTMLDimension.h" 57 #include "core/html/HTMLDimension.h"
57 #include "core/html/HTMLFormElement.h" 58 #include "core/html/HTMLFormElement.h"
58 #include "core/html/HTMLInputElement.h" 59 #include "core/html/HTMLInputElement.h"
59 #include "core/html/HTMLMenuElement.h" 60 #include "core/html/HTMLMenuElement.h"
60 #include "core/html/HTMLTemplateElement.h" 61 #include "core/html/HTMLTemplateElement.h"
61 #include "core/html/parser/HTMLParserIdioms.h" 62 #include "core/html/parser/HTMLParserIdioms.h"
62 #include "core/layout/LayoutBoxModelObject.h" 63 #include "core/layout/LayoutBoxModelObject.h"
63 #include "core/layout/LayoutObject.h" 64 #include "core/layout/LayoutObject.h"
64 #include "core/page/SpatialNavigation.h" 65 #include "core/page/SpatialNavigation.h"
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 for (Element* element_to_adjust = this; element_to_adjust; 904 for (Element* element_to_adjust = this; element_to_adjust;
904 element_to_adjust = 905 element_to_adjust =
905 FlatTreeTraversal::ParentElement(*element_to_adjust)) { 906 FlatTreeTraversal::ParentElement(*element_to_adjust)) {
906 if (ElementAffectsDirectionality(element_to_adjust)) { 907 if (ElementAffectsDirectionality(element_to_adjust)) {
907 ToHTMLElement(element_to_adjust)->CalculateAndAdjustDirectionality(); 908 ToHTMLElement(element_to_adjust)->CalculateAndAdjustDirectionality();
908 return; 909 return;
909 } 910 }
910 } 911 }
911 } 912 }
912 913
914 Node::InsertionNotificationRequest HTMLElement::InsertedInto(
915 ContainerNode* insertion_point) {
916 // Process the superclass first to ensure that `InActiveDocument()` is
917 // updated.
918 Element::InsertedInto(insertion_point);
919
920 if (hasAttribute(nonceAttr) && getAttribute(nonceAttr) != g_empty_atom) {
921 setNonce(getAttribute(nonceAttr));
922 if (RuntimeEnabledFeatures::hideNonceContentAttributeEnabled() &&
923 InActiveDocument() &&
924 GetDocument().GetContentSecurityPolicy()->HasHeaderDeliveredPolicy()) {
925 setAttribute(nonceAttr, g_empty_atom);
926 }
927 }
928
929 return kInsertionDone;
930 }
931
913 void HTMLElement::AddHTMLLengthToStyle(MutableStylePropertySet* style, 932 void HTMLElement::AddHTMLLengthToStyle(MutableStylePropertySet* style,
914 CSSPropertyID property_id, 933 CSSPropertyID property_id,
915 const String& value, 934 const String& value,
916 AllowPercentage allow_percentage) { 935 AllowPercentage allow_percentage) {
917 HTMLDimension dimension; 936 HTMLDimension dimension;
918 if (!ParseDimensionValue(value, dimension)) 937 if (!ParseDimensionValue(value, dimension))
919 return; 938 return;
920 if (property_id == CSSPropertyWidth && 939 if (property_id == CSSPropertyWidth &&
921 (dimension.IsPercentage() || dimension.IsRelative())) { 940 (dimension.IsPercentage() || dimension.IsRelative())) {
922 UseCounter::Count(GetDocument(), UseCounter::kHTMLElementDeprecatedWidth); 941 UseCounter::Count(GetDocument(), UseCounter::kHTMLElementDeprecatedWidth);
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 1220
1202 #ifndef NDEBUG 1221 #ifndef NDEBUG
1203 1222
1204 // For use in the debugger 1223 // For use in the debugger
1205 void dumpInnerHTML(blink::HTMLElement*); 1224 void dumpInnerHTML(blink::HTMLElement*);
1206 1225
1207 void dumpInnerHTML(blink::HTMLElement* element) { 1226 void dumpInnerHTML(blink::HTMLElement* element) {
1208 printf("%s\n", element->innerHTML().Ascii().data()); 1227 printf("%s\n", element->innerHTML().Ascii().data());
1209 } 1228 }
1210 #endif 1229 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLElement.h ('k') | third_party/WebKit/Source/core/html/HTMLElement.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698