Modified: trunk/Source/WebCore/ChangeLog (230794 => 230795)
--- trunk/Source/WebCore/ChangeLog 2018-04-19 04:02:30 UTC (rev 230794)
+++ trunk/Source/WebCore/ChangeLog 2018-04-19 04:19:50 UTC (rev 230795)
@@ -1,3 +1,21 @@
+2018-04-18 Daniel Bates <[email protected]>
+
+ Cleanup TextControlInnerElements
+ https://bugs.webkit.org/show_bug.cgi?id=184475
+
+ Reviewed by Antti Koivisto.
+
+ Clean up TextControlInnerElement::resolveCustomStyle(), move the implementation of
+ TextControlPlaceholderElement::create() from the header to the cpp file, replace
+ fancy comments to demarcate classes with MARK: so that they show up in Xcode's
+ function menu.
+
+ * html/shadow/TextControlInnerElements.cpp:
+ (WebCore::TextControlInnerElement::resolveCustomStyle):
+ (WebCore::TextControlPlaceholderElement::TextControlPlaceholderElement):
+ (WebCore::TextControlPlaceholderElement::create):
+ * html/shadow/TextControlInnerElements.h:
+
2018-04-18 Chris Dumez <[email protected]>
Rename WindowProxyController to WindowProxy
Modified: trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp (230794 => 230795)
--- trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp 2018-04-19 04:02:30 UTC (rev 230794)
+++ trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp 2018-04-19 04:19:50 UTC (rev 230795)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006, 2008, 2010, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2006-2018 Apple Inc. All rights reserved.
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -85,22 +85,18 @@
std::optional<ElementStyle> TextControlInnerElement::resolveCustomStyle(const RenderStyle&, const RenderStyle* shadowHostStyle)
{
- auto innerContainerStyle = RenderStyle::createPtr();
- innerContainerStyle->inheritFrom(*shadowHostStyle);
-
- innerContainerStyle->setFlexGrow(1);
- // min-width: 0; is needed for correct shrinking.
- innerContainerStyle->setMinWidth(Length(0, Fixed));
- innerContainerStyle->setDisplay(BLOCK);
- innerContainerStyle->setDirection(LTR);
-
- // We don't want the shadow dom to be editable, so we set this block to read-only in case the input itself is editable.
- innerContainerStyle->setUserModify(READ_ONLY);
-
- return ElementStyle(WTFMove(innerContainerStyle));
+ auto newStyle = RenderStyle::createPtr();
+ newStyle->inheritFrom(*shadowHostStyle);
+ newStyle->setFlexGrow(1);
+ newStyle->setMinWidth(Length { 0, Fixed }); // Needed for correct shrinking.
+ newStyle->setDisplay(BLOCK);
+ newStyle->setDirection(LTR);
+ // We don't want the shadow DOM to be editable, so we set this block to read-only in case the input itself is editable.
+ newStyle->setUserModify(READ_ONLY);
+ return ElementStyle { WTFMove(newStyle) };
}
-// ---------------------------
+// MARK: TextControlInnerTextElement
inline TextControlInnerTextElement::TextControlInnerTextElement(Document& document)
: HTMLDivElement(divTag, document)
@@ -148,9 +144,9 @@
return ElementStyle(std::make_unique<RenderStyle>(WTFMove(style)));
}
-// ----------------------------
+// MARK: TextControlPlaceholderElement
-TextControlPlaceholderElement::TextControlPlaceholderElement(Document& document)
+inline TextControlPlaceholderElement::TextControlPlaceholderElement(Document& document)
: HTMLDivElement(divTag, document)
{
setPseudo(AtomicString("placeholder", AtomicString::ConstructFromLiteral));
@@ -157,6 +153,11 @@
setHasCustomStyleResolveCallbacks();
}
+Ref<TextControlPlaceholderElement> TextControlPlaceholderElement::create(Document& document)
+{
+ return adoptRef(*new TextControlPlaceholderElement(document));
+}
+
std::optional<ElementStyle> TextControlPlaceholderElement::resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle)
{
auto style = resolveStyle(&parentStyle);
@@ -171,7 +172,7 @@
return WTFMove(style);
}
-// ----------------------------
+// MARK: SearchFieldResultsButtonElement
inline SearchFieldResultsButtonElement::SearchFieldResultsButtonElement(Document& document)
: HTMLDivElement(divTag, document)
@@ -213,7 +214,7 @@
}
#endif
-// ----------------------------
+// MARK: SearchFieldCancelButtonElement
inline SearchFieldCancelButtonElement::SearchFieldCancelButtonElement(Document& document)
: HTMLDivElement(divTag, document)
Modified: trunk/Source/WebCore/html/shadow/TextControlInnerElements.h (230794 => 230795)
--- trunk/Source/WebCore/html/shadow/TextControlInnerElements.h 2018-04-19 04:02:30 UTC (rev 230794)
+++ trunk/Source/WebCore/html/shadow/TextControlInnerElements.h 2018-04-19 04:19:50 UTC (rev 230795)
@@ -75,7 +75,7 @@
class TextControlPlaceholderElement final : public HTMLDivElement {
WTF_MAKE_ISO_ALLOCATED(TextControlPlaceholderElement);
public:
- static Ref<TextControlPlaceholderElement> create(Document& document) { return adoptRef(*new TextControlPlaceholderElement(document)); }
+ static Ref<TextControlPlaceholderElement> create(Document&);
private:
TextControlPlaceholderElement(Document&);