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

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

Issue 2511663002: Revert "Reland of Remove EventSender from HTMLStyleElement" (Closed)
Patch Set: Sync only Created 3 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2010 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2010 Apple Inc. All rights reserved.
6 * (C) 2007 Rob Buis (buis@kde.org) 6 * (C) 2007 Rob Buis (buis@kde.org)
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 12 matching lines...) Expand all
23 23
24 #include "core/html/HTMLStyleElement.h" 24 #include "core/html/HTMLStyleElement.h"
25 25
26 #include "core/HTMLNames.h" 26 #include "core/HTMLNames.h"
27 #include "core/css/MediaList.h" 27 #include "core/css/MediaList.h"
28 #include "core/dom/Document.h" 28 #include "core/dom/Document.h"
29 #include "core/dom/StyleEngine.h" 29 #include "core/dom/StyleEngine.h"
30 #include "core/dom/TaskRunnerHelper.h" 30 #include "core/dom/TaskRunnerHelper.h"
31 #include "core/dom/shadow/ShadowRoot.h" 31 #include "core/dom/shadow/ShadowRoot.h"
32 #include "core/events/Event.h" 32 #include "core/events/Event.h"
33 #include "public/platform/Platform.h"
34 #include "public/platform/WebScheduler.h"
33 35
34 namespace blink { 36 namespace blink {
35 37
36 using namespace HTMLNames; 38 using namespace HTMLNames;
37 39
38 inline HTMLStyleElement::HTMLStyleElement(Document& document, 40 inline HTMLStyleElement::HTMLStyleElement(Document& document,
39 bool createdByParser) 41 bool createdByParser)
40 : HTMLElement(styleTag, document), 42 : HTMLElement(styleTag, document),
41 StyleElement(&document, createdByParser), 43 StyleElement(&document, createdByParser),
42 m_firedLoad(false), 44 m_firedLoad(false),
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 102
101 const AtomicString& HTMLStyleElement::media() const { 103 const AtomicString& HTMLStyleElement::media() const {
102 return getAttribute(mediaAttr); 104 return getAttribute(mediaAttr);
103 } 105 }
104 106
105 const AtomicString& HTMLStyleElement::type() const { 107 const AtomicString& HTMLStyleElement::type() const {
106 return getAttribute(typeAttr); 108 return getAttribute(typeAttr);
107 } 109 }
108 110
109 void HTMLStyleElement::dispatchPendingEvent( 111 void HTMLStyleElement::dispatchPendingEvent(
110 std::unique_ptr<IncrementLoadEventDelayCount>) { 112 std::unique_ptr<IncrementLoadEventDelayCount> count) {
111 dispatchEvent(Event::create(m_loadedSheet ? EventTypeNames::load 113 dispatchEvent(Event::create(m_loadedSheet ? EventTypeNames::load
112 : EventTypeNames::error)); 114 : EventTypeNames::error));
115
116 count.reset();
117 if (document().frame())
118 document().frame()->loader().checkCompleted();
113 } 119 }
114 120
115 void HTMLStyleElement::notifyLoadedSheetAndAllCriticalSubresources( 121 void HTMLStyleElement::notifyLoadedSheetAndAllCriticalSubresources(
116 LoadedSheetErrorStatus errorStatus) { 122 LoadedSheetErrorStatus errorStatus) {
117 bool isLoadEvent = errorStatus == NoErrorLoadingSubresource; 123 bool isLoadEvent = errorStatus == NoErrorLoadingSubresource;
118 if (m_firedLoad && isLoadEvent) 124 if (m_firedLoad && isLoadEvent)
119 return; 125 return;
120 m_loadedSheet = isLoadEvent; 126 m_loadedSheet = isLoadEvent;
121 TaskRunnerHelper::get(TaskType::DOMManipulation, &document()) 127 TaskRunnerHelper::get(TaskType::DOMManipulation, &document())
128
122 ->postTask( 129 ->postTask(
123 BLINK_FROM_HERE, 130 BLINK_FROM_HERE,
124 WTF::bind( 131 WTF::bind(
125 &HTMLStyleElement::dispatchPendingEvent, wrapPersistent(this), 132 &HTMLStyleElement::dispatchPendingEvent, wrapPersistent(this),
126 WTF::passed(IncrementLoadEventDelayCount::create(document())))); 133 WTF::passed(IncrementLoadEventDelayCount::create(document()))));
127 m_firedLoad = true; 134 m_firedLoad = true;
128 } 135 }
129 136
130 bool HTMLStyleElement::disabled() const { 137 bool HTMLStyleElement::disabled() const {
131 if (!m_sheet) 138 if (!m_sheet)
132 return false; 139 return false;
133 140
134 return m_sheet->disabled(); 141 return m_sheet->disabled();
135 } 142 }
136 143
137 void HTMLStyleElement::setDisabled(bool setDisabled) { 144 void HTMLStyleElement::setDisabled(bool setDisabled) {
138 if (CSSStyleSheet* styleSheet = sheet()) 145 if (CSSStyleSheet* styleSheet = sheet())
139 styleSheet->setDisabled(setDisabled); 146 styleSheet->setDisabled(setDisabled);
140 } 147 }
141 148
142 DEFINE_TRACE(HTMLStyleElement) { 149 DEFINE_TRACE(HTMLStyleElement) {
143 StyleElement::trace(visitor); 150 StyleElement::trace(visitor);
144 HTMLElement::trace(visitor); 151 HTMLElement::trace(visitor);
145 } 152 }
146 153
147 } // namespace blink 154 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698