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: sky/engine/web/WebElement.cpp

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 | « sky/engine/public/web/WebElement.h ('k') | 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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 30 matching lines...) Expand all
41 #include "sky/engine/public/web/WebDocument.h" 41 #include "sky/engine/public/web/WebDocument.h"
42 #include "sky/engine/wtf/PassRefPtr.h" 42 #include "sky/engine/wtf/PassRefPtr.h"
43 43
44 namespace blink { 44 namespace blink {
45 45
46 WebString WebElement::tagName() const 46 WebString WebElement::tagName() const
47 { 47 {
48 return constUnwrap<Element>()->tagName(); 48 return constUnwrap<Element>()->tagName();
49 } 49 }
50 50
51 bool WebElement::hasHTMLTagName(const WebString& tagName) const
52 {
53 // How to create class nodeName localName
54 // createElement('input') HTMLInputElement INPUT input
55 // createElement('INPUT') HTMLInputElement INPUT input
56 // createElementNS(xhtmlNS, 'input') HTMLInputElement INPUT input
57 // createElementNS(xhtmlNS, 'INPUT') HTMLUnknownElement INPUT INPUT
58 const Element* element = constUnwrap<Element>();
59 // FIXME: This could just call element->hasLocalName().
60 return element->localName() == String(tagName).lower();
61 }
62
63 bool WebElement::hasAttribute(const WebString& attrName) const 51 bool WebElement::hasAttribute(const WebString& attrName) const
64 { 52 {
65 return constUnwrap<Element>()->hasAttribute(attrName); 53 return constUnwrap<Element>()->hasAttribute(attrName);
66 } 54 }
67 55
68 void WebElement::removeAttribute(const WebString& attrName) 56 void WebElement::removeAttribute(const WebString& attrName)
69 { 57 {
70 // TODO: Custom element callbacks need to be called on WebKit API methods th at 58 // TODO: Custom element callbacks need to be called on WebKit API methods th at
71 // mutate the DOM in any way. 59 // mutate the DOM in any way.
72 CustomElementProcessingStack::CallbackDeliveryScope deliverCustomElementCall backs; 60 CustomElementProcessingStack::CallbackDeliveryScope deliverCustomElementCall backs;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 107
120 WebString WebElement::computeInheritedLanguage() const 108 WebString WebElement::computeInheritedLanguage() const
121 { 109 {
122 return WebString(constUnwrap<Element>()->computeInheritedLanguage()); 110 return WebString(constUnwrap<Element>()->computeInheritedLanguage());
123 } 111 }
124 112
125 void WebElement::requestFullScreen() 113 void WebElement::requestFullScreen()
126 { 114 {
127 } 115 }
128 116
129 WebImage WebElement::imageContents()
130 {
131 if (isNull())
132 return WebImage();
133
134 Image* image = unwrap<Element>()->imageContents();
135 if (!image)
136 return WebImage();
137
138 RefPtr<NativeImageSkia> bitmap = image->nativeImageForCurrentFrame();
139 if (!bitmap)
140 return WebImage();
141
142 return bitmap->bitmap();
143 }
144
145 WebElement::WebElement(const PassRefPtr<Element>& elem) 117 WebElement::WebElement(const PassRefPtr<Element>& elem)
146 : WebNode(elem) 118 : WebNode(elem)
147 { 119 {
148 } 120 }
149 121
150 WebElement& WebElement::operator=(const PassRefPtr<Element>& elem) 122 WebElement& WebElement::operator=(const PassRefPtr<Element>& elem)
151 { 123 {
152 m_private = elem; 124 m_private = elem;
153 return *this; 125 return *this;
154 } 126 }
155 127
156 WebElement::operator PassRefPtr<Element>() const 128 WebElement::operator PassRefPtr<Element>() const
157 { 129 {
158 return toElement(m_private.get()); 130 return toElement(m_private.get());
159 } 131 }
160 132
161 } // namespace blink 133 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/public/web/WebElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698