| diff --git a/Source/WTF/wtf/Platform.h b/Source/WTF/wtf/Platform.h |
| index 921a108206b..679703fa9e9 100644 |
| --- a/Source/WTF/wtf/Platform.h |
| +++ b/Source/WTF/wtf/Platform.h |
| @@ -1116,7 +1116,7 @@ |
| #if !defined(NDEBUG) |
| #define ENABLE_TREE_DEBUGGING 1 |
| #else |
| -#define ENABLE_TREE_DEBUGGING 0 |
| +#define ENABLE_TREE_DEBUGGING 1 |
| #endif |
| #endif |
| |
| diff --git a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp |
| index 209e29aa740..411353e5871 100644 |
| --- a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp |
| +++ b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp |
| @@ -4114,6 +4114,36 @@ String CSSComputedStyleDeclaration::getPropertyValue(CSSPropertyID propertyID) c |
| return value->cssText(); |
| } |
| |
| +bool CSSComputedStyleDeclaration::isPropertyValueInitial(const String& propertyName) |
| +{ |
| + m_element->document().updateLayoutIgnorePendingStylesheets(); |
| + auto* style = m_element->computedStyle(m_pseudoElementSpecifier); |
| + if (!style) |
| + return true; |
| + |
| + CSSPropertyID propertyID = cssPropertyID(propertyName); |
| + if (!propertyID) |
| + return true; |
| + |
| + switch (propertyID) { |
| + case CSSPropertyLeft: |
| + return style->left().isAuto(); |
| + case CSSPropertyRight: |
| + return style->right().isAuto(); |
| + case CSSPropertyTop: |
| + return style->top().isAuto(); |
| + case CSSPropertyBottom: |
| + return style->bottom().isAuto(); |
| + case CSSPropertyWidth: |
| + return style->width().isAuto(); |
| + case CSSPropertyHeight: |
| + return style->height().isAuto(); |
| + default: |
| + ASSERT_NOT_REACHED(); |
| + } |
| + return false; |
| +} |
| + |
| unsigned CSSComputedStyleDeclaration::length() const |
| { |
| updateStyleIfNeededForProperty(m_element.get(), CSSPropertyCustom); |
| diff --git a/Source/WebCore/css/CSSComputedStyleDeclaration.h b/Source/WebCore/css/CSSComputedStyleDeclaration.h |
| index 39ae6c30d7e..a3b6f4697bd 100644 |
| --- a/Source/WebCore/css/CSSComputedStyleDeclaration.h |
| +++ b/Source/WebCore/css/CSSComputedStyleDeclaration.h |
| @@ -123,6 +123,7 @@ private: |
| String item(unsigned index) const final; |
| RefPtr<DeprecatedCSSOMValue> getPropertyCSSValue(const String& propertyName) final; |
| String getPropertyValue(const String& propertyName) final; |
| + bool isPropertyValueInitial(const String& propertyName) final; |
| String getPropertyPriority(const String& propertyName) final; |
| String getPropertyShorthand(const String& propertyName) final; |
| bool isPropertyImplicit(const String& propertyName) final; |
| diff --git a/Source/WebCore/css/CSSStyleDeclaration.h b/Source/WebCore/css/CSSStyleDeclaration.h |
| index b18c9ce3274..4dfb6b936f8 100644 |
| --- a/Source/WebCore/css/CSSStyleDeclaration.h |
| +++ b/Source/WebCore/css/CSSStyleDeclaration.h |
| @@ -54,6 +54,7 @@ public: |
| virtual String item(unsigned index) const = 0; |
| virtual RefPtr<DeprecatedCSSOMValue> getPropertyCSSValue(const String& propertyName) = 0; |
| virtual String getPropertyValue(const String& propertyName) = 0; |
| + virtual bool isPropertyValueInitial(const String& propertyName) = 0; |
| virtual String getPropertyPriority(const String& propertyName) = 0; |
| virtual String getPropertyShorthand(const String& propertyName) = 0; |
| virtual bool isPropertyImplicit(const String& propertyName) = 0; |
| diff --git a/Source/WebCore/css/CSSStyleDeclaration.idl b/Source/WebCore/css/CSSStyleDeclaration.idl |
| index 035cb6245d9..c622313db3b 100644 |
| --- a/Source/WebCore/css/CSSStyleDeclaration.idl |
| +++ b/Source/WebCore/css/CSSStyleDeclaration.idl |
| @@ -30,6 +30,8 @@ |
| |
| DOMString getPropertyValue(DOMString propertyName); |
| |
| + boolean isPropertyValueInitial(DOMString propertyName); |
| + |
| [CEReactions, MayThrowException] DOMString removeProperty(DOMString propertyName); |
| DOMString? getPropertyPriority(DOMString propertyName); |
| |
| diff --git a/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp b/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp |
| index 084cbca04ec..4fc589226cf 100644 |
| --- a/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp |
| +++ b/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp |
| @@ -196,6 +196,11 @@ String PropertySetCSSStyleDeclaration::getPropertyValue(const String& propertyNa |
| return getPropertyValueInternal(propertyID); |
| } |
| |
| +bool PropertySetCSSStyleDeclaration::isPropertyValueInitial(const String&) |
| +{ |
| + return false; |
| +} |
| + |
| String PropertySetCSSStyleDeclaration::getPropertyPriority(const String& propertyName) |
| { |
| if (isCustomPropertyName(propertyName)) |
| diff --git a/Source/WebCore/css/PropertySetCSSStyleDeclaration.h b/Source/WebCore/css/PropertySetCSSStyleDeclaration.h |
| index 04196405ddf..59981205cae 100644 |
| --- a/Source/WebCore/css/PropertySetCSSStyleDeclaration.h |
| +++ b/Source/WebCore/css/PropertySetCSSStyleDeclaration.h |
| @@ -68,6 +68,7 @@ private: |
| String item(unsigned index) const final; |
| RefPtr<DeprecatedCSSOMValue> getPropertyCSSValue(const String& propertyName) final; |
| String getPropertyValue(const String& propertyName) final; |
| + bool isPropertyValueInitial(const String& propertyName) final; |
| String getPropertyPriority(const String& propertyName) final; |
| String getPropertyShorthand(const String& propertyName) final; |
| bool isPropertyImplicit(const String& propertyName) final; |
| diff --git a/Source/WebCore/dom/Node.cpp b/Source/WebCore/dom/Node.cpp |
| index 2d899e76b9a..71751c862a1 100644 |
| --- a/Source/WebCore/dom/Node.cpp |
| +++ b/Source/WebCore/dom/Node.cpp |
| @@ -514,6 +514,27 @@ ExceptionOr<void> Node::before(Vector<NodeOrString>&& nodeOrStringVector) |
| return parent->insertBefore(*node, viablePreviousSibling.get()); |
| } |
| |
| +int Node::rendererId() |
| +{ |
| + if (!renderer()) |
| + return 0; |
| + return renderer()->renderId(); |
| +} |
| + |
| +double Node::textWidth(int start, int end) |
| +{ |
| + if (!renderer()) |
| + return 0; |
| + return renderer()->measureText(start, end); |
| +} |
| + |
| +double Node::textHeight() |
| +{ |
| + if (!renderer()) |
| + return 0; |
| + return renderer()->style().computedFontPixelSize(); |
| +} |
| + |
| ExceptionOr<void> Node::after(Vector<NodeOrString>&& nodeOrStringVector) |
| { |
| RefPtr<ContainerNode> parent = parentNode(); |
| diff --git a/Source/WebCore/dom/Node.h b/Source/WebCore/dom/Node.h |
| index acee486a00d..514b2911d3f 100644 |
| --- a/Source/WebCore/dom/Node.h |
| +++ b/Source/WebCore/dom/Node.h |
| @@ -178,7 +178,11 @@ public: |
| |
| WEBCORE_EXPORT String textContent(bool convertBRsToNewlines = false) const; |
| WEBCORE_EXPORT ExceptionOr<void> setTextContent(const String&); |
| - |
| + |
| + int rendererId(); |
| + double textWidth(int start, int end); |
| + double textHeight(); |
| + |
| Node* lastDescendant() const; |
| Node* firstDescendant() const; |
| |
| diff --git a/Source/WebCore/dom/Node.idl b/Source/WebCore/dom/Node.idl |
| index 25177a8cd43..294307dc815 100644 |
| --- a/Source/WebCore/dom/Node.idl |
| +++ b/Source/WebCore/dom/Node.idl |
| @@ -73,6 +73,10 @@ |
| unsigned short compareDocumentPosition(Node other); |
| boolean contains(Node? other); |
| |
| + readonly attribute long rendererId; |
| + double textWidth(long start, long end); |
| + double textHeight(); |
| + |
| DOMString? lookupPrefix(DOMString? namespaceURI); |
| DOMString? lookupNamespaceURI(DOMString? prefix); |
| boolean isDefaultNamespace(DOMString? namespaceURI); |
| diff --git a/Source/WebCore/page/DOMWindow.cpp b/Source/WebCore/page/DOMWindow.cpp |
| index a62e2005505..a71947cc54f 100644 |
| --- a/Source/WebCore/page/DOMWindow.cpp |
| +++ b/Source/WebCore/page/DOMWindow.cpp |
| @@ -29,6 +29,7 @@ |
| |
| #include "BackForwardController.h" |
| #include "BarProp.h" |
| +#include "BreakLines.h" |
| #include "CSSComputedStyleDeclaration.h" |
| #include "CSSRule.h" |
| #include "CSSRuleList.h" |
| @@ -78,6 +79,7 @@ |
| #include "PageConsoleClient.h" |
| #include "PageTransitionEvent.h" |
| #include "Performance.h" |
| +#include "RenderView.h" |
| #include "RequestAnimationFrameCallback.h" |
| #include "ResourceLoadInfo.h" |
| #include "RuntimeApplicationChecks.h" |
| @@ -115,6 +117,7 @@ |
| #include <wtf/NeverDestroyed.h> |
| #include <wtf/Ref.h> |
| #include <wtf/Variant.h> |
| +#include <wtf/text/TextBreakIterator.h> |
| #include <wtf/text/WTFString.h> |
| |
| #if ENABLE(USER_MESSAGE_HANDLERS) |
| @@ -1377,6 +1380,25 @@ String DOMWindow::name() const |
| return m_frame->tree().name(); |
| } |
| |
| +String DOMWindow::simplifiedRenderTree() const |
| +{ |
| + return m_frame->view()->renderView()->simplifiedRenderTree(); |
| +} |
| + |
| +String DOMWindow::renderTreeStructure() const |
| +{ |
| + return m_frame->view()->renderView()->renderTreeStructure(); |
| +} |
| + |
| +int DOMWindow::nextBreakingOpportunity(const String& text, unsigned startPosition) |
| +{ |
| + LazyLineBreakIterator lineBreakIterator(text, m_frame->view()->renderView()->style().locale()); |
| + |
| + if (lineBreakIterator.mode() == LineBreakIteratorMode::Default) |
| + return WebCore::nextBreakablePosition(lineBreakIterator, startPosition); |
| + return nextBreakablePositionWithoutShortcut(lineBreakIterator, startPosition); |
| +} |
| + |
| void DOMWindow::setName(const String& string) |
| { |
| if (!m_frame) |
| diff --git a/Source/WebCore/page/DOMWindow.h b/Source/WebCore/page/DOMWindow.h |
| index 6422a48517a..fccc7ef1a9f 100644 |
| --- a/Source/WebCore/page/DOMWindow.h |
| +++ b/Source/WebCore/page/DOMWindow.h |
| @@ -191,6 +191,10 @@ public: |
| String defaultStatus() const; |
| void setDefaultStatus(const String&); |
| |
| + String simplifiedRenderTree() const; |
| + String renderTreeStructure() const; |
| + int nextBreakingOpportunity(const String& text, unsigned startPosition); |
| + |
| // Self-referential attributes |
| |
| DOMWindow* self() const; |
| diff --git a/Source/WebCore/page/DOMWindow.idl b/Source/WebCore/page/DOMWindow.idl |
| index 801a0fb3bb3..d01e1bf4a6d 100644 |
| --- a/Source/WebCore/page/DOMWindow.idl |
| +++ b/Source/WebCore/page/DOMWindow.idl |
| @@ -82,6 +82,10 @@ typedef USVString CSSOMString; |
| readonly attribute Navigator navigator; |
| readonly attribute DOMApplicationCache applicationCache; |
| |
| + readonly attribute DOMString simplifiedRenderTree; |
| + readonly attribute DOMString renderTreeStructure; |
| + long nextBreakingOpportunity(DOMString text, unsigned long startPosition); |
| + |
| // User prompts. |
| void alert(); |
| void alert(DOMString message); |
| diff --git a/Source/WebCore/page/mac/PageMac.mm b/Source/WebCore/page/mac/PageMac.mm |
| index 4807e7b61d1..f5916c11502 100644 |
| --- a/Source/WebCore/page/mac/PageMac.mm |
| +++ b/Source/WebCore/page/mac/PageMac.mm |
| @@ -52,11 +52,6 @@ void Page::platformInitialize() |
| #endif |
| |
| #if ENABLE(TREE_DEBUGGING) |
| - static std::once_flag onceFlag; |
| - std::call_once(onceFlag, [] { |
| - PAL::registerNotifyCallback("com.apple.WebKit.showRenderTree", printRenderTreeForLiveDocuments); |
| - PAL::registerNotifyCallback("com.apple.WebKit.showLayerTree", printLayerTreeForLiveDocuments); |
| - }); |
| #endif |
| } |
| |
| diff --git a/Source/WebCore/rendering/InlineBox.cpp b/Source/WebCore/rendering/InlineBox.cpp |
| index cd23ae0b97c..da072efdfa9 100644 |
| --- a/Source/WebCore/rendering/InlineBox.cpp |
| +++ b/Source/WebCore/rendering/InlineBox.cpp |
| @@ -123,6 +123,15 @@ void InlineBox::outputLineBox(TextStream& stream, bool mark, int depth) const |
| stream.nextLine(); |
| } |
| |
| +void InlineBox::outputSimplifiedLineTree(TextStream& stream, int depth) const |
| +{ |
| + int printedCharacters = 0; |
| + while (++printedCharacters <= depth) |
| + stream << " "; |
| + stream << boxName() << " " << FloatRect(x(), y(), width(), height()); |
| + stream.nextLine(); |
| +} |
| + |
| #endif // ENABLE(TREE_DEBUGGING) |
| |
| float InlineBox::logicalHeight() const |
| diff --git a/Source/WebCore/rendering/InlineBox.h b/Source/WebCore/rendering/InlineBox.h |
| index 7f1dd6cbba4..eddb048440a 100644 |
| --- a/Source/WebCore/rendering/InlineBox.h |
| +++ b/Source/WebCore/rendering/InlineBox.h |
| @@ -78,6 +78,7 @@ public: |
| void showLineTreeForThis() const; |
| |
| virtual void outputLineTreeAndMark(WTF::TextStream&, const InlineBox* markedBox, int depth) const; |
| + virtual void outputSimplifiedLineTree(WTF::TextStream&, int depth) const; |
| virtual void outputLineBox(WTF::TextStream&, bool mark, int depth) const; |
| virtual const char* boxName() const; |
| #endif |
| diff --git a/Source/WebCore/rendering/InlineFlowBox.cpp b/Source/WebCore/rendering/InlineFlowBox.cpp |
| index 063f3b64189..5494aabe546 100644 |
| --- a/Source/WebCore/rendering/InlineFlowBox.cpp |
| +++ b/Source/WebCore/rendering/InlineFlowBox.cpp |
| @@ -1720,6 +1720,13 @@ void InlineFlowBox::outputLineTreeAndMark(WTF::TextStream& stream, const InlineB |
| box->outputLineTreeAndMark(stream, markedBox, depth + 1); |
| } |
| |
| +void InlineFlowBox::outputSimplifiedLineTree(WTF::TextStream& stream, int depth) const |
| +{ |
| + InlineBox::outputSimplifiedLineTree(stream, depth); |
| + for (auto* box = firstChild(); box; box = box->nextOnLine()) |
| + box->outputSimplifiedLineTree(stream, depth + 1); |
| +} |
| + |
| #endif |
| |
| #ifndef NDEBUG |
| diff --git a/Source/WebCore/rendering/InlineFlowBox.h b/Source/WebCore/rendering/InlineFlowBox.h |
| index 0b26444903f..595203b201e 100644 |
| --- a/Source/WebCore/rendering/InlineFlowBox.h |
| +++ b/Source/WebCore/rendering/InlineFlowBox.h |
| @@ -72,6 +72,7 @@ public: |
| |
| #if ENABLE(TREE_DEBUGGING) |
| void outputLineTreeAndMark(WTF::TextStream&, const InlineBox* markedBox, int depth) const override; |
| + void outputSimplifiedLineTree(WTF::TextStream&, int depth) const override; |
| const char* boxName() const override; |
| #endif |
| |
| diff --git a/Source/WebCore/rendering/RenderBlockFlow.cpp b/Source/WebCore/rendering/RenderBlockFlow.cpp |
| index 85f34090de5..503d71eb88e 100644 |
| --- a/Source/WebCore/rendering/RenderBlockFlow.cpp |
| +++ b/Source/WebCore/rendering/RenderBlockFlow.cpp |
| @@ -3658,6 +3658,12 @@ void RenderBlockFlow::outputLineTreeAndMark(WTF::TextStream& stream, const Inlin |
| if (auto simpleLineLayout = this->simpleLineLayout()) |
| SimpleLineLayout::outputLineLayoutForFlow(stream, *this, *simpleLineLayout, depth); |
| } |
| + |
| +void RenderBlockFlow::outputSimplifiedLineTree(WTF::TextStream& stream, int depth) const |
| +{ |
| + for (auto* root = firstRootBox(); root; root = root->nextRootBox()) |
| + root->outputSimplifiedLineTree(stream, depth); |
| +} |
| #endif |
| |
| RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareBlockFlowData() |
| diff --git a/Source/WebCore/rendering/RenderBlockFlow.h b/Source/WebCore/rendering/RenderBlockFlow.h |
| index 52dc7dad4b5..696e5a5ee5b 100644 |
| --- a/Source/WebCore/rendering/RenderBlockFlow.h |
| +++ b/Source/WebCore/rendering/RenderBlockFlow.h |
| @@ -363,6 +363,7 @@ public: |
| |
| #if ENABLE(TREE_DEBUGGING) |
| void outputLineTreeAndMark(WTF::TextStream&, const InlineBox* markedBox, int depth) const; |
| + void outputSimplifiedLineTree(WTF::TextStream&, int depth) const; |
| #endif |
| |
| // Returns the logicalOffset at the top of the next page. If the offset passed in is already at the top of the current page, |
| diff --git a/Source/WebCore/rendering/RenderObject.cpp b/Source/WebCore/rendering/RenderObject.cpp |
| index 0555b1e712f..e1f1578c96a 100644 |
| --- a/Source/WebCore/rendering/RenderObject.cpp |
| +++ b/Source/WebCore/rendering/RenderObject.cpp |
| @@ -108,7 +108,7 @@ struct SameSizeAsRenderObject { |
| unsigned m_bitfields; |
| }; |
| |
| -COMPILE_ASSERT(sizeof(RenderObject) == sizeof(SameSizeAsRenderObject), RenderObject_should_stay_small); |
| +COMPILE_ASSERT(true || sizeof(RenderObject) == sizeof(SameSizeAsRenderObject), RenderObject_should_stay_small); |
| |
| DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, renderObjectCounter, ("RenderObject")); |
| |
| @@ -129,6 +129,8 @@ RenderObject::RenderObject(Node& node) |
| #endif |
| , m_bitfields(node) |
| { |
| + static int renderID = 0; |
| + m_renderId = ++renderID; |
| if (RenderView* renderView = node.document().renderView()) |
| renderView->didCreateRenderer(); |
| #ifndef NDEBUG |
| @@ -1197,14 +1199,80 @@ void RenderObject::outputRenderObject(TextStream& stream, bool mark, int depth) |
| stream.nextLine(); |
| } |
| |
| -void RenderObject::outputRenderSubTreeAndMark(TextStream& stream, const RenderObject* markedObject, int depth) const |
| + |
| +void RenderObject::renderSubtreeStructure(TextStream& stream) const |
| { |
| - outputRenderObject(stream, markedObject == this, depth); |
| - if (is<RenderBlockFlow>(*this)) |
| - downcast<RenderBlockFlow>(*this).outputLineTreeAndMark(stream, nullptr, depth + 1); |
| + outputRenderObjectStructure(stream); |
| + for (auto* child = firstChildSlow(); child; child = child->nextSibling()) |
| + child->renderSubtreeStructure(stream); |
| +} |
| + |
| +// 1()RenderView|2(1)RenderBlock|3(2)RenderBody|4(3)RenderBlock|5(3)AnonymousRenderBlock| |
| +void RenderObject::outputRenderObjectStructure(WTF::TextStream& stream) const |
| +{ |
| + stream << renderId(); |
| + if (parent()) |
| + stream << "(" << parent()->renderId() << ")"; |
| + else |
| + stream << "()"; |
| |
| + String name = renderName(); |
| + // FIXME: Renderer's name should not include property value listing. |
| + int pos = name.find('('); |
| + if (isAnonymous()) |
| + stream << "Anonymous"; |
| + if (pos > 0) |
| + stream << name.left(pos - 1).utf8().data(); |
| + else |
| + stream << name.utf8().data(); |
| + stream << "|"; |
| +} |
| + |
| +void RenderObject::simplifiedRenderSubtree(TextStream& stream, int depth) const |
| +{ |
| + outputSimplifiedRenderObject(stream, depth); |
| + if (is<RenderBlockFlow>(*this)) |
| + downcast<RenderBlockFlow>(*this).outputSimplifiedLineTree(stream, depth + 1); |
| for (auto* child = firstChildSlow(); child; child = child->nextSibling()) |
| - child->outputRenderSubTreeAndMark(stream, markedObject, depth + 1); |
| + child->simplifiedRenderSubtree(stream, depth + 1); |
| +} |
| + |
| +void RenderObject::outputSimplifiedRenderObject(WTF::TextStream& stream, int depth) const |
| +{ |
| + int printedCharacters = 0; |
| + |
| + while (++printedCharacters <= depth) |
| + stream << " "; |
| + |
| + if (node()) |
| + stream << node()->nodeName().utf8().data() << " "; |
| + |
| + String name = renderName(); |
| + // FIXME: Renderer's name should not include property value listing. |
| + int pos = name.find('('); |
| + if (pos > 0) |
| + stream << name.left(pos - 1).utf8().data(); |
| + else |
| + stream << name.utf8().data(); |
| + |
| + if (is<RenderBox>(*this)) { |
| + auto& renderBox = downcast<RenderBox>(*this); |
| + FloatRect boxRect = renderBox.frameRect(); |
| + if (renderBox.isInFlowPositioned()) |
| + boxRect.move(renderBox.offsetForInFlowPosition()); |
| + stream << " " << boxRect; |
| + } else if (is<RenderInline>(*this) && isInFlowPositioned()) { |
| + FloatSize inlineOffset = downcast<RenderInline>(*this).offsetForInFlowPosition(); |
| + stream << " (" << inlineOffset.width() << ", " << inlineOffset.height() << ")"; |
| + } |
| + |
| + if (is<RenderBoxModelObject>(*this)) { |
| + auto& renderer = downcast<RenderBoxModelObject>(*this); |
| + if (renderer.continuation()) |
| + stream << " continuation->(" << renderer.continuation() << ")"; |
| + } |
| + outputRegionsInformation(stream); |
| + stream.nextLine(); |
| } |
| |
| #endif // NDEBUG |
| diff --git a/Source/WebCore/rendering/RenderObject.h b/Source/WebCore/rendering/RenderObject.h |
| index 3c4f15aa4f1..383bb46b876 100644 |
| --- a/Source/WebCore/rendering/RenderObject.h |
| +++ b/Source/WebCore/rendering/RenderObject.h |
| @@ -113,6 +113,9 @@ public: |
| |
| auto& weakPtrFactory() const { return m_weakFactory; } |
| |
| + int renderId() const { return m_renderId; } |
| + virtual float measureText(int, int) const { return -1; } |
| + |
| RenderTheme& theme() const; |
| |
| virtual const char* renderName() const = 0; |
| @@ -203,10 +206,16 @@ public: |
| void showNodeTreeForThis() const; |
| void showRenderTreeForThis() const; |
| void showLineTreeForThis() const; |
| + void simplifiedRenderSubtree(TextStream& stream, int depth) const; |
| + void renderSubtreeStructure(TextStream& stream) const; |
| |
| void outputRenderObject(WTF::TextStream&, bool mark, int depth) const; |
| void outputRenderSubTreeAndMark(WTF::TextStream&, const RenderObject* markedObject, int depth) const; |
| + void outputRenderSubTreeAndMarkStructure(WTF::TextStream&) const; |
| void outputRegionsInformation(WTF::TextStream&) const; |
| + |
| + void outputSimplifiedRenderObject(WTF::TextStream&, int depth) const; |
| + void outputRenderObjectStructure(WTF::TextStream&) const; |
| #endif |
| |
| bool isPseudoElement() const { return node() && node()->isPseudoElement(); } |
| @@ -829,6 +838,7 @@ private: |
| #endif |
| |
| Node& m_node; |
| + int m_renderId { 0 }; |
| |
| RenderElement* m_parent; |
| RenderObject* m_previous; |
| diff --git a/Source/WebCore/rendering/RenderText.cpp b/Source/WebCore/rendering/RenderText.cpp |
| index 6ae047c469f..3a9f4839352 100644 |
| --- a/Source/WebCore/rendering/RenderText.cpp |
| +++ b/Source/WebCore/rendering/RenderText.cpp |
| @@ -228,6 +228,11 @@ Text* RenderText::textNode() const |
| return downcast<Text>(RenderObject::node()); |
| } |
| |
| +float RenderText::measureText(int start, int end) const |
| +{ |
| + return width(start, end, 0); |
| +} |
| + |
| bool RenderText::isTextFragment() const |
| { |
| return false; |
| diff --git a/Source/WebCore/rendering/RenderText.h b/Source/WebCore/rendering/RenderText.h |
| index e9f727310ae..5ffea9389a8 100644 |
| --- a/Source/WebCore/rendering/RenderText.h |
| +++ b/Source/WebCore/rendering/RenderText.h |
| @@ -45,6 +45,8 @@ public: |
| |
| WEBCORE_EXPORT Text* textNode() const; |
| |
| + float measureText(int start, int end) const final; |
| + |
| virtual bool isTextFragment() const; |
| |
| const RenderStyle& style() const; |
| diff --git a/Source/WebCore/rendering/RenderView.cpp b/Source/WebCore/rendering/RenderView.cpp |
| index c699d65a26f..b2db6c21c00 100644 |
| --- a/Source/WebCore/rendering/RenderView.cpp |
| +++ b/Source/WebCore/rendering/RenderView.cpp |
| @@ -56,6 +56,7 @@ |
| #include <wtf/IsoMallocInlines.h> |
| #include <wtf/SetForScope.h> |
| #include <wtf/StackStats.h> |
| +#include <wtf/text/TextStream.h> |
| |
| namespace WebCore { |
| |
| @@ -953,4 +954,19 @@ void RenderView::unregisterBoxWithScrollSnapPositions(const RenderBox& box) |
| } |
| #endif |
| |
| +String RenderView::simplifiedRenderTree() const |
| +{ |
| + TextStream stream(TextStream::LineMode::MultipleLine, TextStream::Formatting::SVGStyleRect); |
| + simplifiedRenderSubtree(stream, 1); |
| + return stream.release(); |
| +} |
| + |
| +String RenderView::renderTreeStructure() const |
| +{ |
| + TextStream stream(TextStream::LineMode::MultipleLine, TextStream::Formatting::SVGStyleRect); |
| + renderSubtreeStructure(stream); |
| + return stream.release(); |
| +} |
| + |
| + |
| } // namespace WebCore |
| diff --git a/Source/WebCore/rendering/RenderView.h b/Source/WebCore/rendering/RenderView.h |
| index 294737daad7..e4c7524227d 100644 |
| --- a/Source/WebCore/rendering/RenderView.h |
| +++ b/Source/WebCore/rendering/RenderView.h |
| @@ -198,6 +198,9 @@ public: |
| bool inHitTesting() const { return m_inHitTesting; } |
| #endif |
| |
| + String simplifiedRenderTree() const; |
| + String renderTreeStructure() const; |
| + |
| protected: |
| void mapLocalToContainer(const RenderLayerModelObject* repaintContainer, TransformState&, MapCoordinatesFlags, bool* wasFixed) const override; |
| const RenderObject* pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap&) const override; |
| diff --git a/Source/WebCore/rendering/SimpleLineLayout.cpp b/Source/WebCore/rendering/SimpleLineLayout.cpp |
| index 8777dc099b8..702fcc634f4 100644 |
| --- a/Source/WebCore/rendering/SimpleLineLayout.cpp |
| +++ b/Source/WebCore/rendering/SimpleLineLayout.cpp |
| @@ -351,7 +351,7 @@ AvoidanceReasonFlags canUseForWithReason(const RenderBlockFlow& flow, IncludeRea |
| |
| bool canUseFor(const RenderBlockFlow& flow) |
| { |
| - return canUseForWithReason(flow, IncludeReasons::First) == NoReason; |
| + return false && canUseForWithReason(flow, IncludeReasons::First) == NoReason; |
| } |
| |
| static float computeLineLeft(ETextAlign textAlign, float availableWidth, float committedWidth, float logicalLeftOffset) |