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

Side by Side Diff: sky/engine/core/dom/Element.h

Issue 772133003: Mostly merge HTMLElement into Element. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 | sky/engine/core/dom/Element.cpp » ('j') | 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 Peter Kelly (pmk@post.com) 4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * Copyright (C) 2003-2011, 2013, 2014 Apple Inc. All rights reserved. 6 * Copyright (C) 2003-2011, 2013, 2014 Apple Inc. 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 PassRefPtr<ClientRect> getBoundingClientRect(); 140 PassRefPtr<ClientRect> getBoundingClientRect();
141 141
142 virtual void didMoveToNewDocument(Document&) override; 142 virtual void didMoveToNewDocument(Document&) override;
143 143
144 CSSStyleDeclaration* style(); 144 CSSStyleDeclaration* style();
145 145
146 const QualifiedName& tagQName() const { return m_tagName; } 146 const QualifiedName& tagQName() const { return m_tagName; }
147 String tagName() const { return nodeName(); } 147 String tagName() const { return nodeName(); }
148 148
149 bool hasTagName(const QualifiedName& tagName) const { return m_tagName == ta gName; } 149 bool hasTagName(const QualifiedName& tagName) const { return m_tagName == ta gName; }
150 bool hasTagName(const HTMLQualifiedName& tagName) const { return ContainerNo de::hasTagName(tagName); } 150 bool hasTagName(const HTMLQualifiedName& name) const { return hasLocalName(n ame.localName()); }
151 151
152 // A fast function for checking the local name against another atomic string . 152 // A fast function for checking the local name against another atomic string .
153 bool hasLocalName(const AtomicString& other) const { return m_tagName.localN ame() == other; } 153 bool hasLocalName(const AtomicString& other) const { return m_tagName.localN ame() == other; }
154 154
155 virtual const AtomicString& localName() const override final { return m_tagN ame.localName(); } 155 virtual const AtomicString& localName() const override final { return m_tagN ame.localName(); }
156 156
157 virtual String nodeName() const override; 157 virtual String nodeName() const override;
158 158
159 PassRefPtr<Element> cloneElementWithChildren(); 159 PassRefPtr<Element> cloneElementWithChildren();
160 PassRefPtr<Element> cloneElementWithoutChildren(); 160 PassRefPtr<Element> cloneElementWithoutChildren();
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 219
220 virtual bool isURLAttribute(const Attribute&) const { return false; } 220 virtual bool isURLAttribute(const Attribute&) const { return false; }
221 221
222 virtual bool isLiveLink() const { return false; } 222 virtual bool isLiveLink() const { return false; }
223 KURL hrefURL() const; 223 KURL hrefURL() const;
224 224
225 KURL getURLAttribute(const QualifiedName&) const; 225 KURL getURLAttribute(const QualifiedName&) const;
226 KURL getNonEmptyURLAttribute(const QualifiedName&) const; 226 KURL getNonEmptyURLAttribute(const QualifiedName&) const;
227 227
228 virtual const AtomicString imageSourceURL() const; 228 virtual const AtomicString imageSourceURL() const;
229 virtual Image* imageContents() { return 0; }
230 229
231 void focus(bool restorePreviousSelection = true, FocusType = FocusTypeNone); 230 void focus(bool restorePreviousSelection = true, FocusType = FocusTypeNone);
232 void updateFocusAppearance(bool restorePreviousSelection); 231 void updateFocusAppearance(bool restorePreviousSelection);
233 void blur(); 232 void blur();
234 // Whether this element can receive focus at all. Most elements are not 233 // Whether this element can receive focus at all. Most elements are not
235 // focusable but some elements, such as form controls and links, are. Unlike 234 // focusable but some elements, such as form controls and links, are. Unlike
236 // rendererIsFocusable(), this method may be called when layout is not up to 235 // rendererIsFocusable(), this method may be called when layout is not up to
237 // date, so it must not use the renderer to determine focusability. 236 // date, so it must not use the renderer to determine focusability.
238 virtual bool supportsFocus() const; 237 virtual bool supportsFocus() const;
239 // Whether the node can actually be focused. 238 // Whether the node can actually be focused.
240 bool isFocusable() const; 239 bool isFocusable() const;
241 bool isKeyboardFocusable() const; 240 bool isKeyboardFocusable() const;
242 virtual bool isMouseFocusable() const; 241 bool isMouseFocusable() const;
243 virtual void willCallDefaultEventHandler(const Event&) override final; 242 virtual void willCallDefaultEventHandler(const Event&) override final;
244 void dispatchFocusEvent(Element* oldFocusedElement, FocusType); 243 void dispatchFocusEvent(Element* oldFocusedElement, FocusType);
245 void dispatchBlurEvent(Element* newFocusedElement); 244 void dispatchBlurEvent(Element* newFocusedElement);
246 void dispatchFocusInEvent(const AtomicString& eventType, Element* oldFocused Element); 245 void dispatchFocusInEvent(const AtomicString& eventType, Element* oldFocused Element);
247 void dispatchFocusOutEvent(const AtomicString& eventType, Element* newFocuse dElement); 246 void dispatchFocusOutEvent(const AtomicString& eventType, Element* newFocuse dElement);
248 247
249 virtual String title() const { return String(); } 248 String title() const;
250 249
251 // Called by the parser when this element's close tag is reached, 250 // Called by the parser when this element's close tag is reached,
252 // signaling that all child tags have been parsed and added. 251 // signaling that all child tags have been parsed and added.
253 // This is needed for <applet> and <object> elements, which can't lay themse lves out 252 // This is needed for <applet> and <object> elements, which can't lay themse lves out
254 // until they know all of their nested <param>s. [Radar 3603191, 4040848]. 253 // until they know all of their nested <param>s. [Radar 3603191, 4040848].
255 // Also used for script elements and some SVG elements for similar purposes, 254 // Also used for script elements and some SVG elements for similar purposes,
256 // but making parsing a special case in this respect should be avoided if po ssible. 255 // but making parsing a special case in this respect should be avoided if po ssible.
257 virtual void finishParsingChildren() { } 256 virtual void finishParsingChildren() { }
258 257
259 bool matches(const String& selectors, ExceptionState&); 258 bool matches(const String& selectors, ExceptionState&);
(...skipping 25 matching lines...) Expand all
285 bool hasInputMethodContext() const; 284 bool hasInputMethodContext() const;
286 285
287 void synchronizeAttribute(const AtomicString& localName) const; 286 void synchronizeAttribute(const AtomicString& localName) const;
288 287
289 MutableStylePropertySet& ensureMutableInlineStyle(); 288 MutableStylePropertySet& ensureMutableInlineStyle();
290 void clearMutableInlineStyleIfEmpty(); 289 void clearMutableInlineStyleIfEmpty();
291 290
292 void setTabIndex(int); 291 void setTabIndex(int);
293 virtual short tabIndex() const override; 292 virtual short tabIndex() const override;
294 293
294 String contentEditable() const;
295 void setContentEditable(const String&, ExceptionState&);
296
297 bool spellcheck() const;
298 void setSpellcheck(bool);
299
300 const AtomicString& dir();
301 void setDir(const AtomicString&);
302
303 void click();
304
295 String textFromChildren(); 305 String textFromChildren();
296 306
297 protected: 307 protected:
298 Element(const QualifiedName& tagName, Document*, ConstructionType); 308 Element(const QualifiedName& tagName, Document*, ConstructionType);
299 309
300 const ElementData* elementData() const { return m_elementData.get(); } 310 const ElementData* elementData() const { return m_elementData.get(); }
301 UniqueElementData& ensureUniqueElementData(); 311 UniqueElementData& ensureUniqueElementData();
302 312
303 virtual void insertedInto(ContainerNode*) override; 313 virtual void insertedInto(ContainerNode*) override;
304 virtual void removedFrom(ContainerNode*) override; 314 virtual void removedFrom(ContainerNode*) override;
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 clearFlag(IsInShadowTreeFlag); 552 clearFlag(IsInShadowTreeFlag);
543 } 553 }
544 554
545 inline ShadowRoot* Node::shadowRoot() const 555 inline ShadowRoot* Node::shadowRoot() const
546 { 556 {
547 if (!isElementNode()) 557 if (!isElementNode())
548 return 0; 558 return 0;
549 return toElement(this)->shadowRoot(); 559 return toElement(this)->shadowRoot();
550 } 560 }
551 561
562 inline bool Node::hasTagName(const HTMLQualifiedName& name) const
563 {
564 return isHTMLElement() && toElement(*this).hasTagName(name);
565 }
566
552 inline void Element::invalidateStyleAttribute() 567 inline void Element::invalidateStyleAttribute()
553 { 568 {
554 ASSERT(elementData()); 569 ASSERT(elementData());
555 elementData()->m_styleAttributeIsDirty = true; 570 elementData()->m_styleAttributeIsDirty = true;
556 } 571 }
557 572
558 inline bool isShadowHost(const Node* node) 573 inline bool isShadowHost(const Node* node)
559 { 574 {
560 return node && node->isElementNode() && toElement(node)->shadow(); 575 return node && node->isElementNode() && toElement(node)->shadow();
561 } 576 }
(...skipping 25 matching lines...) Expand all
587 static PassRefPtr<T> create(const QualifiedName&, Document&) 602 static PassRefPtr<T> create(const QualifiedName&, Document&)
588 #define DEFINE_ELEMENT_FACTORY_WITH_TAGNAME(T) \ 603 #define DEFINE_ELEMENT_FACTORY_WITH_TAGNAME(T) \
589 PassRefPtr<T> T::create(const QualifiedName& tagName, Document& document) \ 604 PassRefPtr<T> T::create(const QualifiedName& tagName, Document& document) \
590 { \ 605 { \
591 return adoptRef(new T(tagName, document)); \ 606 return adoptRef(new T(tagName, document)); \
592 } 607 }
593 608
594 } // namespace 609 } // namespace
595 610
596 #endif // SKY_ENGINE_CORE_DOM_ELEMENT_H_ 611 #endif // SKY_ENGINE_CORE_DOM_ELEMENT_H_
OLDNEW
« no previous file with comments | « no previous file | sky/engine/core/dom/Element.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698