Changeset 223127 in webkit
- Timestamp:
- Oct 10, 2017, 3:38:37 AM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r223126 r223127 1 2017-10-09 Antti Koivisto <antti@apple.com> 2 3 Add isContinuation bit 4 https://bugs.webkit.org/show_bug.cgi?id=178084 5 6 Reviewed by Zalan Bujtas. 7 8 Currently continuations are identified indirectly by comparing renderer pointer with the element renderer pointer. 9 This is bug prone and fails to cover anonymous continuations. 10 11 * accessibility/AccessibilityRenderObject.cpp: 12 (WebCore::firstChildConsideringContinuation): 13 (WebCore::startOfContinuations): 14 (WebCore::firstChildIsInlineContinuation): 15 (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored const): 16 17 Ignore first-letter fragment. This worked before because first-letter renderers 18 were mistakenly considered inline element continuations (see below). 19 20 * rendering/RenderBoxModelObject.cpp: 21 (WebCore::RenderBoxModelObject::setContinuation): 22 * rendering/RenderElement.cpp: 23 (WebCore::RenderElement::RenderElement): 24 * rendering/RenderElement.h: 25 (WebCore::RenderElement::hasContinuation const): 26 (WebCore::RenderElement::isContinuation const): 27 (WebCore::RenderElement::setIsContinuation): 28 29 The new bit. 30 31 (WebCore::RenderElement::isElementContinuation const): 32 (WebCore::RenderElement::isInlineElementContinuation const): 33 * rendering/RenderInline.cpp: 34 (WebCore::RenderInline::addChildIgnoringContinuation): 35 (WebCore::RenderInline::cloneAsContinuation const): 36 (WebCore::RenderInline::splitInlines): 37 (WebCore::RenderInline::childBecameNonInline): 38 (WebCore::RenderInline::clone const): Deleted. 39 * rendering/RenderInline.h: 40 * rendering/RenderObject.h: 41 (WebCore::RenderObject::isAnonymousBlock const): 42 (WebCore::RenderObject::isElementContinuation const): Deleted. 43 44 The old continuation test was 'node() && node()->renderer() != this' 45 This was fragile as nulling the renderer will make it fail. 46 It was also wrong for first-letter renderers (isElementContinuation was true for them). 47 48 (WebCore::RenderObject::isInlineElementContinuation const): Deleted. 49 50 Move to RenderElement. 51 52 (WebCore::RenderObject::isBlockElementContinuation const): Deleted. 53 1 54 2017-10-10 Joanmarie Diggs <jdiggs@igalia.com> 2 55 -
trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp
r222422 r223127 184 184 // anonymous parent, because everything has already been linked up via continuation. 185 185 // CSS first-letter selector is an example of this case. 186 if (renderer.isAnonymous() && firstChild && firstChild->isInlineElementContinuation())186 if (renderer.isAnonymous() && is<RenderElement>(firstChild) && downcast<RenderElement>(*firstChild).isInlineElementContinuation()) 187 187 firstChild = nullptr; 188 188 … … 249 249 static inline RenderInline* startOfContinuations(RenderObject& renderer) 250 250 { 251 if (renderer.isInlineElementContinuation() && is<RenderInline>(renderer.node()->renderer())) 251 if (!is<RenderElement>(renderer)) 252 return nullptr; 253 auto& renderElement = downcast<RenderElement>(renderer); 254 if (renderElement.isInlineElementContinuation() && is<RenderInline>(renderElement.element()->renderer())) 252 255 return downcast<RenderInline>(renderer.node()->renderer()); 253 256 254 257 // Blocks with a previous continuation always have a next continuation 255 if (is<RenderBlock>(render er) && downcast<RenderBlock>(renderer).inlineElementContinuation())256 return downcast<RenderInline>(downcast<RenderBlock>(render er).inlineElementContinuation()->element()->renderer());258 if (is<RenderBlock>(renderElement) && downcast<RenderBlock>(renderElement).inlineElementContinuation()) 259 return downcast<RenderInline>(downcast<RenderBlock>(renderElement).inlineElementContinuation()->element()->renderer()); 257 260 258 261 return nullptr; … … 308 311 { 309 312 RenderObject* child = renderer.firstChild(); 310 return child && child->isInlineElementContinuation();313 return is<RenderElement>(child) && downcast<RenderElement>(*child).isInlineElementContinuation(); 311 314 } 312 315 … … 1247 1250 if (altTextInclusion == IncludeObject) 1248 1251 return false; 1252 if (downcast<RenderTextFragment>(renderText).firstLetter()) 1253 return true; 1249 1254 } 1250 1255 -
trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp
r223003 r223127 2455 2455 void RenderBoxModelObject::setContinuation(RenderBoxModelObject* continuation) 2456 2456 { 2457 ASSERT(!continuation || continuation->isContinuation()); 2457 2458 if (continuation) 2458 2459 continuationMap().set(this, makeWeakPtr(continuation)); -
trunk/Source/WebCore/rendering/RenderElement.cpp
r222740 r223127 106 106 , m_hasCounterNodeMap(false) 107 107 , m_hasContinuation(false) 108 , m_isContinuation(false) 108 109 , m_hasValidCachedFirstLineStyle(false) 109 110 , m_renderBlockHasMarginBeforeQuirk(false) -
trunk/Source/WebCore/rendering/RenderElement.h
r222679 r223127 205 205 206 206 bool childRequiresTable(const RenderObject& child) const; 207 bool hasContinuation() const { return m_hasContinuation; }208 207 209 208 #if ENABLE(TEXT_AUTOSIZING) … … 222 221 // the child. 223 222 virtual void updateAnonymousChildStyle(const RenderObject&, RenderStyle&) const { }; 223 224 bool hasContinuation() const { return m_hasContinuation; } 225 bool isContinuation() const { return m_isContinuation; } 226 void setIsContinuation() { m_isContinuation = true; } 227 bool isElementContinuation() const { return isContinuation() && !isAnonymous(); } 228 bool isInlineElementContinuation() const { return isElementContinuation() && isInline(); } 224 229 225 230 protected: … … 333 338 unsigned m_hasCounterNodeMap : 1; 334 339 unsigned m_hasContinuation : 1; 340 unsigned m_isContinuation : 1; 335 341 mutable unsigned m_hasValidCachedFirstLineStyle : 1; 336 342 -
trunk/Source/WebCore/rendering/RenderInline.cpp
r222679 r223127 343 343 auto newBox = createRenderer<RenderBlockFlow>(document(), WTFMove(newStyle)); 344 344 newBox->initializeStyle(); 345 newBox->setIsContinuation(); 345 346 RenderBoxModelObject* oldContinuation = continuation(); 346 347 setContinuation(newBox.get()); … … 355 356 } 356 357 357 RenderPtr<RenderInline> RenderInline::clone () const358 RenderPtr<RenderInline> RenderInline::cloneAsContinuation() const 358 359 { 359 360 RenderPtr<RenderInline> cloneInline = createRenderer<RenderInline>(*element(), RenderStyle::clone(style())); … … 361 362 cloneInline->setFragmentedFlowState(fragmentedFlowState()); 362 363 cloneInline->setHasOutlineAutoAncestor(hasOutlineAutoAncestor()); 364 cloneInline->setIsContinuation(); 363 365 return cloneInline; 364 366 } … … 369 371 { 370 372 // Create a clone of this inline. 371 RenderPtr<RenderInline> cloneInline = clone ();373 RenderPtr<RenderInline> cloneInline = cloneAsContinuation(); 372 374 #if ENABLE(FULLSCREEN_API) 373 375 // If we're splitting the inline containing the fullscreened element, … … 436 438 // Create a new clone. 437 439 RenderPtr<RenderInline> cloneChild = WTFMove(cloneInline); 438 cloneInline = downcast<RenderInline>(*current).clone ();440 cloneInline = downcast<RenderInline>(*current).cloneAsContinuation(); 439 441 440 442 // Insert our child clone as the first child. … … 1376 1378 // We have to split the parent flow. 1377 1379 auto newBox = containingBlock()->createAnonymousBlock(); 1380 newBox->setIsContinuation(); 1378 1381 RenderBoxModelObject* oldContinuation = continuation(); 1379 1382 setContinuation(newBox.get()); -
trunk/Source/WebCore/rendering/RenderInline.h
r223072 r223127 168 168 #endif 169 169 170 RenderPtr<RenderInline> clone () const;170 RenderPtr<RenderInline> cloneAsContinuation() const; 171 171 172 172 void paintOutlineForLine(GraphicsContext&, const LayoutPoint&, const LayoutRect& prevLine, const LayoutRect& thisLine, const LayoutRect& nextLine, const Color&); -
trunk/Source/WebCore/rendering/RenderObject.h
r223072 r223127 412 412 ; 413 413 } 414 bool isElementContinuation() const { return node() && node()->renderer() != this; }415 bool isInlineElementContinuation() const { return isElementContinuation() && isInline(); }416 bool isBlockElementContinuation() const { return isElementContinuation() && !isInline(); }417 414 418 415 bool isFloating() const { return m_bitfields.floating(); }
Note:
See TracChangeset
for help on using the changeset viewer.