Title: [225224] trunk/Source/WebCore
Revision
225224
Author
[email protected]
Date
2017-11-28 10:33:54 -0800 (Tue, 28 Nov 2017)

Log Message

[Cocoa] First pass at implementing alternative presentation button element
https://bugs.webkit.org/show_bug.cgi?id=179785
Part of <rdar://problem/34917108>

Reviewed by Brent Fulgham.

Implement support for substituting a button for one or more elements in a page.
This is a first pass. We will refine the logic and the API/SPI in subsequent
commits.

Tests: accessibility/alternative-presentation-button-input-type.html
       accessibility/alternative-presentation-button.html
       fast/forms/alternative-presentation-button/replace-and-remove.html
       fast/forms/alternative-presentation-button/replacement.html

* English.lproj/Localizable.strings: Add placeholder strings for localization.
* SourcesCocoa.txt: Add some files.
* WebCore.xcodeproj/project.pbxproj: Ditto.
* dom/Element.h:
* editing/Editor.cpp:
(WebCore::Editor::clear): Clear out all substitutions. This is called whenever
we are navigating between pages.
(WebCore::Editor::substituteWithAlternativePresentationButton): Added.
(WebCore::Editor::removeAlternativePresentationButton): Added.
(WebCore::Editor::didInsertAlternativePresentationButtonElement): Added.
(WebCore::Editor::didRemoveAlternativePresentationButtonElement): Added.
* editing/Editor.h:
* editing/cocoa/AlternativePresentationButtonSubstitution.cpp: Added.
(WebCore::AlternativePresentationButtonSubstitution::AlternativePresentationButtonSubstitution):
(WebCore::AlternativePresentationButtonSubstitution::initializeSavedDisplayStyles):
(WebCore::AlternativePresentationButtonSubstitution::apply):
(WebCore::AlternativePresentationButtonSubstitution::unapply):
* editing/cocoa/AlternativePresentationButtonSubstitution.h:
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::alternativePresentationButtonElement const): Added.
(WebCore::HTMLInputElement::setTypeWithoutUpdatingAttribute): Added.
(WebCore::HTMLInputElement::createInputType): Extracted the logic to create the InputType from
HTMLInputElement::updateType() to here and added logic to create the input type for the
alternative presentation button. This input type is not web exposed.
(WebCore::HTMLInputElement::updateType): Modified to take the name of the InputType object to
create as an argument and pass it through to HTMLInputElement::createInputType() to actually
create it. Reordered the logic for destroying the shadow tree of the old InputType, deallocating
the old InputType, and assigning the new InputType such that we assign the new InputType,
destroy the shadow tree of the old InputType, and deallocate the old InputType. This ordering
allows AlternativePresentationButtonSubstitution::substitute() to avoid restoring the input
type saved before the substitution when the input type is changed by the page as opposed to
by SPI.
(WebCore::HTMLInputElement::parseAttribute): Pass the parsed type.
(WebCore::HTMLInputElement::willAttachRenderers): Ditto.
* html/HTMLInputElement.h: Change visibility of removeShadowRoot() from private to public so
that it can be called from AlternativePresentationButtonSubstitution.
* html/InputType.h:
(WebCore::InputType::alternativePresentationButtonElement const): Added.
* html/InputTypeNames.cpp:
(WebCore::InputTypeNames::alternativePresentationButton): Added.
* html/InputTypeNames.h:
* html/shadow/cocoa/AlternativePresentationButtonElement.cpp: Added.
(WebCore::AlternativePresentationButtonElement::create):
(WebCore::AlternativePresentationButtonElement::AlternativePresentationButtonElement):
(WebCore::AlternativePresentationButtonElement::insertedIntoAncestor):
(WebCore::AlternativePresentationButtonElement::removedFromAncestor):
(WebCore::AlternativePresentationButtonElement::didFinishInsertingNode):
(WebCore::AlternativePresentationButtonElement::defaultEventHandler):
* html/shadow/cocoa/AlternativePresentationButtonElement.h:
* html/shadow/cocoa/AlternativePresentationButtonInputType.cpp: Added.
(WebCore::AlternativePresentationButtonInputType::AlternativePresentationButtonInputType):
(WebCore::AlternativePresentationButtonInputType::formControlType const):
(WebCore::AlternativePresentationButtonInputType::appendFormData const):
(WebCore::AlternativePresentationButtonInputType::supportsValidation const):
(WebCore::AlternativePresentationButtonInputType::isTextButton const):
(WebCore::AlternativePresentationButtonInputType::alternativePresentationButtonElement const):
(WebCore::AlternativePresentationButtonInputType::createShadowSubtree):
(WebCore::AlternativePresentationButtonInputType::destroyShadowSubtree):
* html/shadow/cocoa/AlternativePresentationButtonInputType.h:
* page/ChromeClient.h:
* platform/LocalizedStrings.cpp:
(WebCore::AXAlternativePresentationButtonLabel):
(WebCore::alternativePresentationButtonTitle):
(WebCore::alternativePresentationButtonSubtitle):
* platform/LocalizedStrings.h:
* testing/Internals.cpp:
(WebCore::Internals::substituteWithAlternativePresentationButton): Added.
(WebCore::Internals::removeAlternativePresentationButton): Added.
* testing/Internals.h:
* testing/Internals.idl:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (225223 => 225224)


--- trunk/Source/WebCore/ChangeLog	2017-11-28 18:31:31 UTC (rev 225223)
+++ trunk/Source/WebCore/ChangeLog	2017-11-28 18:33:54 UTC (rev 225224)
@@ -1,5 +1,18 @@
 2017-11-28  Daniel Bates  <[email protected]>
 
+        Add WebKitAdditions extension point to add user-agent stylesheet
+        https://bugs.webkit.org/show_bug.cgi?id=179702
+        <rdar://problem/35711147>
+
+        Reviewed by Andy Estes.
+
+        * DerivedSources.make: Write user agent stylesheet generation recipe in terms of the
+        automatic variable $^, which represents the list of the names of all prerequisites
+        for the rule. Make automatically expands the names in $^ up to their full absolute
+        path.
+
+2017-11-28  Daniel Bates  <[email protected]>
+
         [Cocoa] First pass at implementing alternative presentation button element
         https://bugs.webkit.org/show_bug.cgi?id=179785
         Part of <rdar://problem/34917108>

Modified: trunk/Source/WebCore/DerivedSources.make (225223 => 225224)


--- trunk/Source/WebCore/DerivedSources.make	2017-11-28 18:31:31 UTC (rev 225223)
+++ trunk/Source/WebCore/DerivedSources.make	2017-11-28 18:33:54 UTC (rev 225224)
@@ -1020,10 +1020,14 @@
 endif # IOS
 
 vpath %.in $(WEBKITADDITIONS_HEADER_SEARCH_PATHS)
+vpath %.css $(WEBKITADDITIONS_HEADER_SEARCH_PATHS)
 
 ADDITIONAL_EVENT_NAMES =
 ADDITIONAL_EVENT_TARGET_FACTORY =
+ADDITIONAL_USER_AGENT_STYLE_SHEETS =
 
+-include WebCoreDerivedSourcesAdditions.make
+
 JS_BINDING_IDLS += $(ADDITIONAL_BINDING_IDLS)
 
 all : $(ADDITIONAL_BINDING_IDLS:%.idl=JS%.h)
@@ -1213,39 +1217,40 @@
 
 # user agent style sheets
 
-USER_AGENT_STYLE_SHEETS = $(WebCore)/css/html.css $(WebCore)/css/quirks.css $(WebCore)/css/plugIns.css
-USER_AGENT_STYLE_SHEETS := $(USER_AGENT_STYLE_SHEETS) $(WebCore)/css/svg.css
+USER_AGENT_STYLE_SHEETS = css/html.css css/quirks.css css/plugIns.css css/svg.css
 
 ifeq ($(findstring ENABLE_MATHML,$(FEATURE_DEFINES)), ENABLE_MATHML)
-    USER_AGENT_STYLE_SHEETS := $(USER_AGENT_STYLE_SHEETS) $(WebCore)/css/mathml.css
+    USER_AGENT_STYLE_SHEETS += css/mathml.css
 endif
 
 ifeq ($(findstring ENABLE_VIDEO,$(FEATURE_DEFINES)), ENABLE_VIDEO)
-    USER_AGENT_STYLE_SHEETS := $(USER_AGENT_STYLE_SHEETS) $(WebCore)/css/mediaControls.css
+    USER_AGENT_STYLE_SHEETS += css/mediaControls.css
 endif
 
 ifeq ($(findstring ENABLE_FULLSCREEN_API,$(FEATURE_DEFINES)), ENABLE_FULLSCREEN_API)
-    USER_AGENT_STYLE_SHEETS := $(USER_AGENT_STYLE_SHEETS) $(WebCore)/css/fullscreen.css
+    USER_AGENT_STYLE_SHEETS += css/fullscreen.css
 endif
 
 ifeq ($(findstring ENABLE_SERVICE_CONTROLS,$(FEATURE_DEFINES)), ENABLE_SERVICE_CONTROLS)
-    USER_AGENT_STYLE_SHEETS := $(USER_AGENT_STYLE_SHEETS) $(WebCore)/html/shadow/mac/imageControlsMac.css
+    USER_AGENT_STYLE_SHEETS += html/shadow/mac/imageControlsMac.css
 endif
 
 ifeq ($(OS),MACOS)
-    USER_AGENT_STYLE_SHEETS := $(USER_AGENT_STYLE_SHEETS) $(WebCore)/Modules/plugins/QuickTimePluginReplacement.css
+    USER_AGENT_STYLE_SHEETS += Modules/plugins/QuickTimePluginReplacement.css
 endif
 
 ifeq ($(OS), Windows_NT)
-    USER_AGENT_STYLE_SHEETS := $(USER_AGENT_STYLE_SHEETS) $(WebCore)/css/themeWin.css $(WebCore)/css/themeWinQuirks.css
+    USER_AGENT_STYLE_SHEETS += css/themeWin.css css/themeWinQuirks.css
 endif
 
 ifeq ($(findstring ENABLE_METER_ELEMENT,$(FEATURE_DEFINES)), ENABLE_METER_ELEMENT)
-	USER_AGENT_STYLE_SHEETS := $(USER_AGENT_STYLE_SHEETS) $(WebCore)/html/shadow/meterElementShadow.css
+	USER_AGENT_STYLE_SHEETS += html/shadow/meterElementShadow.css
 endif
 
+USER_AGENT_STYLE_SHEETS += $(ADDITIONAL_USER_AGENT_STYLE_SHEETS)
+
 UserAgentStyleSheets.h : css/make-css-file-arrays.pl bindings/scripts/preprocessor.pm $(USER_AGENT_STYLE_SHEETS) $(PLATFORM_FEATURE_DEFINES)
-	$(PERL) $< --defines "$(FEATURE_DEFINES)" $@ UserAgentStyleSheetsData.cpp $(USER_AGENT_STYLE_SHEETS)
+	$(PERL) $< --defines "$(FEATURE_DEFINES)" $@ UserAgentStyleSheetsData.cpp $(foreach file, $^, $(if $(findstring $(notdir $(file)), $(USER_AGENT_STYLE_SHEETS)), $(file)))
 
 # --------
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to