# frozen_string_literal: true
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# This file is automatically generated. Any changes will be lost!
module Selenium
module DevTools
module V101
class CSS
EVENTS = {
fonts_updated: 'fontsUpdated',
media_query_result_changed: 'mediaQueryResultChanged',
style_sheet_added: 'styleSheetAdded',
style_sheet_changed: 'styleSheetChanged',
style_sheet_removed: 'styleSheetRemoved',
}.freeze
def initialize(devtools)
@devtools = devtools
end
def on(event, &block)
event = EVENTS[event] if event.is_a?(Symbol)
@devtools.callbacks["CSS.#{event}"] << block
end
def add_rule(style_sheet_id:, rule_text:, location:)
@devtools.send_cmd('CSS.addRule',
styleSheetId: style_sheet_id,
ruleText: rule_text,
location: location)
end
def collect_class_names(style_sheet_id:)
@devtools.send_cmd('CSS.collectClassNames',
styleSheetId: style_sheet_id)
end
def create_style_sheet(frame_id:)
@devtools.send_cmd('CSS.createStyleSheet',
frameId: frame_id)
end
def disable
@devtools.send_cmd('CSS.disable')
end
def enable
@devtools.send_cmd('CSS.enable')
end
def force_pseudo_state(node_id:, forced_pseudo_classes:)
@devtools.send_cmd('CSS.forcePseudoState',
nodeId: node_id,
forcedPseudoClasses: forced_pseudo_classes)
end
def get_background_colors(node_id:)
@devtools.send_cmd('CSS.getBackgroundColors',
nodeId: node_id)
end
def get_computed_style_for_node(node_id:)
@devtools.send_cmd('CSS.getComputedStyleForNode',
nodeId: node_id)
end
def get_inline_styles_for_node(node_id:)
@devtools.send_cmd('CSS.getInlineStylesForNode',
nodeId: node_id)
end
def get_matched_styles_for_node(node_id:)
@devtools.send_cmd('CSS.getMatchedStylesForNode',
nodeId: node_id)
end
def get_media_queries
@devtools.send_cmd('CSS.getMediaQueries')
end
def get_platform_fonts_for_node(node_id:)
@devtools.send_cmd('CSS.getPlatformFontsForNode',
nodeId: node_id)
end
def get_style_sheet_text(style_sheet_id:)
@devtools.send_cmd('CSS.getStyleSheetText',
styleSheetId: style_sheet_id)
end
def get_layers_for_node(node_id:)
@devtools.send_cmd('CSS.getLayersForNode',
nodeId: node_id)
end
def track_computed_style_updates(properties_to_track:)
@devtools.send_cmd('CSS.trackComputedStyleUpdates',
propertiesToTrack: properties_to_track)
end
def take_computed_style_updates
@devtools.send_cmd('CSS.takeComputedStyleUpdates')
end
def set_effective_property_value_for_node(node_id:, property_name:, value:)
@devtools.send_cmd('CSS.setEffectivePropertyValueForNode',
nodeId: node_id,
propertyName: property_name,
value: value)
end
def set_keyframe_key(style_sheet_id:, range:, key_text:)
@devtools.send_cmd('CSS.setKeyframeKey',
styleSheetId: style_sheet_id,
range: range,
keyText: key_text)
end
def set_media_text(style_sheet_id:, range:, text:)
@devtools.send_cmd('CSS.setMediaText',
styleSheetId: style_sheet_id,
range: range,
text: text)
end
def set_container_query_text(style_sheet_id:, range:, text:)
@devtools.send_cmd('CSS.setContainerQueryText',
styleSheetId: style_sheet_id,
range: range,
text: text)
end
def set_supports_text(style_sheet_id:, range:, text:)
@devtools.send_cmd('CSS.setSupportsText',
styleSheetId: style_sheet_id,
range: range,
text: text)
end
def set_rule_selector(style_sheet_id:, range:, selector:)
@devtools.send_cmd('CSS.setRuleSelector',
styleSheetId: style_sheet_id,
range: range,
selector: selector)
end
def set_style_sheet_text(style_sheet_id:, text:)
@devtools.send_cmd('CSS.setStyleSheetText',
styleSheetId: style_sheet_id,
text: text)
end
def set_style_texts(edits:)
@devtools.send_cmd('CSS.setStyleTexts',
edits: edits)
end
def start_rule_usage_tracking
@devtools.send_cmd('CSS.startRuleUsageTracking')
end
def stop_rule_usage_tracking
@devtools.send_cmd('CSS.stopRuleUsageTracking')
end
def take_coverage_delta
@devtools.send_cmd('CSS.takeCoverageDelta')
end
def set_local_fonts_enabled(enabled:)
@devtools.send_cmd('CSS.setLocalFontsEnabled',
enabled: enabled)
end
end # CSS
end # V101
end # DevTools
end # Selenium