Diff
Modified: trunk/Source/WebCore/ChangeLog (223126 => 223127)
--- trunk/Source/WebCore/ChangeLog 2017-10-10 08:55:18 UTC (rev 223126)
+++ trunk/Source/WebCore/ChangeLog 2017-10-10 10:38:37 UTC (rev 223127)
@@ -1,3 +1,56 @@
+2017-10-09 Antti Koivisto <an...@apple.com>
+
+ Add isContinuation bit
+ https://bugs.webkit.org/show_bug.cgi?id=178084
+
+ Reviewed by Zalan Bujtas.
+
+ Currently continuations are identified indirectly by comparing renderer pointer with the element renderer pointer.
+ This is bug prone and fails to cover anonymous continuations.
+
+ * accessibility/AccessibilityRenderObject.cpp:
+ (WebCore::firstChildConsideringContinuation):
+ (WebCore::startOfContinuations):
+ (WebCore::firstChildIsInlineContinuation):
+ (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored const):
+
+ Ignore first-letter fragment. This worked before because first-letter renderers
+ were mistakenly considered inline element continuations (see below).
+
+ * rendering/RenderBoxModelObject.cpp:
+ (WebCore::RenderBoxModelObject::setContinuation):
+ * rendering/RenderElement.cpp:
+ (WebCore::RenderElement::RenderElement):
+ * rendering/RenderElement.h:
+ (WebCore::RenderElement::hasContinuation const):
+ (WebCore::RenderElement::isContinuation const):
+ (WebCore::RenderElement::setIsContinuation):
+
+ The new bit.
+
+ (WebCore::RenderElement::isElementContinuation const):
+ (WebCore::RenderElement::isInlineElementContinuation const):
+ * rendering/RenderInline.cpp:
+ (WebCore::RenderInline::addChildIgnoringContinuation):
+ (WebCore::RenderInline::cloneAsContinuation const):
+ (WebCore::RenderInline::splitInlines):
+ (WebCore::RenderInline::childBecameNonInline):
+ (WebCore::RenderInline::clone const): Deleted.
+ * rendering/RenderInline.h:
+ * rendering/RenderObject.h:
+ (WebCore::RenderObject::isAnonymousBlock const):
+ (WebCore::RenderObject::isElementContinuation const): Deleted.
+
+ The old continuation test was 'node() && node()->renderer() != this'
+ This was fragile as nulling the renderer will make it fail.
+ It was also wrong for first-letter renderers (isElementContinuation was true for them).
+
+ (WebCore::RenderObject::isInlineElementContinuation const): Deleted.
+
+ Move to RenderElement.
+
+ (WebCore::RenderObject::isBlockElementContinuation const): Deleted.
+
2017-10-10 Joanmarie Diggs <jdi...@igalia.com>
AX: [ATK] STATE_CHECKABLE should be removed from radio buttons in radiogroups with aria-readonly="true"
Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (223126 => 223127)
--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2017-10-10 08:55:18 UTC (rev 223126)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2017-10-10 10:38:37 UTC (rev 223127)
@@ -183,7 +183,7 @@
// We don't want to include the end of a continuation as the firstChild of the
// anonymous parent, because everything has already been linked up via continuation.
// CSS first-letter selector is an example of this case.
- if (renderer.isAnonymous() && firstChild && firstChild->isInlineElementContinuation())
+ if (renderer.isAnonymous() && is<RenderElement>(firstChild) && downcast<RenderElement>(*firstChild).isInlineElementContinuation())
firstChild = nullptr;
if (!firstChild && isInlineWithContinuation(renderer))
@@ -248,12 +248,15 @@
static inline RenderInline* startOfContinuations(RenderObject& renderer)
{
- if (renderer.isInlineElementContinuation() && is<RenderInline>(renderer.node()->renderer()))
+ if (!is<RenderElement>(renderer))
+ return nullptr;
+ auto& renderElement = downcast<RenderElement>(renderer);
+ if (renderElement.isInlineElementContinuation() && is<RenderInline>(renderElement.element()->renderer()))
return downcast<RenderInline>(renderer.node()->renderer());
// Blocks with a previous continuation always have a next continuation
- if (is<RenderBlock>(renderer) && downcast<RenderBlock>(renderer).inlineElementContinuation())
- return downcast<RenderInline>(downcast<RenderBlock>(renderer).inlineElementContinuation()->element()->renderer());
+ if (is<RenderBlock>(renderElement) && downcast<RenderBlock>(renderElement).inlineElementContinuation())
+ return downcast<RenderInline>(downcast<RenderBlock>(renderElement).inlineElementContinuation()->element()->renderer());
return nullptr;
}
@@ -307,7 +310,7 @@
static inline bool firstChildIsInlineContinuation(RenderElement& renderer)
{
RenderObject* child = renderer.firstChild();
- return child && child->isInlineElementContinuation();
+ return is<RenderElement>(child) && downcast<RenderElement>(*child).isInlineElementContinuation();
}
AccessibilityObject* AccessibilityRenderObject::previousSibling() const
@@ -1246,6 +1249,8 @@
return true;
if (altTextInclusion == IncludeObject)
return false;
+ if (downcast<RenderTextFragment>(renderText).firstLetter())
+ return true;
}
// text elements that are just empty whitespace should not be returned
Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (223126 => 223127)
--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2017-10-10 08:55:18 UTC (rev 223126)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2017-10-10 10:38:37 UTC (rev 223127)
@@ -2454,6 +2454,7 @@
void RenderBoxModelObject::setContinuation(RenderBoxModelObject* continuation)
{
+ ASSERT(!continuation || continuation->isContinuation());
if (continuation)
continuationMap().set(this, makeWeakPtr(continuation));
else if (hasContinuation())
Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (223126 => 223127)
--- trunk/Source/WebCore/rendering/RenderElement.cpp 2017-10-10 08:55:18 UTC (rev 223126)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp 2017-10-10 10:38:37 UTC (rev 223127)
@@ -105,6 +105,7 @@
, m_hasPausedImageAnimations(false)
, m_hasCounterNodeMap(false)
, m_hasContinuation(false)
+ , m_isContinuation(false)
, m_hasValidCachedFirstLineStyle(false)
, m_renderBlockHasMarginBeforeQuirk(false)
, m_renderBlockHasMarginAfterQuirk(false)
Modified: trunk/Source/WebCore/rendering/RenderElement.h (223126 => 223127)
--- trunk/Source/WebCore/rendering/RenderElement.h 2017-10-10 08:55:18 UTC (rev 223126)
+++ trunk/Source/WebCore/rendering/RenderElement.h 2017-10-10 10:38:37 UTC (rev 223127)
@@ -204,7 +204,6 @@
void drawLineForBoxSide(GraphicsContext&, const FloatRect&, BoxSide, Color, EBorderStyle, float adjacentWidth1, float adjacentWidth2, bool antialias = false) const;
bool childRequiresTable(const RenderObject& child) const;
- bool hasContinuation() const { return m_hasContinuation; }
#if ENABLE(TEXT_AUTOSIZING)
void adjustComputedFontSizesOnBlocks(float size, float visibleWidth);
@@ -222,6 +221,12 @@
// the child.
virtual void updateAnonymousChildStyle(const RenderObject&, RenderStyle&) const { };
+ bool hasContinuation() const { return m_hasContinuation; }
+ bool isContinuation() const { return m_isContinuation; }
+ void setIsContinuation() { m_isContinuation = true; }
+ bool isElementContinuation() const { return isContinuation() && !isAnonymous(); }
+ bool isInlineElementContinuation() const { return isElementContinuation() && isInline(); }
+
protected:
enum BaseTypeFlag {
RenderLayerModelObjectFlag = 1 << 0,
@@ -332,6 +337,7 @@
unsigned m_hasPausedImageAnimations : 1;
unsigned m_hasCounterNodeMap : 1;
unsigned m_hasContinuation : 1;
+ unsigned m_isContinuation : 1;
mutable unsigned m_hasValidCachedFirstLineStyle : 1;
unsigned m_renderBlockHasMarginBeforeQuirk : 1;
Modified: trunk/Source/WebCore/rendering/RenderInline.cpp (223126 => 223127)
--- trunk/Source/WebCore/rendering/RenderInline.cpp 2017-10-10 08:55:18 UTC (rev 223126)
+++ trunk/Source/WebCore/rendering/RenderInline.cpp 2017-10-10 10:38:37 UTC (rev 223127)
@@ -342,6 +342,7 @@
auto newBox = createRenderer<RenderBlockFlow>(document(), WTFMove(newStyle));
newBox->initializeStyle();
+ newBox->setIsContinuation();
RenderBoxModelObject* oldContinuation = continuation();
setContinuation(newBox.get());
@@ -354,12 +355,13 @@
child.setNeedsLayoutAndPrefWidthsRecalc();
}
-RenderPtr<RenderInline> RenderInline::clone() const
+RenderPtr<RenderInline> RenderInline::cloneAsContinuation() const
{
RenderPtr<RenderInline> cloneInline = createRenderer<RenderInline>(*element(), RenderStyle::clone(style()));
cloneInline->initializeStyle();
cloneInline->setFragmentedFlowState(fragmentedFlowState());
cloneInline->setHasOutlineAutoAncestor(hasOutlineAutoAncestor());
+ cloneInline->setIsContinuation();
return cloneInline;
}
@@ -368,7 +370,7 @@
RenderObject* beforeChild, RenderBoxModelObject* oldCont)
{
// Create a clone of this inline.
- RenderPtr<RenderInline> cloneInline = clone();
+ RenderPtr<RenderInline> cloneInline = cloneAsContinuation();
#if ENABLE(FULLSCREEN_API)
// If we're splitting the inline containing the fullscreened element,
// |beforeChild| may be the renderer for the fullscreened element. However,
@@ -435,7 +437,7 @@
if (splitDepth < cMaxSplitDepth) {
// Create a new clone.
RenderPtr<RenderInline> cloneChild = WTFMove(cloneInline);
- cloneInline = downcast<RenderInline>(*current).clone();
+ cloneInline = downcast<RenderInline>(*current).cloneAsContinuation();
// Insert our child clone as the first child.
cloneInline->addChildIgnoringContinuation(WTFMove(cloneChild));
@@ -1375,6 +1377,7 @@
{
// We have to split the parent flow.
auto newBox = containingBlock()->createAnonymousBlock();
+ newBox->setIsContinuation();
RenderBoxModelObject* oldContinuation = continuation();
setContinuation(newBox.get());
RenderObject* beforeChild = child.nextSibling();
Modified: trunk/Source/WebCore/rendering/RenderInline.h (223126 => 223127)
--- trunk/Source/WebCore/rendering/RenderInline.h 2017-10-10 08:55:18 UTC (rev 223126)
+++ trunk/Source/WebCore/rendering/RenderInline.h 2017-10-10 10:38:37 UTC (rev 223127)
@@ -167,7 +167,7 @@
void addAnnotatedRegions(Vector<AnnotatedRegionValue>&) final;
#endif
- RenderPtr<RenderInline> clone() const;
+ RenderPtr<RenderInline> cloneAsContinuation() const;
void paintOutlineForLine(GraphicsContext&, const LayoutPoint&, const LayoutRect& prevLine, const LayoutRect& thisLine, const LayoutRect& nextLine, const Color&);
RenderBoxModelObject* continuationBefore(RenderObject* beforeChild);
Modified: trunk/Source/WebCore/rendering/RenderObject.h (223126 => 223127)
--- trunk/Source/WebCore/rendering/RenderObject.h 2017-10-10 08:55:18 UTC (rev 223126)
+++ trunk/Source/WebCore/rendering/RenderObject.h 2017-10-10 10:38:37 UTC (rev 223127)
@@ -411,9 +411,6 @@
#endif
;
}
- bool isElementContinuation() const { return node() && node()->renderer() != this; }
- bool isInlineElementContinuation() const { return isElementContinuation() && isInline(); }
- bool isBlockElementContinuation() const { return isElementContinuation() && !isInline(); }
bool isFloating() const { return m_bitfields.floating(); }