Changeset 209211 in webkit
- Timestamp:
- Dec 1, 2016 2:24:07 PM (7 years ago)
- Location:
- branches/safari-602-branch
- Files:
-
- 12 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-602-branch/LayoutTests/ChangeLog
r209210 r209211 1 2016-12-01 Matthew Hanson <matthew_hanson@apple.com> 2 3 Merge r209145. rdar://problem/29404231 4 5 2016-11-30 Brent Fulgham <bfulgham@apple.com> 6 7 Use 'childOfType' template when retrieving Shadow DOM elements 8 https://bugs.webkit.org/show_bug.cgi?id=165145 9 <rdar://problem/29331830> 10 11 Reviewed by Antti Koivisto. 12 13 * fast/shadow-dom/color-input-element-shadow-manipulation-expected.txt: Added. 14 * fast/shadow-dom/color-input-element-shadow-manipulation.html: Added. 15 * fast/shadow-dom/file-input-element-shadow-manipulation-expected.txt: Added. 16 * fast/shadow-dom/file-input-element-shadow-manipulation.html: Added. 17 * fast/shadow-dom/keygen-shadow-manipulation-expected.txt: Added. 18 * fast/shadow-dom/keygen-shadow-manipulation.html: Added. 19 * fast/shadow-dom/media-shadow-manipulation-expected.txt: Added. 20 * fast/shadow-dom/media-shadow-manipulation.html: Added. 21 * fast/shadow-dom/range-input-element-shadow-manipulation-expected.txt: Added. 22 * fast/shadow-dom/range-input-element-shadow-manipulation.html: Added. 23 * fast/shadow-dom/textarea-shadow-manipulation-expected.txt: Added. 24 * fast/shadow-dom/textarea-shadow-manipulation.html: Added. 25 1 26 2016-12-01 Matthew Hanson <matthew_hanson@apple.com> 2 27 -
branches/safari-602-branch/Source/WebCore/ChangeLog
r209210 r209211 1 2016-12-01 Matthew Hanson <matthew_hanson@apple.com> 2 3 Merge r209145. rdar://problem/29404231 4 5 2016-11-30 Brent Fulgham <bfulgham@apple.com> 6 7 Use 'childOfType' template when retrieving Shadow DOM elements 8 https://bugs.webkit.org/show_bug.cgi?id=165145 9 <rdar://problem/29331830> 10 11 Reviewed by Antti Koivisto. 12 13 Tests: fast/shadow-dom/color-input-element-shadow-manipulation.html 14 fast/shadow-dom/file-input-element-shadow-manipulation.html 15 fast/shadow-dom/keygen-shadow-manipulation.html 16 fast/shadow-dom/media-shadow-manipulation.html 17 fast/shadow-dom/range-input-element-shadow-manipulation.html 18 fast/shadow-dom/textarea-shadow-manipulation.html 19 20 Switch to using 'childOfType' when retrieving Shadow DOM elements, rather 21 than relying on expected element positions, as these can be changed by 22 JavaScript. 23 24 Drive by fix: Make more use of is<> and downcast<> templates rather than blindly casting. 25 26 * dom/Element.h: 27 (WebCore::Element::isUploadButton): Added. 28 (WebCore::Element::isSliderContainerElement): Added. 29 * html/ColorInputType.cpp: 30 (WebCore::ColorInputType::shadowColorSwatch): Use 'childOfType' rather than assuming 31 the first child is the one we want. 32 * html/FileInputType.cpp: 33 (isType): Added. 34 (WebCore::FileInputType::disabledAttributeChanged): Use 'childOfType' rather than assuming 35 the first child is the one we want. 36 (WebCore::FileInputType::multipleAttributeChanged): Ditto. 37 * html/HTMLKeygenElement.cpp: 38 (WebCore::HTMLKeygenElement::shadowSelect): Ditto. 39 * html/HTMLMediaElement.cpp: 40 (WebCore::HTMLMediaElement::mediaControls): Ditto. 41 (WebCore::HTMLMediaElement::hasMediaControls): Ditto. 42 * html/HTMLTextAreaElement.cpp: 43 (WebCore::HTMLTextAreaElement::innerTextElement): Ditto. 44 * html/RangeInputType.cpp: 45 (WebCore::RangeInputType::sliderTrackElement): Ditto. 46 * html/shadow/SliderThumbElement.h: 47 (isType): Added. 48 * svg/SVGUseElement.cpp: 49 (WebCore::SVGUseElement::targetClone): Use 'childOfType' rather than assuming 50 the first child is the one we want. 51 1 52 2016-12-01 Matthew Hanson <matthew_hanson@apple.com> 2 53 -
branches/safari-602-branch/Source/WebCore/dom/Element.h
r207194 r209211 423 423 virtual bool isOutOfRange() const { return false; } 424 424 virtual bool isFrameElementBase() const { return false; } 425 virtual bool isUploadButton() const { return false; } 426 virtual bool isSliderContainerElement() const { return false; } 425 427 426 428 bool canContainRangeEndPoint() const override; -
branches/safari-602-branch/Source/WebCore/html/ColorInputType.cpp
r203337 r209211 39 39 #include "Chrome.h" 40 40 #include "Color.h" 41 #include "ElementChildIterator.h" 41 42 #include "HTMLDataListElement.h" 42 43 #include "HTMLDivElement.h" … … 205 206 { 206 207 ShadowRoot* shadow = element().userAgentShadowRoot(); 207 return shadow ? downcast<HTMLElement>(shadow->firstChild()->firstChild()) : nullptr; 208 if (!shadow) 209 return nullptr; 210 211 auto wrapper = childrenOfType<HTMLDivElement>(*shadow).first(); 212 if (!wrapper) 213 return nullptr; 214 215 return childrenOfType<HTMLDivElement>(*wrapper).first(); 208 216 } 209 217 -
branches/safari-602-branch/Source/WebCore/html/FileInputType.cpp
r203337 r209211 25 25 #include "Chrome.h" 26 26 #include "DragData.h" 27 #include "ElementChildIterator.h" 27 28 #include "Event.h" 28 29 #include "File.h" … … 40 41 #include "ScriptController.h" 41 42 #include "ShadowRoot.h" 43 #include <wtf/TypeCasts.h> 42 44 #include <wtf/text/StringBuilder.h> 45 46 47 namespace WebCore { 48 class UploadButtonElement; 49 } 50 51 SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::UploadButtonElement) 52 static bool isType(const WebCore::Element& element) { return element.isUploadButton(); } 53 static bool isType(const WebCore::Node& node) { return is<WebCore::Element>(node) && isType(downcast<WebCore::Element>(node)); } 54 SPECIALIZE_TYPE_TRAITS_END() 43 55 44 56 namespace WebCore { … … 52 64 53 65 private: 66 bool isUploadButton() const override { return true; } 67 54 68 UploadButtonElement(Document&); 55 69 }; … … 278 292 { 279 293 ASSERT(element().shadowRoot()); 280 UploadButtonElement* button = static_cast<UploadButtonElement*>(element().userAgentShadowRoot()->firstChild()); 281 if (button) 294 295 ShadowRoot* root = element().userAgentShadowRoot(); 296 if (!root) 297 return; 298 299 if (auto* button = childrenOfType<UploadButtonElement>(*root).first()) 282 300 button->setBooleanAttribute(disabledAttr, element().isDisabledFormControl()); 283 301 } … … 286 304 { 287 305 ASSERT(element().shadowRoot()); 288 UploadButtonElement* button = static_cast<UploadButtonElement*>(element().userAgentShadowRoot()->firstChild()); 289 if (button) 306 307 ShadowRoot* root = element().userAgentShadowRoot(); 308 if (!root) 309 return; 310 311 if (auto* button = childrenOfType<UploadButtonElement>(*root).first()) 290 312 button->setValue(element().multiple() ? fileButtonChooseMultipleFilesLabel() : fileButtonChooseFileLabel()); 291 313 } -
branches/safari-602-branch/Source/WebCore/html/HTMLKeygenElement.cpp
r203324 r209211 3 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 4 4 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * Copyright (C) 2004 , 2005, 2006, 2010Apple Inc. All rights reserved.5 * Copyright (C) 2004-2006, 2010, 2012-2016 Apple Inc. All rights reserved. 6 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 7 7 * … … 28 28 #include "Attribute.h" 29 29 #include "Document.h" 30 #include "ElementChildIterator.h" 30 31 #include "FormDataList.h" 31 32 #include "HTMLNames.h" … … 146 147 { 147 148 ShadowRoot* root = userAgentShadowRoot(); 148 return root ? downcast<HTMLSelectElement>(root->firstChild()) : nullptr; 149 if (!root) 150 return nullptr; 151 152 return childrenOfType<HTMLSelectElement>(*root).first(); 149 153 } 150 154 -
branches/safari-602-branch/Source/WebCore/html/HTMLMediaElement.cpp
r209209 r209211 5966 5966 { 5967 5967 #if ENABLE(MEDIA_CONTROLS_SCRIPT) 5968 return 0;5968 return nullptr; 5969 5969 #else 5970 return toMediaControls(userAgentShadowRoot()->firstChild()); 5970 ShadowRoot* root = userAgentShadowRoot(); 5971 if (!root) 5972 return nullptr; 5973 5974 return childrenOfType<MediaControls>(*root).first(); 5971 5975 #endif 5972 5976 } … … 5979 5983 5980 5984 if (ShadowRoot* userAgent = userAgentShadowRoot()) { 5981 Node* node = userAgent->firstChild();5985 Node* node = childrenOfType<MediaControls>(*root).first(); 5982 5986 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isMediaControls()); 5983 5987 return node; -
branches/safari-602-branch/Source/WebCore/html/HTMLTextAreaElement.cpp
r203324 r209211 3 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 4 4 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * Copyright (C) 2004 , 2005, 2006, 2007, 2008, 2010, 2014Apple Inc. All rights reserved.5 * Copyright (C) 2004-2008, 2010, 2014, 2016 Apple Inc. All rights reserved. 6 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 7 7 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) … … 31 31 #include "Document.h" 32 32 #include "Editor.h" 33 #include "ElementChildIterator.h" 33 34 #include "Event.h" 34 35 #include "EventHandler.h" … … 325 326 TextControlInnerTextElement* HTMLTextAreaElement::innerTextElement() const 326 327 { 327 return downcast<TextControlInnerTextElement>(userAgentShadowRoot()->firstChild()); 328 ShadowRoot* root = userAgentShadowRoot(); 329 if (!root) 330 return nullptr; 331 332 return childrenOfType<TextControlInnerTextElement>(*root).first(); 328 333 } 329 334 -
branches/safari-602-branch/Source/WebCore/html/RangeInputType.cpp
r203324 r209211 34 34 35 35 #include "AXObjectCache.h" 36 #include "ElementChildIterator.h" 36 37 #include "EventNames.h" 37 38 #include "ExceptionCodePlaceholder.h" … … 271 272 ASSERT(element().userAgentShadowRoot()->firstChild()->firstChild()); // track 272 273 273 return downcast<HTMLElement>(element().userAgentShadowRoot()->firstChild()->firstChild()); 274 ShadowRoot* root = element().userAgentShadowRoot(); 275 if (!root) 276 return nullptr; 277 278 auto* container = childrenOfType<SliderContainerElement>(*root).first(); 279 if (!container) 280 return nullptr; 281 282 return childrenOfType<HTMLElement>(*container).first(); 274 283 } 275 284 -
branches/safari-602-branch/Source/WebCore/html/shadow/SliderThumbElement.h
r200098 r209211 138 138 Optional<ElementStyle> resolveCustomStyle(const RenderStyle&, const RenderStyle*) override; 139 139 const AtomicString& shadowPseudoId() const override; 140 bool isSliderContainerElement() const override { return true; } 140 141 141 142 AtomicString m_shadowPseudoId; 142 143 }; 143 144 144 } 145 } // namespace WebCore 146 147 SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::SliderContainerElement) 148 static bool isType(const WebCore::Element& element) { return element.isSliderContainerElement(); } 149 static bool isType(const WebCore::Node& node) { return is<WebCore::Element>(node) && isType(downcast<WebCore::Element>(node)); } 150 SPECIALIZE_TYPE_TRAITS_END() 145 151 146 152 #endif -
branches/safari-602-branch/Source/WebCore/svg/SVGUseElement.cpp
r202105 r209211 262 262 if (!root) 263 263 return nullptr; 264 return downcast<SVGElement>(root->firstChild());264 return childrenOfType<SVGElement>(*root).first(); 265 265 } 266 266
Note: See TracChangeset
for help on using the changeset viewer.