Remove webelem.style_property()

It's not used anymore, and not possible to support with QtWebEngine without a
massive performance hit when serializing elements.
This commit is contained in:
Florian Bruhin 2017-03-01 17:54:27 +01:00
parent b4af966167
commit 65f407e926
5 changed files with 2 additions and 25 deletions

View File

@ -120,10 +120,6 @@ class AbstractWebElement(collections.abc.MutableMapping):
"""Get the geometry for this element."""
raise NotImplementedError
def style_property(self, name, *, strategy):
"""Get the element style resolved with the given strategy."""
raise NotImplementedError
def classes(self):
"""Get a list of classes assigned to this element."""
raise NotImplementedError

View File

@ -79,10 +79,6 @@ class WebEngineElement(webelem.AbstractWebElement):
log.stub()
return QRect()
def style_property(self, name, *, strategy):
log.stub()
return ''
def classes(self):
"""Get a list of classes assigned to this element."""
return self._js_dict['class_name'].split()

View File

@ -96,16 +96,6 @@ class WebKitElement(webelem.AbstractWebElement):
self._check_vanished()
return self._elem.geometry()
def style_property(self, name, *, strategy):
self._check_vanished()
strategies = {
# FIXME:qtwebengine which ones do we actually need?
'inline': QWebElement.InlineStyle,
'computed': QWebElement.ComputedStyle,
}
qt_strategy = strategies[strategy]
return self._elem.styleProperty(name, qt_strategy)
def classes(self):
self._check_vanished()
return self._elem.classes()

View File

@ -65,7 +65,6 @@ def whitelist_generator():
yield 'qutebrowser.utils.debug.qflags_key'
yield 'qutebrowser.utils.qtutils.QtOSError.qt_errno'
yield 'scripts.utils.bg_colors'
yield 'qutebrowser.browser.webelem.AbstractWebElement.style_property'
yield 'qutebrowser.config.configtypes.Float'
# Qt attributes

View File

@ -262,7 +262,6 @@ class TestWebKitElement:
len,
lambda e: e.has_frame(),
lambda e: e.geometry(),
lambda e: e.style_property('visibility', strategy='computed'),
lambda e: e.value(),
lambda e: e.set_value('foo'),
lambda e: e.insert_text('foo'),
@ -276,8 +275,8 @@ class TestWebKitElement:
lambda e: e.rect_on_view(),
lambda e: e._is_visible(None),
], ids=['str', 'getitem', 'setitem', 'delitem', 'contains', 'iter', 'len',
'frame', 'geometry', 'style_property', 'value', 'set_value',
'insert_text', 'is_writable', 'is_content_editable', 'is_editable',
'frame', 'geometry', 'value', 'set_value', 'insert_text',
'is_writable', 'is_content_editable', 'is_editable',
'is_text_input', 'remove_blank_target', 'outer_xml', 'tag_name',
'rect_on_view', 'is_visible'])
def test_vanished(self, elem, code):
@ -413,9 +412,6 @@ class TestWebKitElement:
elem._elem.tagName.return_value = 'SPAN'
assert elem.tag_name() == 'span'
def test_style_property(self, elem):
assert elem.style_property('foo', strategy='computed') == 'bar'
def test_value(self, elem):
elem._elem.evaluateJavaScript.return_value = 'js'
assert elem.value() == 'js'