Diff
Modified: releases/WebKitGTK/webkit-2.24/LayoutTests/ChangeLog (242437 => 242438)
--- releases/WebKitGTK/webkit-2.24/LayoutTests/ChangeLog 2019-03-05 11:59:27 UTC (rev 242437)
+++ releases/WebKitGTK/webkit-2.24/LayoutTests/ChangeLog 2019-03-05 12:40:23 UTC (rev 242438)
@@ -1,3 +1,13 @@
+2019-02-21 Darin Adler <da...@apple.com>
+
+ Some refinements for Node and Document
+ https://bugs.webkit.org/show_bug.cgi?id=194764
+
+ Reviewed by Ryosuke Niwa.
+
+ fast/forms/access-key-shadow-and-ordering-expected.txt: Added.
+ fast/forms/access-key-shadow-and-ordering.html: Added.
+
2019-02-20 Said Abou-Hallawa <sabouhall...@apple.com>
drawImage() clears the canvas if it's the source of the image and globalCompositeOperation is "copy"
Added: releases/WebKitGTK/webkit-2.24/LayoutTests/fast/forms/access-key-shadow-and-ordering-expected.txt (0 => 242438)
--- releases/WebKitGTK/webkit-2.24/LayoutTests/fast/forms/access-key-shadow-and-ordering-expected.txt (rev 0)
+++ releases/WebKitGTK/webkit-2.24/LayoutTests/fast/forms/access-key-shadow-and-ordering-expected.txt 2019-03-05 12:40:23 UTC (rev 242438)
@@ -0,0 +1,15 @@
+This test checks to see what happens when the same accesskey is set on multiple elements including cases where the elements are in the a shadow tree.
+
+1c 1w 3c 4w 5w 6c
+1: correct button focused, earlier in document
+1: correct button clicked, earlier in document
+2: correct button focused, in shadow
+2: correct button clicked, in shadow
+3: correct button focused, earlier in document
+3: correct button clicked, earlier in document
+4: correct button focused, earlier in document and in shadow
+4: correct button clicked, earlier in document and in shadow
+5: correct button focused, earlier in document and in shadow
+5: correct button clicked, earlier in document and in shadow
+6: correct button focused, earlier in document in slot
+6: correct button clicked, earlier in document in slot
Added: releases/WebKitGTK/webkit-2.24/LayoutTests/fast/forms/access-key-shadow-and-ordering.html (0 => 242438)
--- releases/WebKitGTK/webkit-2.24/LayoutTests/fast/forms/access-key-shadow-and-ordering.html (rev 0)
+++ releases/WebKitGTK/webkit-2.24/LayoutTests/fast/forms/access-key-shadow-and-ordering.html 2019-03-05 12:40:23 UTC (rev 242438)
@@ -0,0 +1,57 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+function log(message)
+{
+ var item = document.createElement("div");
+ item.appendChild(document.createTextNode(message));
+ document.getElementById("console").appendChild(item);
+}
+function pressKey(key)
+{
+ if (navigator.userAgent.search(/\bMac OS X\b/) != -1)
+ modifiers = ["ctrlKey", "altKey"];
+ else
+ modifiers = ["altKey"];
+ eventSender.keyDown(key, modifiers);
+}
+function test()
+{
+ document.getElementById("host2").attachShadow({ mode: 'closed' }).innerHTML = '<button accesskey="2" _onfocus_="log(\'2: correct button focused, in shadow\')" _onclick_="log(\'2: correct button clicked, in shadow\')">2c</button>';
+ document.getElementById("host3").attachShadow({ mode: 'closed' }).innerHTML = '<button accesskey="3" _onfocus_="log(\'3: wrong button focused, later in document and in shadow\')" _onclick_="log(\'3: wrong button clicked, later in document and in shadow\')">3w</button>';
+ document.getElementById("host4").attachShadow({ mode: 'closed' }).innerHTML = '<button accesskey="4" _onfocus_="log(\'4: correct button focused, earlier in document and in shadow\')" _onclick_="log(\'4: correct button clicked, earlier in document and in shadow\')">4c</button>';
+ document.getElementById("host5").attachShadow({ mode: 'closed' }).innerHTML = '<button accesskey="5" _onfocus_="log(\'5: correct button focused, earlier in document and in shadow\')" _onclick_="log(\'5: correct button clicked, earlier in document and in shadow\')">5c</button><slot></slot>';
+ document.getElementById("host6").attachShadow({ mode: 'closed' }).innerHTML = '<slot></slot><button accesskey="6" _onfocus_="log(\'6: wrong button focused, later in document and in shadow\')" _onclick_="log(\'6: correct button clicked, later in document and in shadow\')">6w</button>';
+
+ if (!window.testRunner)
+ return;
+ testRunner.dumpAsText();
+
+ for (var i = 1; i <= 6; i++)
+ pressKey(i.toString());
+}
+</script>
+</head>
+<body _onload_="test()">
+<p>This test checks to see what happens when the same accesskey is set on multiple elements including cases where the elements are in the a shadow tree.</p>
+<hr>
+<button accesskey="1" _onfocus_="log('1: correct button focused, earlier in document')" _onclick_="log('1: correct button clicked, earlier in document')">1c</button>
+<button accesskey="1" _onfocus_="log('1: wrong button focused, later in document')" _onclick_="log('1: wrong button clicked, later in document')">1w</button>
+
+<span id="host2"></span>
+
+<button accesskey="3" _onfocus_="log('3: correct button focused, earlier in document')" _onclick_="log('3: correct button clicked, earlier in document')">3c</button>
+<span id="host3"></span>
+
+<span id="host4"></span>
+<button accesskey="4" _onfocus_="log('4: wrong button focused, later in document')" _onclick_="log('4: wrong button clicked, later in document')">4w</button>
+
+<span id="host5"><button accesskey="5" _onfocus_="log('5: wrong button focused, later in document in slot')" _onclick_="log('5: wrong button clicked, later in document in slot')">5w</button></span>
+
+<span id="host6"><button accesskey="6" _onfocus_="log('6: correct button focused, earlier in document in slot')" _onclick_="log('6: correct button clicked, earlier in document in slot')">6c</button></span>
+
+<hr>
+<div id="console"></div>
+</body>
+</html>
Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/ChangeLog (242437 => 242438)
--- releases/WebKitGTK/webkit-2.24/Source/WebCore/ChangeLog 2019-03-05 11:59:27 UTC (rev 242437)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/ChangeLog 2019-03-05 12:40:23 UTC (rev 242438)
@@ -1,3 +1,170 @@
+2019-02-21 Darin Adler <da...@apple.com>
+
+ Some refinements for Node and Document
+ https://bugs.webkit.org/show_bug.cgi?id=194764
+
+ Reviewed by Ryosuke Niwa.
+
+ * accessibility/AccessibilityObject.cpp:
+ (WebCore::AccessibilityObject::press): Use shadowHost instead of
+ deprecatedShadowAncestorNode.
+ (WebCore::AccessibilityObject::axObjectCache const): Tweak coding style.
+ (WebCore::AccessibilityObject::focusedUIElement const): Use existing page
+ function to streamline.
+
+ * accessibility/AccessibilityRenderObject.cpp:
+ (WebCore::AccessibilityRenderObject::accessKey const): Use
+ attributeWithoutSynchronization for efficiency and consistency with other
+ code working with the accesskey attribute.
+
+ * dom/ContainerNode.cpp:
+ (WebCore::ContainerNode::childrenChanged): Added call to
+ invalidateAccessKeyCache, replacing old scheme tied to style recalculation.
+
+ * dom/DecodedDataDocumentParser.cpp:
+ (WebCore::DecodedDataDocumentParser::appendBytes): Update for name and return
+ type change of createDecoderIfNeeded to decoder.
+ (WebCore::DecodedDataDocumentParser::flush): Ditto.
+
+ * dom/Document.cpp:
+ (WebCore::Document::elementForAccessKey): Renamed from getElementForAccessKey
+ to match WebKit coding style. Changed to use unique_ptr instead of separate
+ boolean to keep track of map validity status.
+ (WebCore::Document::buildAccessKeyCache): Renamed from buildAccessKeyMap to
+ clarify that this is a cache. Changed to use composedTreeDescendants rather
+ than explicit calls to shadowRoot. Use add instead of set so that first element
+ in document order wins, instead of last element in document order. Updated
+ to make a new map in a new unique_ptr instead of populating a map.
+ (WebCore::Document::invalidateAccessKeyCacheSlowCase): Renamed from
+ invalidateAccessKeyMap, and left an inline part in the header so the fast case
+ of quickly checking for a null pointer can be inlined.
+ (WebCore::Document::doctype const): Use downcast instead of static_cast.
+ (WebCore::Document::scheduleStyleRecalc): Moved call to invalidateAccessKeyMap
+ from here to childrenChanged and accesskey attribute change handling.
+ (WebCore::Document::processFormatDetection): Set m_isTelephoneNumberParsingAllowed
+ directly since this is the only place that does it and we don't need to factor
+ that one line of code into a function.
+ (WebCore::Document::getOverrideStyle): Moved to header since it's just a stub
+ that always returns nullptr and can be inlined.
+ (WebCore::Document::setIsTelephoneNumberParsingAllowed): Deleted.
+ (WebCore::Document::ensureTemplateDocument): Removed nullptr frame argument to
+ the create function, since Document::create now always involves no frame.
+ (WebCore::Document::didAssociateFormControl): Changed argument type to a reference
+ and simplified the logic with a local variable.
+ (WebCore::Document::didAssociateFormControlsTimerFired): Simplified the null
+ checks and rearranged things so that m_associatedFormControls will always
+ get cleared even if the document is no longer associated with a page.
+
+ * dom/Document.h: Removed unnnecessary explicit values for enumerations (first
+ value is always zero, etc.) and formatted simple enumerations in a single line
+ for easier reading. Moved Document::create fucntion bodies out of line, removed
+ the frame argument from the simple "create with URL" overload and made the frame
+ argument for createNonRenderedPlaceholder be a reference rather than a pointer.
+ Renamed getElementByAccessKey to elementForAccessKey, invalidateAccessKeyMap to
+ invalidateAccessKeyCache, buildAccessKeyMap to buildAccessKeCache,
+ m_elementsByAccessKey to m_accessKeyCache and changed its type.
+ Removed bogus "DOM methods" comment, unused setParserFeature friend declaration,
+ setIsTelephoneNumberParsingAllowed function, and m_accessKeyMapValid flag.
+
+ * dom/Document.idl: Added comment highlighting that getOverrideStyle is just a
+ placeholder returning null.
+
+ * dom/Element.cpp:
+ (WebCore::Element::attributeChanged): Call invalidateAccessKeyCache when the
+ value of the accesskey attribute is changed. Also moved the class attribute code
+ so the attributes here are in alphabetical order (only class and id were out of
+ alphabetical order).
+
+ * dom/Node.cpp:
+ (WebCore::Node::isDescendantOrShadowDescendantOf const): Rewrote to no longer
+ use deprecatedShadowAncestorNode and used boolean operators to make it a
+ single line and easier to understand. Also added a FIXME since the
+ containsIncludingShadowDOM function is so similar, yet differently written.
+ (WebCore::Node::contains const): Rewrote as a single line to make this easier
+ to read and to *slightly* improve the speed in the "this == node" case.
+ (WebCore::Node::containsIncludingHostElements const): Use downcast.
+ (WebCore::Node::deprecatedShadowAncestorNode const): Deleted.
+
+ * dom/Node.h: Deleted now-unused deprecatedShadowAncestorNode.
+
+ * editing/ReplaceSelectionCommand.cpp:
+ (WebCore::ReplacementFragment::ReplacementFragment): Rewrote to use shadowHost
+ instead of deprecatedShadowAncestorNode.
+
+ * html/FormAssociatedElement.cpp:
+ (WebCore::FormAssociatedElement::resetFormOwner): Pass reference to
+ didAssociateFormControl.
+ (WebCore::FormAssociatedElement::formAttributeChanged): Ditto.
+
+ * html/HTMLAreaElement.cpp:
+ (WebCore::HTMLAreaElement::parseAttribute): Removed special case for accesskey
+ attribute, because we want to call the base class parseAttribute in that case.
+
+ * html/HTMLFormElement.cpp:
+ (WebCore::HTMLFormElement::insertedIntoAncestor): Pass reference to
+ didAssociateFormControl.
+
+ * html/HTMLSelectElement.cpp:
+ (WebCore::HTMLSelectElement::parseAttribute): Removed special case for accesskey
+ attribute with mysterious FIXME, because we want to call the base class
+ parseAttribute in that case. The old code had no effect before; the access key
+ logic would still find the attribute; if the goal is to ignore the attribute
+ for these elements we will need a different solution.
+ * html/HTMLTextAreaElement.cpp:
+ (WebCore::HTMLTextAreaElement::parseAttribute): Ditto.
+
+ * loader/DocumentLoader.cpp:
+ (WebCore::DocumentLoader::DocumentLoader): Removed code that was always passing
+ nullptr as the frame for the newly created DocumentWriter. It used m_frame, but
+ m_frame was always null.
+ (WebCore::DocumentLoader::attachToFrame): Pass reference to DocumentWriter::setFrame.
+
+ * loader/DocumentWriter.cpp:
+ (WebCore::DocumentWriter::DocumentWriter): Deleted. The old version set m_frame to
+ the passed in frame, which was always nullptr, and initialized some booleans and an
+ enumeration, which are now initialized in the class definition.
+ (WebCore::DocumentWriter::createDocument): Pass a reference for the frame.
+ (WebCore::DocumentWriter::begin): Updated now that State is an enum class.
+ (WebCore::DocumentWriter::decoder): Renamed from createDecoderIfNeeded and changed
+ to return a reference.
+ (WebCore::DocumentWriter::addData): Use RELEASE_ASSERT instead of if/CRASH and
+ updated now that State is an enum class.
+ (WebCore::DocumentWriter::insertDataSynchronously): Updated now that State is an
+ enum class.
+ (WebCore::DocumentWriter::end): Ditto.
+
+ * loader/DocumentWriter.h: Removed unneeded include and forward declaration.
+ Removed the frame pointer argument to the constructor, caller was always passing a
+ nullptr. Changed argument to setFrame to be a reference. Renamed createDecoderIfNeeded
+ to decoder and changed it to return a reference. Initialized m_frame,
+ m_hasReceivedSomeData, m_encodingWasChosenByUser, and m_state here so we don't need
+ to initialize them in a constructor. Renamed the enum from WriterState to State since
+ it's a member of DocumentWriter already, and made it an enum class rather than ending
+ each enumeration value with WritingState.
+
+ * page/DragController.cpp:
+ (WebCore::isEnabledColorInput): Removed boolean argument setToShadowAncestor. The
+ one caller that formerly passed true now calls the new hasEnabledColorInputAsShadowHost
+ function instead.
+ (WebCore::hasEnabledColorInputAsShadowHost): Added.
+ (WebCore::elementUnderMouse): Use shadowHost instead of deprecatedShadowAncestorNode.
+ Also added FIXME since it seems this should instead be using parentElementInComposedTree.
+ (WebCore::DragController::concludeEditDrag): Removed "false" argument to isEnabledColorInput.
+ (WebCore::DragController::canProcessDrag): Removed "true" argument to isEnabledColorInput
+ and added call to hasEnabledColorInputAsShadowHost. Also put the value of the node to drag
+ into a local variable to simplify code.
+ (WebCore::DragController::draggableElement const): Removed "false" argument to isEnabledColorInput.
+
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::handleAccessKey): Update name of elementForAccessKey.
+
+ * page/FocusController.cpp:
+ (WebCore::clearSelectionIfNeeded): Use shadowHost instead of deprecatedShadowAncestorNode.
+
+ * workers/service/context/ServiceWorkerThreadProxy.cpp:
+ (WebCore::createPageForServiceWorker): Pass reference instead of pointer for frame to
+ Document::createNonRenderedPlaceholder.
+
2019-02-21 Sihui Liu <sihui_...@apple.com>
IndexedDB: leak UniqueIDBDatabase in layout tests
Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/AccessibilityObject.cpp (242437 => 242438)
--- releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/AccessibilityObject.cpp 2019-03-05 11:59:27 UTC (rev 242437)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/AccessibilityObject.cpp 2019-03-05 12:40:23 UTC (rev 242438)
@@ -975,16 +975,16 @@
HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::AccessibilityHitTest);
HitTestResult hitTestResult(clickPoint());
document->renderView()->hitTest(request, hitTestResult);
- if (hitTestResult.innerNode()) {
- Node* innerNode = hitTestResult.innerNode()->deprecatedShadowAncestorNode();
- if (is<Element>(*innerNode))
- hitTestElement = downcast<Element>(innerNode);
- else if (innerNode)
+ if (auto* innerNode = hitTestResult.innerNode()) {
+ if (auto* shadowHost = innerNode->shadowHost())
+ hitTestElement = shadowHost;
+ else if (is<Element>(*innerNode))
+ hitTestElement = &downcast<Element>(*innerNode);
+ else
hitTestElement = innerNode->parentElement();
}
}
-
-
+
// Prefer the actionElement instead of this node, if the actionElement is inside this node.
Element* pressElement = this->element();
if (!pressElement || actionElem->isDescendantOf(*pressElement))
@@ -2666,23 +2666,14 @@
AXObjectCache* AccessibilityObject::axObjectCache() const
{
- Document* doc = document();
- if (doc)
- return doc->axObjectCache();
- return nullptr;
+ auto* document = this->document();
+ return document ? document->axObjectCache() : nullptr;
}
AccessibilityObject* AccessibilityObject::focusedUIElement() const
{
- Document* doc = document();
- if (!doc)
- return nullptr;
-
- Page* page = doc->page();
- if (!page)
- return nullptr;
-
- return AXObjectCache::focusedUIElementForPage(page);
+ auto* page = this->page();
+ return page ? AXObjectCache::focusedUIElementForPage(page) : nullptr;
}
AccessibilitySortDirection AccessibilityObject::sortDirection() const
Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (242437 => 242438)
--- releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2019-03-05 11:59:27 UTC (rev 242437)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2019-03-05 12:40:23 UTC (rev 242438)
@@ -1511,7 +1511,7 @@
Node* node = m_renderer->node();
if (!is<Element>(node))
return nullAtom();
- return downcast<Element>(*node).getAttribute(accesskeyAttr);
+ return downcast<Element>(*node).attributeWithoutSynchronization(accesskeyAttr);
}
VisibleSelection AccessibilityRenderObject::selection() const
Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/dom/ContainerNode.cpp (242437 => 242438)
--- releases/WebKitGTK/webkit-2.24/Source/WebCore/dom/ContainerNode.cpp 2019-03-05 11:59:27 UTC (rev 242437)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/dom/ContainerNode.cpp 2019-03-05 12:40:23 UTC (rev 242438)
@@ -741,11 +741,38 @@
});
}
+static bool affectsElements(const ContainerNode::ChildChange& change)
+{
+ switch (change.type) {
+ case ContainerNode::ElementInserted:
+ case ContainerNode::ElementRemoved:
+ case ContainerNode::AllChildrenRemoved:
+ case ContainerNode::AllChildrenReplaced:
+ return true;
+ case ContainerNode::TextInserted:
+ case ContainerNode::TextRemoved:
+ case ContainerNode::TextChanged:
+ case ContainerNode::NonContentsChildInserted:
+ case ContainerNode::NonContentsChildRemoved:
+ return false;
+ }
+ ASSERT_NOT_REACHED();
+ return false;
+}
+
void ContainerNode::childrenChanged(const ChildChange& change)
{
document().incDOMTreeVersion();
+
+ if (affectsElements(change))
+ document().invalidateAccessKeyCache();
+
+ // FIXME: Unclear why it's always safe to skip this when parser is adding children.
+ // FIXME: Seems like it's equally safe to skip for TextInserted and TextRemoved as for TextChanged.
+ // FIXME: Should use switch for change type so we remember to update when adding new types.
if (change.source == ChildChangeSource::API && change.type != TextChanged)
document().updateRangesAfterChildrenChanged(*this);
+
invalidateNodeListAndCollectionCachesInAncestors();
}
Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/dom/DecodedDataDocumentParser.cpp (242437 => 242438)
--- releases/WebKitGTK/webkit-2.24/Source/WebCore/dom/DecodedDataDocumentParser.cpp 2019-03-05 11:59:27 UTC (rev 242437)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/dom/DecodedDataDocumentParser.cpp 2019-03-05 12:40:23 UTC (rev 242438)
@@ -42,7 +42,7 @@
if (!length)
return;
- String decoded = writer.createDecoderIfNeeded()->decode(data, length);
+ String decoded = writer.decoder().decode(data, length);
if (decoded.isEmpty())
return;
@@ -52,7 +52,7 @@
void DecodedDataDocumentParser::flush(DocumentWriter& writer)
{
- String remainingData = writer.createDecoderIfNeeded()->flush();
+ String remainingData = writer.decoder().flush();
if (remainingData.isEmpty())
return;
Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/dom/Document.cpp (242437 => 242438)
--- releases/WebKitGTK/webkit-2.24/Source/WebCore/dom/Document.cpp 2019-03-05 11:59:27 UTC (rev 242437)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/dom/Document.cpp 2019-03-05 12:40:23 UTC (rev 242438)
@@ -45,6 +45,7 @@
#include "ChromeClient.h"
#include "Comment.h"
#include "CommonVM.h"
+#include "ComposedTreeIterator.h"
#include "CompositionEvent.h"
#include "ConstantPropertyMap.h"
#include "ContentSecurityPolicy.h"
@@ -731,36 +732,35 @@
clearScriptedAnimationController();
}
-Element* Document::getElementByAccessKey(const String& key)
+Element* Document::elementForAccessKey(const String& key)
{
if (key.isEmpty())
return nullptr;
- // FIXME: Would be nice to use WTF::Optional on the map instead of using a
- // separate boolean.
- if (!m_accessKeyMapValid) {
- buildAccessKeyMap(*this);
- m_accessKeyMapValid = true;
- }
- return m_elementsByAccessKey.get(key.impl());
+ if (!m_accessKeyCache)
+ buildAccessKeyCache();
+ return m_accessKeyCache->get(key);
}
-void Document::buildAccessKeyMap(TreeScope& scope)
+void Document::buildAccessKeyCache()
{
- // FIXME: Consider using composedTreeDescendants instead, obviating the need for
- // recursion and the "scope" argument. Might be nice to have an Element-only version.
- for (auto& element : descendantsOfType<Element>(scope.rootNode())) {
- auto& accessKey = element.attributeWithoutSynchronization(accesskeyAttr);
- if (!accessKey.isEmpty())
- m_elementsByAccessKey.set(accessKey.impl(), &element);
- if (auto* root = element.shadowRoot())
- buildAccessKeyMap(*root);
- }
+ m_accessKeyCache = std::make_unique<HashMap<String, Element*, ASCIICaseInsensitiveHash>>([this] {
+ HashMap<String, Element*, ASCIICaseInsensitiveHash> map;
+ for (auto& node : composedTreeDescendants(*this)) {
+ if (!is<Element>(node))
+ continue;
+ auto& element = downcast<Element>(node);
+ auto& key = element.attributeWithoutSynchronization(accesskeyAttr);
+ if (key.isEmpty())
+ continue;
+ map.add(key, &element);
+ }
+ return map;
+ }());
}
-void Document::invalidateAccessKeyMap()
+void Document::invalidateAccessKeyCacheSlowCase()
{
- m_accessKeyMapValid = false;
- m_elementsByAccessKey.clear();
+ m_accessKeyCache = nullptr;
}
ExceptionOr<SelectorQuery&> Document::selectorQueryForString(const String& selectorString)
@@ -845,8 +845,8 @@
DocumentType* Document::doctype() const
{
for (Node* node = firstChild(); node; node = node->nextSibling()) {
- if (node->isDocumentTypeNode())
- return static_cast<DocumentType*>(node);
+ if (is<DocumentType>(node))
+ return downcast<DocumentType>(node);
}
return nullptr;
}
@@ -1818,9 +1818,6 @@
}
#endif
- // FIXME: Why on earth is this here? This is clearly misplaced.
- invalidateAccessKeyMap();
-
auto shouldThrottleStyleRecalc = [&] {
if (!view() || !view()->isVisuallyNonEmpty())
return false;
@@ -3743,7 +3740,7 @@
// FIXME: Find a better place for this function.
processFeaturesString(features, FeatureMode::Viewport, [this](StringView key, StringView value) {
if (equalLettersIgnoringASCIICase(key, "telephone") && equalLettersIgnoringASCIICase(value, "no"))
- setIsTelephoneNumberParsingAllowed(false);
+ m_isTelephoneNumberParsingAllowed = false;
});
}
@@ -3907,7 +3904,7 @@
return XMLDocument::createXHTML(nullptr, url());
return XMLDocument::create(nullptr, url());
}
- return create(nullptr, url());
+ return create(url());
}
void Document::cloneDataFromDocument(const Document& other)
@@ -4847,11 +4844,6 @@
addListenerType(RESIZE_LISTENER);
}
-CSSStyleDeclaration* Document::getOverrideStyle(Element*, const String&)
-{
- return nullptr;
-}
-
HTMLFrameOwnerElement* Document::ownerElement() const
{
if (!frame())
@@ -5832,11 +5824,6 @@
return settings().telephoneNumberParsingEnabled() && m_isTelephoneNumberParsingAllowed;
}
-void Document::setIsTelephoneNumberParsingAllowed(bool isTelephoneNumberParsingAllowed)
-{
- m_isTelephoneNumberParsingAllowed = isTelephoneNumberParsingAllowed;
-}
-
bool Document::isTelephoneNumberParsingAllowed() const
{
return m_isTelephoneNumberParsingAllowed;
@@ -7464,7 +7451,7 @@
if (isHTMLDocument())
m_templateDocument = HTMLDocument::create(nullptr, WTF::blankURL());
else
- m_templateDocument = Document::create(nullptr, WTF::blankURL());
+ m_templateDocument = create(WTF::blankURL());
m_templateDocument->setContextDocument(contextDocument());
m_templateDocument->setTemplateDocumentHost(this); // balanced in dtor.
@@ -7542,11 +7529,12 @@
return options;
}
-void Document::didAssociateFormControl(Element* element)
+void Document::didAssociateFormControl(Element& element)
{
- if (!frame() || !frame()->page() || !frame()->page()->chrome().client().shouldNotifyOnFormChanges())
+ auto* page = this->page();
+ if (!page || !page->chrome().client().shouldNotifyOnFormChanges())
return;
- m_associatedFormControls.add(element);
+ m_associatedFormControls.add(&element);
if (!m_didAssociateFormControlsTimer.isActive())
m_didAssociateFormControlsTimer.startOneShot(0_s);
}
@@ -7553,11 +7541,10 @@
void Document::didAssociateFormControlsTimerFired()
{
- if (!frame() || !frame()->page())
- return;
-
- frame()->page()->chrome().client().didAssociateFormControls(copyToVector(m_associatedFormControls));
+ auto vector = copyToVector(m_associatedFormControls);
m_associatedFormControls.clear();
+ if (auto* page = this->page())
+ page->chrome().client().didAssociateFormControls(vector);
}
void Document::setCachedDOMCookies(const String& cookies)
Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/dom/Document.h (242437 => 242438)
--- releases/WebKitGTK/webkit-2.24/Source/WebCore/dom/Document.h 2019-03-05 11:59:27 UTC (rev 242437)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/dom/Document.h 2019-03-05 12:40:23 UTC (rev 242438)
@@ -252,13 +252,10 @@
const uint64_t HTMLMediaElementInvalidID = 0;
-enum PageshowEventPersistence {
- PageshowEventNotPersisted = 0,
- PageshowEventPersisted = 1
-};
+enum PageshowEventPersistence { PageshowEventNotPersisted, PageshowEventPersisted };
enum NodeListInvalidationType {
- DoNotInvalidateOnAttributeChanges = 0,
+ DoNotInvalidateOnAttributeChanges,
InvalidateOnClassAttrChange,
InvalidateOnIdNameAttrChange,
InvalidateOnNameAttrChange,
@@ -283,7 +280,6 @@
TextDocumentClass = 1 << 6,
XMLDocumentClass = 1 << 7,
};
-
typedef unsigned char DocumentClassFlags;
enum class DocumentCompatibilityMode : unsigned char {
@@ -294,10 +290,7 @@
enum DimensionsCheck { WidthDimensionsCheck = 1 << 0, HeightDimensionsCheck = 1 << 1, AllDimensionsCheck = 1 << 2 };
-enum class SelectionRestorationMode {
- Restore,
- SetDefault,
-};
+enum class SelectionRestorationMode { Restore, SetDefault };
enum class HttpEquivPolicy {
Enabled,
@@ -352,15 +345,8 @@
, public Logger::Observer {
WTF_MAKE_ISO_ALLOCATED(Document);
public:
- static Ref<Document> create(Frame* frame, const URL& url)
- {
- return adoptRef(*new Document(frame, url));
- }
-
- static Ref<Document> createNonRenderedPlaceholder(Frame* frame, const URL& url)
- {
- return adoptRef(*new Document(frame, url, DefaultDocumentClass, NonRenderedPlaceholder));
- }
+ static Ref<Document> create(const URL&);
+ static Ref<Document> createNonRenderedPlaceholder(Frame&, const URL&);
static Ref<Document> create(Document&);
virtual ~Document();
@@ -406,14 +392,12 @@
bool canContainRangeEndPoint() const final { return true; }
- Element* getElementByAccessKey(const String& key);
- void invalidateAccessKeyMap();
+ Element* elementForAccessKey(const String& key);
+ void invalidateAccessKeyCache();
ExceptionOr<SelectorQuery&> selectorQueryForString(const String&);
void clearSelectorQueryCache();
- // DOM methods & attributes for Document
-
void setViewportArguments(const ViewportArguments& viewportArguments) { m_viewportArguments = viewportArguments; }
ViewportArguments viewportArguments() const { return m_viewportArguments; }
@@ -431,10 +415,7 @@
WEBCORE_EXPORT DOMImplementation& implementation();
- Element* documentElement() const
- {
- return m_documentElement.get();
- }
+ Element* documentElement() const { return m_documentElement.get(); }
static ptrdiff_t documentElementMemoryOffset() { return OBJECT_OFFSETOF(Document, m_documentElement); }
WEBCORE_EXPORT Element* activeElement();
@@ -462,11 +443,7 @@
WEBCORE_EXPORT Element* scrollingElementForAPI();
Element* scrollingElement();
- enum ReadyState {
- Loading,
- Interactive,
- Complete
- };
+ enum ReadyState { Loading, Interactive, Complete };
ReadyState readyState() const { return m_readyState; }
WEBCORE_EXPORT String defaultCharsetForLegacyBindings() const;
@@ -570,8 +547,8 @@
Vector<String> formElementsState() const;
void setStateForNewFormElements(const Vector<String>&);
- WEBCORE_EXPORT FrameView* view() const; // can be NULL
- WEBCORE_EXPORT Page* page() const; // can be NULL
+ WEBCORE_EXPORT FrameView* view() const; // Can be null.
+ WEBCORE_EXPORT Page* page() const; // Can be null.
const Settings& settings() const { return m_settings.get(); }
Settings& mutableSettings() { return m_settings.get(); }
@@ -606,10 +583,7 @@
// updateLayoutIgnorePendingStylesheets() forces layout even if we are waiting for pending stylesheet loads,
// so calling this may cause a flash of unstyled content (FOUC).
- enum class RunPostLayoutTasks {
- Asynchronously,
- Synchronously,
- };
+ enum class RunPostLayoutTasks { Asynchronously, Synchronously };
WEBCORE_EXPORT void updateLayoutIgnorePendingStylesheets(RunPostLayoutTasks = RunPostLayoutTasks::Asynchronously);
std::unique_ptr<RenderStyle> styleForElementIgnoringPendingStylesheets(Element&, const RenderStyle* parentStyle, PseudoId = PseudoId::None);
@@ -883,7 +857,7 @@
bool hasMutationObservers() const { return m_mutationObserverTypes; }
void addMutationObserverTypes(MutationObserverOptions types) { m_mutationObserverTypes |= types; }
- WEBCORE_EXPORT CSSStyleDeclaration* getOverrideStyle(Element*, const String& pseudoElt);
+ CSSStyleDeclaration* getOverrideStyle(Element*, const String&) { return nullptr; }
// Handles an HTTP header equivalent set by a meta tag using <meta http-equiv="..." content="...">. This is called
// when a meta tag is encountered during document parsing, and also when a script dynamically changes or adds a meta
@@ -1352,7 +1326,7 @@
void setTemplateDocumentHost(Document* templateDocumentHost) { m_templateDocumentHost = templateDocumentHost; }
Document* templateDocumentHost() { return m_templateDocumentHost; }
- void didAssociateFormControl(Element*);
+ void didAssociateFormControl(Element&);
bool hasDisabledFieldsetElement() const { return m_disabledFieldsetElementsCount; }
void addDisabledFieldsetElement() { m_disabledFieldsetElementsCount++; }
void removeDisabledFieldsetElement() { ASSERT(m_disabledFieldsetElementsCount); m_disabledFieldsetElementsCount--; }
@@ -1600,7 +1574,8 @@
void updateTitle(const StringWithDirection&);
void updateBaseURL();
- void buildAccessKeyMap(TreeScope&);
+ void invalidateAccessKeyCacheSlowCase();
+ void buildAccessKeyCache();
void moveNodeIteratorsToNewDocumentSlowCase(Node&, Document&);
@@ -1623,11 +1598,6 @@
void dispatchDisabledAdaptationsDidChangeForMainFrame();
-#if ENABLE(TELEPHONE_NUMBER_DETECTION)
- friend void setParserFeature(const String& key, const String& value, Document*, void* userData);
- void setIsTelephoneNumberParsingAllowed(bool);
-#endif
-
void setVisualUpdatesAllowed(ReadyState);
void setVisualUpdatesAllowed(bool);
void visualUpdatesSuppressionTimerFired();
@@ -1827,7 +1797,7 @@
HashSet<HTMLMediaElement*> m_allowsMediaDocumentInlinePlaybackElements;
#endif
- HashMap<StringImpl*, Element*, ASCIICaseInsensitiveHash> m_elementsByAccessKey;
+ std::unique_ptr<HashMap<String, Element*, ASCIICaseInsensitiveHash>> m_accessKeyCache;
std::unique_ptr<ConstantPropertyMap> m_constantPropertyMap;
@@ -2029,7 +1999,6 @@
bool m_isDNSPrefetchEnabled { false };
bool m_haveExplicitlyDisabledDNSPrefetch { false };
- bool m_accessKeyMapValid { false };
bool m_isSynthesized { false };
bool m_isNonRenderedPlaceholder { false };
@@ -2128,6 +2097,22 @@
return existingAXObjectCacheSlow();
}
+inline Ref<Document> Document::create(const URL& url)
+{
+ return adoptRef(*new Document(nullptr, url));
+}
+
+inline Ref<Document> Document::createNonRenderedPlaceholder(Frame& frame, const URL& url)
+{
+ return adoptRef(*new Document(&frame, url, DefaultDocumentClass, NonRenderedPlaceholder));
+}
+
+inline void Document::invalidateAccessKeyCache()
+{
+ if (UNLIKELY(m_accessKeyCache))
+ invalidateAccessKeyCacheSlowCase();
+}
+
// These functions are here because they require the Document class definition and we want to inline them.
inline ScriptExecutionContext* Node::scriptExecutionContext() const
Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/dom/Document.idl (242437 => 242438)
--- releases/WebKitGTK/webkit-2.24/Source/WebCore/dom/Document.idl 2019-03-05 11:59:27 UTC (rev 242437)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/dom/Document.idl 2019-03-05 12:40:23 UTC (rev 242438)
@@ -175,7 +175,8 @@
attribute boolean xmlStandalone;
// FIXME: Blink has already dropped this (https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/s3ezjTuC8ig).
- CSSStyleDeclaration getOverrideStyle(optional Element? element = null, optional DOMString pseudoElement = "undefined");
+ // And it's just a stub that always returns null, so we can probably remove it some time soon.
+ CSSStyleDeclaration? getOverrideStyle(optional Element? element = null, optional DOMString pseudoElement = "undefined");
// FIXME: Should be moved to GlobalEventHandlers (http://w3c.github.io/selection-api/#extensions-to-globaleventhandlers).
[NotEnumerable] attribute EventHandler onselectstart; // FIXME: Should be enumerable.
Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/dom/Element.cpp (242437 => 242438)
--- releases/WebKitGTK/webkit-2.24/Source/WebCore/dom/Element.cpp 2019-03-05 11:59:27 UTC (rev 242437)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/dom/Element.cpp 2019-03-05 12:40:23 UTC (rev 242438)
@@ -1555,7 +1555,11 @@
bool valueIsSameAsBefore = oldValue == newValue;
if (!valueIsSameAsBefore) {
- if (name == HTMLNames::idAttr) {
+ if (name == HTMLNames::accesskeyAttr)
+ document().invalidateAccessKeyCache();
+ else if (name == HTMLNames::classAttr)
+ classAttributeChanged(newValue);
+ else if (name == HTMLNames::idAttr) {
AtomicString oldId = elementData()->idForStyleResolution();
AtomicString newId = makeIdForStyleResolution(newValue, document().inQuirksMode());
if (newId != oldId) {
@@ -1567,15 +1571,12 @@
treeScope().idTargetObserverRegistry().notifyObservers(*oldValue.impl());
if (!newValue.isEmpty())
treeScope().idTargetObserverRegistry().notifyObservers(*newValue.impl());
- } else if (name == classAttr)
- classAttributeChanged(newValue);
- else if (name == HTMLNames::nameAttr)
+ } else if (name == HTMLNames::nameAttr)
elementData()->setHasNameAttribute(!newValue.isNull());
else if (name == HTMLNames::pseudoAttr) {
if (needsStyleInvalidation() && isInShadowTree())
invalidateStyleForSubtree();
- }
- else if (name == HTMLNames::slotAttr) {
+ } else if (name == HTMLNames::slotAttr) {
if (auto* parent = parentElement()) {
if (auto* shadowRoot = parent->shadowRoot())
shadowRoot->hostChildElementDidChangeSlotAttribute(*this, oldValue, newValue);
Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/dom/Node.cpp (242437 => 242438)
--- releases/WebKitGTK/webkit-2.24/Source/WebCore/dom/Node.cpp 2019-03-05 11:59:27 UTC (rev 242437)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/dom/Node.cpp 2019-03-05 12:40:23 UTC (rev 242438)
@@ -1008,21 +1008,15 @@
bool Node::isDescendantOrShadowDescendantOf(const Node* other) const
{
- if (!other)
- return false;
- if (isDescendantOf(*other))
- return true;
- const Node* shadowAncestorNode = deprecatedShadowAncestorNode();
- if (!shadowAncestorNode)
- return false;
- return shadowAncestorNode == other || shadowAncestorNode->isDescendantOf(*other);
+ // FIXME: This element's shadow tree's host could be inside another shadow tree.
+ // This function doesn't handle that case correctly. Maybe share code with
+ // the containsIncludingShadowDOM function?
+ return other && (isDescendantOf(*other) || other->contains(shadowHost()));
}
bool Node::contains(const Node* node) const
{
- if (!node)
- return false;
- return this == node || node->isDescendantOf(*this);
+ return this == node || (node && node->isDescendantOf(*this));
}
bool Node::containsIncludingShadowDOM(const Node* node) const
@@ -1039,7 +1033,7 @@
while (node) {
if (node == this)
return true;
- if (node->isDocumentFragment() && static_cast<const DocumentFragment*>(node)->isTemplateContent())
+ if (is<DocumentFragment>(*node) && downcast<DocumentFragment>(*node).isTemplateContent())
node = static_cast<const TemplateContentDocumentFragment*>(node)->host();
else
node = node->parentOrShadowHostNode();
@@ -1139,14 +1133,6 @@
return nullptr;
}
-Node* Node::deprecatedShadowAncestorNode() const
-{
- if (ShadowRoot* root = containingShadowRoot())
- return root->host();
-
- return const_cast<Node*>(this);
-}
-
ShadowRoot* Node::containingShadowRoot() const
{
ContainerNode& root = treeScope().rootNode();
Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/dom/Node.h (242437 => 242438)
--- releases/WebKitGTK/webkit-2.24/Source/WebCore/dom/Node.h 2019-03-05 11:59:27 UTC (rev 242437)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/dom/Node.h 2019-03-05 12:40:23 UTC (rev 242438)
@@ -234,9 +234,6 @@
// If this node is in a shadow tree, returns its shadow host. Otherwise, returns null.
WEBCORE_EXPORT Element* shadowHost() const;
- // If this node is in a shadow tree, returns its shadow host. Otherwise, returns this.
- // Deprecated. Should use shadowHost() and check the return value.
- WEBCORE_EXPORT Node* deprecatedShadowAncestorNode() const;
ShadowRoot* containingShadowRoot() const;
ShadowRoot* shadowRoot() const;
bool isClosedShadowHidden(const Node&) const;
Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/editing/ReplaceSelectionCommand.cpp (242437 => 242438)
--- releases/WebKitGTK/webkit-2.24/Source/WebCore/editing/ReplaceSelectionCommand.cpp 2019-03-05 11:59:27 UTC (rev 242437)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/editing/ReplaceSelectionCommand.cpp 2019-03-05 12:40:23 UTC (rev 242438)
@@ -167,10 +167,9 @@
if (!editableRoot)
return;
- Node* shadowAncestorNode = editableRoot->deprecatedShadowAncestorNode();
-
+ auto* shadowHost = editableRoot->shadowHost();
if (!editableRoot->attributeEventListener(eventNames().webkitBeforeTextInsertedEvent, mainThreadNormalWorld())
- && !(shadowAncestorNode && shadowAncestorNode->renderer() && shadowAncestorNode->renderer()->isTextControl())
+ && !(shadowHost && shadowHost->renderer() && shadowHost->renderer()->isTextControl())
&& editableRoot->hasRichlyEditableStyle()) {
removeInterchangeNodes(m_fragment.get());
return;
Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/html/FormAssociatedElement.cpp (242437 => 242438)
--- releases/WebKitGTK/webkit-2.24/Source/WebCore/html/FormAssociatedElement.cpp 2019-03-05 11:59:27 UTC (rev 242437)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/html/FormAssociatedElement.cpp 2019-03-05 12:40:23 UTC (rev 242438)
@@ -176,7 +176,7 @@
setForm(findAssociatedForm(&asHTMLElement(), m_form));
HTMLElement& element = asHTMLElement();
if (m_form && m_form != originalForm && m_form->isConnected())
- element.document().didAssociateFormControl(&element);
+ element.document().didAssociateFormControl(element);
}
void FormAssociatedElement::formAttributeChanged()
@@ -187,7 +187,7 @@
RefPtr<HTMLFormElement> originalForm = m_form;
setForm(HTMLFormElement::findClosestFormAncestor(element));
if (m_form && m_form != originalForm && m_form->isConnected())
- element.document().didAssociateFormControl(&element);
+ element.document().didAssociateFormControl(element);
m_formAttributeTargetObserver = nullptr;
} else {
resetFormOwner();
Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/html/HTMLAreaElement.cpp (242437 => 242438)
--- releases/WebKitGTK/webkit-2.24/Source/WebCore/html/HTMLAreaElement.cpp 2019-03-05 11:59:27 UTC (rev 242437)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/html/HTMLAreaElement.cpp 2019-03-05 12:40:23 UTC (rev 242438)
@@ -69,7 +69,7 @@
} else if (name == coordsAttr) {
m_coords = parseHTMLListOfOfFloatingPointNumberValues(value.string());
invalidateCachedRegion();
- } else if (name == altAttr || name == accesskeyAttr) {
+ } else if (name == altAttr) {
// Do nothing.
} else
HTMLAnchorElement::parseAttribute(name, value);
Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/html/HTMLFormElement.cpp (242437 => 242438)
--- releases/WebKitGTK/webkit-2.24/Source/WebCore/html/HTMLFormElement.cpp 2019-03-05 11:59:27 UTC (rev 242437)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/html/HTMLFormElement.cpp 2019-03-05 12:40:23 UTC (rev 242438)
@@ -129,7 +129,7 @@
{
HTMLElement::insertedIntoAncestor(insertionType, parentOfInsertedTree);
if (insertionType.connectedToDocument)
- document().didAssociateFormControl(this);
+ document().didAssociateFormControl(*this);
return InsertedIntoAncestorResult::Done;
}
Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/html/HTMLSelectElement.cpp (242437 => 242438)
--- releases/WebKitGTK/webkit-2.24/Source/WebCore/html/HTMLSelectElement.cpp 2019-03-05 11:59:27 UTC (rev 242437)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/html/HTMLSelectElement.cpp 2019-03-05 12:40:23 UTC (rev 242438)
@@ -307,10 +307,7 @@
}
} else if (name == multipleAttr)
parseMultipleAttribute(value);
- else if (name == accesskeyAttr) {
- // FIXME: ignore for the moment.
- //
- } else
+ else
HTMLFormControlElementWithState::parseAttribute(name, value);
}
Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/html/HTMLTextAreaElement.cpp (242437 => 242438)
--- releases/WebKitGTK/webkit-2.24/Source/WebCore/html/HTMLTextAreaElement.cpp 2019-03-05 11:59:27 UTC (rev 242437)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/html/HTMLTextAreaElement.cpp 2019-03-05 12:40:23 UTC (rev 242438)
@@ -193,8 +193,6 @@
if (renderer())
renderer()->setNeedsLayoutAndPrefWidthsRecalc();
}
- } else if (name == accesskeyAttr) {
- // ignore for the moment
} else if (name == maxlengthAttr)
maxLengthAttributeChanged(value);
else if (name == minlengthAttr)
Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/loader/DocumentLoader.cpp (242437 => 242438)
--- releases/WebKitGTK/webkit-2.24/Source/WebCore/loader/DocumentLoader.cpp 2019-03-05 11:59:27 UTC (rev 242437)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/loader/DocumentLoader.cpp 2019-03-05 12:40:23 UTC (rev 242438)
@@ -146,7 +146,6 @@
DocumentLoader::DocumentLoader(const ResourceRequest& request, const SubstituteData& substituteData)
: FrameDestructionObserver(nullptr)
, m_cachedResourceLoader(CachedResourceLoader::create(this))
- , m_writer(m_frame)
, m_originalRequest(request)
, m_substituteData(substituteData)
, m_originalRequestCopy(request)
@@ -1183,7 +1182,7 @@
ASSERT(!m_frame);
observeFrame(&frame);
- m_writer.setFrame(&frame);
+ m_writer.setFrame(frame);
attachToFrame();
#ifndef NDEBUG
Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/loader/DocumentWriter.cpp (242437 => 242438)
--- releases/WebKitGTK/webkit-2.24/Source/WebCore/loader/DocumentWriter.cpp 2019-03-05 11:59:27 UTC (rev 242437)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/loader/DocumentWriter.cpp 2019-03-05 12:40:23 UTC (rev 242438)
@@ -58,14 +58,6 @@
return parentFrame && parentFrame->document()->securityOrigin().canAccess(frame->document()->securityOrigin());
}
-DocumentWriter::DocumentWriter(Frame* frame)
- : m_frame(frame)
- , m_hasReceivedSomeData(false)
- , m_encodingWasChosenByUser(false)
- , m_state(NotStartedWritingState)
-{
-}
-
// This is only called by ScriptController::executeIfJavaScriptURL
// and always contains the result of evaluating a _javascript_: url.
// This is the <iframe src="" case.
@@ -122,7 +114,7 @@
return SinkDocument::create(m_frame, url);
#endif
if (!m_frame->loader().client().hasHTMLView())
- return Document::createNonRenderedPlaceholder(m_frame, url);
+ return Document::createNonRenderedPlaceholder(*m_frame, url);
return DOMImplementation::createDocument(m_mimeType, m_frame, url);
}
@@ -194,11 +186,11 @@
if (m_frame->view() && m_frame->loader().client().hasHTMLView())
m_frame->view()->setContentsSize(IntSize());
- m_state = StartedWritingState;
+ m_state = State::Started;
return true;
}
-TextResourceDecoder* DocumentWriter::createDecoderIfNeeded()
+TextResourceDecoder& DocumentWriter::decoder()
{
if (!m_decoder) {
m_decoder = TextResourceDecoder::create(m_mimeType,
@@ -225,7 +217,7 @@
}
m_frame->document()->setDecoder(m_decoder.get());
}
- return m_decoder.get();
+ return *m_decoder;
}
void DocumentWriter::reportDataReceived()
@@ -241,14 +233,9 @@
void DocumentWriter::addData(const char* bytes, size_t length)
{
- // Check that we're inside begin()/end().
- // FIXME: Change these to ASSERT once https://bugs.webkit.org/show_bug.cgi?id=80427 has
- // been resolved.
- if (m_state == NotStartedWritingState)
- CRASH();
- if (m_state == FinishedWritingState)
- CRASH();
-
+ // FIXME: Change these to ASSERT once https://bugs.webkit.org/show_bug.cgi?id=80427 has been resolved.
+ RELEASE_ASSERT(m_state != State::NotStarted);
+ RELEASE_ASSERT(m_state != State::Finished);
ASSERT(m_parser);
m_parser->appendBytes(*this, bytes, length);
}
@@ -255,8 +242,8 @@
void DocumentWriter::insertDataSynchronously(const String& markup)
{
- ASSERT(m_state != NotStartedWritingState);
- ASSERT(m_state != FinishedWritingState);
+ ASSERT(m_state != State::NotStarted);
+ ASSERT(m_state != State::Finished);
ASSERT(m_parser);
m_parser->insert(markup);
}
@@ -268,7 +255,7 @@
// The parser is guaranteed to be released after this point. begin() would
// have to be called again before we can start writing more data.
- m_state = FinishedWritingState;
+ m_state = State::Finished;
// http://bugs.webkit.org/show_bug.cgi?id=10854
// The frame's last ref may be removed and it can be deleted by checkCompleted(),
Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/loader/DocumentWriter.h (242437 => 242438)
--- releases/WebKitGTK/webkit-2.24/Source/WebCore/loader/DocumentWriter.h 2019-03-05 11:59:27 UTC (rev 242437)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/loader/DocumentWriter.h 2019-03-05 12:40:23 UTC (rev 242438)
@@ -28,7 +28,6 @@
#pragma once
-#include <wtf/URL.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
@@ -36,13 +35,12 @@
class Document;
class DocumentParser;
class Frame;
-class SecurityOrigin;
class TextResourceDecoder;
class DocumentWriter {
WTF_MAKE_NONCOPYABLE(DocumentWriter);
public:
- explicit DocumentWriter(Frame*);
+ DocumentWriter() = default;
// This is only called by ScriptController::executeIfJavaScriptURL
// and always contains the result of evaluating a _javascript_: url.
@@ -54,7 +52,7 @@
void insertDataSynchronously(const String&); // For an internal use only to prevent the parser from yielding.
WEBCORE_EXPORT void end();
- void setFrame(Frame* frame) { m_frame = frame; }
+ void setFrame(Frame& frame) { m_frame = &frame; }
WEBCORE_EXPORT void setEncoding(const String& encoding, bool userChosen);
@@ -62,7 +60,7 @@
void setMIMEType(const String& type) { m_mimeType = type; }
// Exposed for DocumentParser::appendBytes.
- TextResourceDecoder* createDecoderIfNeeded();
+ TextResourceDecoder& decoder();
void reportDataReceived();
void setDocumentWasLoadedAsPartOfNavigation();
@@ -71,22 +69,18 @@
Ref<Document> createDocument(const URL&);
void clear();
- Frame* m_frame;
+ Frame* m_frame { nullptr };
- bool m_hasReceivedSomeData;
+ bool m_hasReceivedSomeData { false };
String m_mimeType;
- bool m_encodingWasChosenByUser;
+ bool m_encodingWasChosenByUser { false };
String m_encoding;
RefPtr<TextResourceDecoder> m_decoder;
RefPtr<DocumentParser> m_parser;
- enum WriterState {
- NotStartedWritingState,
- StartedWritingState,
- FinishedWritingState,
- };
- WriterState m_state;
+ enum class State { NotStarted, Started, Finished };
+ State m_state { State::NotStarted };
};
} // namespace WebCore
Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/page/DragController.cpp (242437 => 242438)
--- releases/WebKitGTK/webkit-2.24/Source/WebCore/page/DragController.cpp 2019-03-05 11:59:27 UTC (rev 242437)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/page/DragController.cpp 2019-03-05 12:40:23 UTC (rev 242438)
@@ -341,17 +341,21 @@
}
#if ENABLE(INPUT_TYPE_COLOR)
-static bool isEnabledColorInput(Node& node, bool setToShadowAncestor)
+
+static bool isEnabledColorInput(Node& node)
{
- Node* candidate = setToShadowAncestor ? node.deprecatedShadowAncestorNode() : &node;
- if (is<HTMLInputElement>(*candidate)) {
- auto& input = downcast<HTMLInputElement>(*candidate);
- if (input.isColorControl() && !input.isDisabledFormControl())
- return true;
- }
+ if (!is<HTMLInputElement>(node))
+ return false;
+ auto& input = downcast<HTMLInputElement>(node);
+ return input.isColorControl() && !input.isDisabledFormControl();
+}
- return false;
+static bool isInShadowTreeOfEnabledColorInput(Node& node)
+{
+ auto* host = node.shadowHost();
+ return host && isEnabledColorInput(*host);
}
+
#endif
// This can return null if an empty document is loaded.
@@ -364,13 +368,13 @@
HitTestResult result(point);
documentUnderMouse->renderView()->hitTest(HitTestRequest(), result);
- Node* node = result.innerNode();
- while (node && !is<Element>(*node))
- node = node->parentNode();
- if (node)
- node = node->deprecatedShadowAncestorNode();
-
- return downcast<Element>(node);
+ auto* node = result.innerNode();
+ if (!node)
+ return nullptr;
+ // FIXME: Use parentElementInComposedTree here.
+ auto* element = is<Element>(*node) ? &downcast<Element>(*node) : node->parentElement();
+ auto* host = element->shadowHost();
+ return host ? host : element;
}
#if !ENABLE(DATA_INTERACTION)
@@ -551,7 +555,7 @@
if (!color.isValid())
return false;
#if ENABLE(INPUT_TYPE_COLOR)
- if (isEnabledColorInput(*element, false)) {
+ if (isEnabledColorInput(*element)) {
auto& input = downcast<HTMLInputElement>(*element);
input.setValue(color.serialized(), DispatchInputAndChangeEvent);
return true;
@@ -655,14 +659,15 @@
result = m_page.mainFrame().eventHandler().hitTestResultAtPoint(point, HitTestRequest::ReadOnly | HitTestRequest::Active);
- if (!result.innerNonSharedNode())
+ auto* dragNode = result.innerNonSharedNode();
+ if (!dragNode)
return false;
DragData::DraggingPurpose dragPurpose = DragData::DraggingPurpose::ForEditing;
- if (asFileInput(*result.innerNonSharedNode()))
+ if (asFileInput(*dragNode))
dragPurpose = DragData::DraggingPurpose::ForFileUpload;
#if ENABLE(INPUT_TYPE_COLOR)
- else if (isEnabledColorInput(*result.innerNonSharedNode(), true))
+ else if (isEnabledColorInput(*dragNode) || isInShadowTreeOfEnabledColorInput(*dragNode))
dragPurpose = DragData::DraggingPurpose::ForColorControl;
#endif
@@ -677,10 +682,10 @@
return true;
#endif
- if (is<HTMLPlugInElement>(*result.innerNonSharedNode())) {
- if (!downcast<HTMLPlugInElement>(result.innerNonSharedNode())->canProcessDrag() && !result.innerNonSharedNode()->hasEditableStyle())
+ if (is<HTMLPlugInElement>(*dragNode)) {
+ if (!downcast<HTMLPlugInElement>(*dragNode).canProcessDrag() && !dragNode->hasEditableStyle())
return false;
- } else if (!result.innerNonSharedNode()->hasEditableStyle())
+ } else if (!dragNode->hasEditableStyle())
return false;
if (m_didInitiateDrag && m_documentUnderMouse == m_dragInitiator && result.isSelected())
@@ -813,8 +818,7 @@
}
#endif
#if ENABLE(INPUT_TYPE_COLOR)
- if ((m_dragSourceAction & DragSourceActionColor)
- && isEnabledColorInput(*element, false)) {
+ if ((m_dragSourceAction & DragSourceActionColor) && isEnabledColorInput(*element)) {
state.type = static_cast<DragSourceAction>(state.type | DragSourceActionColor);
return element;
}
Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/page/EventHandler.cpp (242437 => 242438)
--- releases/WebKitGTK/webkit-2.24/Source/WebCore/page/EventHandler.cpp 2019-03-05 11:59:27 UTC (rev 242437)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/page/EventHandler.cpp 2019-03-05 12:40:23 UTC (rev 242438)
@@ -3116,7 +3116,7 @@
if ((event.modifiers() - PlatformEvent::Modifier::ShiftKey) != accessKeyModifiers())
return false;
- Element* element = m_frame.document()->getElementByAccessKey(event.unmodifiedText());
+ auto* element = m_frame.document()->elementForAccessKey(event.unmodifiedText());
if (!element)
return false;
element->accessKeyAction(false);
Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/page/FocusController.cpp (242437 => 242438)
--- releases/WebKitGTK/webkit-2.24/Source/WebCore/page/FocusController.cpp 2019-03-05 11:59:27 UTC (rev 242437)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/page/FocusController.cpp 2019-03-05 12:40:23 UTC (rev 242438)
@@ -767,21 +767,23 @@
if (caretBrowsing)
return;
- Node* selectionStartNode = selection.start().deprecatedNode();
- if (selectionStartNode == newFocusedNode || selectionStartNode->isDescendantOf(newFocusedNode) || selectionStartNode->deprecatedShadowAncestorNode() == newFocusedNode)
- return;
-
+ if (newFocusedNode) {
+ Node* selectionStartNode = selection.start().deprecatedNode();
+ if (newFocusedNode->contains(selectionStartNode) || selectionStartNode->shadowHost() == newFocusedNode)
+ return;
+ }
+
if (Node* mousePressNode = newFocusedFrame->eventHandler().mousePressNode()) {
if (mousePressNode->renderer() && !mousePressNode->canStartSelection()) {
// Don't clear the selection for contentEditable elements, but do clear it for input and textarea. See bug 38696.
- Node * root = selection.rootEditableElement();
+ auto* root = selection.rootEditableElement();
if (!root)
return;
-
- if (Node* shadowAncestorNode = root->deprecatedShadowAncestorNode()) {
- if (!is<HTMLInputElement>(*shadowAncestorNode) && !is<HTMLTextAreaElement>(*shadowAncestorNode))
- return;
- }
+ auto* host = root->shadowHost();
+ // FIXME: Seems likely we can just do the check on "host" here instead of "rootOrHost".
+ auto* rootOrHost = host ? host : root;
+ if (!is<HTMLInputElement>(*rootOrHost) && !is<HTMLTextAreaElement>(*rootOrHost))
+ return;
}
}
Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp (242437 => 242438)
--- releases/WebKitGTK/webkit-2.24/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp 2019-03-05 11:59:27 UTC (rev 242437)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp 2019-03-05 12:40:23 UTC (rev 242438)
@@ -57,7 +57,7 @@
auto& mainFrame = page->mainFrame();
mainFrame.loader().initForSynthesizedDocument({ });
- auto document = Document::createNonRenderedPlaceholder(&mainFrame, data.scriptURL);
+ auto document = Document::createNonRenderedPlaceholder(mainFrame, data.scriptURL);
document->createDOMWindow();
document->mutableSettings().setStorageBlockingPolicy(storageBlockingPolicy);
Modified: releases/WebKitGTK/webkit-2.24/Source/WebInspectorUI/ChangeLog (242437 => 242438)
--- releases/WebKitGTK/webkit-2.24/Source/WebInspectorUI/ChangeLog 2019-03-05 11:59:27 UTC (rev 242437)
+++ releases/WebKitGTK/webkit-2.24/Source/WebInspectorUI/ChangeLog 2019-03-05 12:40:23 UTC (rev 242438)
@@ -1,3 +1,14 @@
+2019-02-21 Darin Adler <da...@apple.com>
+
+ Some refinements for Node and Document
+ https://bugs.webkit.org/show_bug.cgi?id=194764
+
+ Reviewed by Ryosuke Niwa.
+
+ * UserInterface/Models/NativeFunctionParameters.js: Removed getOverrideStyle
+ because this deprecated non-working function is no longer something web authors
+ should be thinking about or typing.
+
2019-02-21 Devin Rousso <drou...@apple.com>
Web Inspector: DOM Debugger: node-specific event breakpoints aren't cleared/recalculated on navigation
Modified: releases/WebKitGTK/webkit-2.24/Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js (242437 => 242438)
--- releases/WebKitGTK/webkit-2.24/Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js 2019-03-05 11:59:27 UTC (rev 242437)
+++ releases/WebKitGTK/webkit-2.24/Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js 2019-03-05 12:40:23 UTC (rev 242438)
@@ -485,7 +485,6 @@
getCSSCanvasContext: "contextId, name, width, height",
getElementById: "id",
getElementsByName: "name",
- getOverrideStyle: "[element], [pseudoElement]",
importNode: "node, deep",
queryCommandEnabled: "command",
queryCommandIndeterm: "command",
Modified: releases/WebKitGTK/webkit-2.24/Source/WebKit/ChangeLog (242437 => 242438)
--- releases/WebKitGTK/webkit-2.24/Source/WebKit/ChangeLog 2019-03-05 11:59:27 UTC (rev 242437)
+++ releases/WebKitGTK/webkit-2.24/Source/WebKit/ChangeLog 2019-03-05 12:40:23 UTC (rev 242438)
@@ -1,3 +1,20 @@
+2019-02-21 Darin Adler <da...@apple.com>
+
+ Some refinements for Node and Document
+ https://bugs.webkit.org/show_bug.cgi?id=194764
+
+ Reviewed by Ryosuke Niwa.
+
+ * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentGtk.cpp:
+ (webkit_dom_document_get_override_style): Changed to return nullptr directly instead of
+ calling a bunch of WebCore code first. No real value in checking arguments or doing any work.
+
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebKit::WebFrameLoaderClient::shouldAlwaysUsePluginDocument const): Deleted.
+ No need to override the function inherited from the base class, nor to keep track of the
+ unnecessary task of implementing this some day.
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: Updated for the above.
+
2019-02-20 Don Olmstead <don.olmst...@sony.com>
[MSVC] Fix compilation errors with lambdas in Service Workers
Modified: releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentGtk.cpp (242437 => 242438)
--- releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentGtk.cpp 2019-03-05 11:59:27 UTC (rev 242437)
+++ releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentGtk.cpp 2019-03-05 12:40:23 UTC (rev 242438)
@@ -1119,16 +1119,9 @@
return WebKit::kit(gobjectResult.get());
}
-WebKitDOMCSSStyleDeclaration* webkit_dom_document_get_override_style(WebKitDOMDocument* self, WebKitDOMElement* element, const gchar* pseudoElement)
+WebKitDOMCSSStyleDeclaration* webkit_dom_document_get_override_style(WebKitDOMDocument*, WebKitDOMElement*, const gchar*)
{
- WebCore::JSMainThreadNullState state;
- g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0);
- g_return_val_if_fail(WEBKIT_DOM_IS_ELEMENT(element), 0);
- WebCore::Document* item = WebKit::core(self);
- WebCore::Element* convertedElement = WebKit::core(element);
- WTF::String convertedPseudoElement = WTF::String::fromUTF8(pseudoElement);
- RefPtr<WebCore::CSSStyleDeclaration> gobjectResult = WTF::getPtr(item->getOverrideStyle(convertedElement, convertedPseudoElement));
- return WebKit::kit(gobjectResult.get());
+ return nullptr;
}
WebKitDOMXPathExpression* webkit_dom_document_create_expression(WebKitDOMDocument* self, const gchar* _expression_, WebKitDOMXPathNSResolver* resolver, GError** error)
Modified: releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (242437 => 242438)
--- releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2019-03-05 11:59:27 UTC (rev 242437)
+++ releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2019-03-05 12:40:23 UTC (rev 242438)
@@ -1782,12 +1782,6 @@
#endif // PLATFORM(COCOA)
-bool WebFrameLoaderClient::shouldAlwaysUsePluginDocument(const String& /*mimeType*/) const
-{
- notImplemented();
- return false;
-}
-
void WebFrameLoaderClient::didChangeScrollOffset()
{
WebPage* webPage = m_frame->page();
Modified: releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h (242437 => 242438)
--- releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h 2019-03-05 11:59:27 UTC (rev 242437)
+++ releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h 2019-03-05 12:40:23 UTC (rev 242438)
@@ -243,8 +243,6 @@
NSDictionary *dataDetectionContext() final;
#endif
- bool shouldAlwaysUsePluginDocument(const String& /*mimeType*/) const final;
-
void didChangeScrollOffset() final;
bool allowScript(bool enabledPerSettings) final;
Modified: releases/WebKitGTK/webkit-2.24/Source/WebKitLegacy/mac/ChangeLog (242437 => 242438)
--- releases/WebKitGTK/webkit-2.24/Source/WebKitLegacy/mac/ChangeLog 2019-03-05 11:59:27 UTC (rev 242437)
+++ releases/WebKitGTK/webkit-2.24/Source/WebKitLegacy/mac/ChangeLog 2019-03-05 12:40:23 UTC (rev 242438)
@@ -1,3 +1,15 @@
+2019-02-21 Darin Adler <da...@apple.com>
+
+ Some refinements for Node and Document
+ https://bugs.webkit.org/show_bug.cgi?id=194764
+
+ Reviewed by Ryosuke Niwa.
+
+ * DOM/DOMDocument.mm:
+ (-[DOMDocument getOverrideStyle:pseudoElement:]): Return nil without calling
+ through to WebCore or even looking at the arguments.
+ (-[DOMDocument getOverrideStyle::]): Ditto.
+
2019-02-06 Andy Estes <aes...@apple.com>
[Payment Request] It should be possible to require a phonetic name for shipping contacts
Modified: releases/WebKitGTK/webkit-2.24/Source/WebKitLegacy/mac/DOM/DOMDocument.mm (242437 => 242438)
--- releases/WebKitGTK/webkit-2.24/Source/WebKitLegacy/mac/DOM/DOMDocument.mm 2019-03-05 11:59:27 UTC (rev 242437)
+++ releases/WebKitGTK/webkit-2.24/Source/WebKitLegacy/mac/DOM/DOMDocument.mm 2019-03-05 12:40:23 UTC (rev 242438)
@@ -574,8 +574,7 @@
- (DOMCSSStyleDeclaration *)getOverrideStyle:(DOMElement *)element pseudoElement:(NSString *)pseudoElement
{
- WebCore::JSMainThreadNullState state;
- return kit(WTF::getPtr(IMPL->getOverrideStyle(core(element), pseudoElement)));
+ return nil;
}
static RefPtr<WebCore::XPathNSResolver> wrap(id <DOMXPathNSResolver> resolver)
@@ -787,7 +786,7 @@
- (DOMCSSStyleDeclaration *)getOverrideStyle:(DOMElement *)element :(NSString *)pseudoElement
{
- return [self getOverrideStyle:element pseudoElement:pseudoElement];
+ return nil;
}
- (DOMXPathExpression *)createExpression:(NSString *)_expression_ :(id <DOMXPathNSResolver>)resolver