Changeset 157810 in webkit
- Timestamp:
- Oct 22, 2013, 2:03:38 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 31 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r157808 r157810 1 2013-10-22 Antti Koivisto <antti@apple.com> 2 3 Rename some line box functions to be just about lines 4 https://bugs.webkit.org/show_bug.cgi?id=123168 5 6 Reviewed by Dave Hyatt. 7 8 firstLineBoxBaseline -> firstLineBaseline 9 hasInlineBoxChildren -> hasLines 10 11 Also use hasLines in a bunch of places where firstLineBox() was used. 12 13 * accessibility/AccessibilityRenderObject.cpp: 14 (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored): 15 16 Also use hasRenderedText() instead of firstTextBox() 17 18 * rendering/RenderFullScreen.cpp: 19 20 Fix namespace. 21 1 22 2013-10-22 Thiago de Barros Lacerda <thiago.lacerda@openbossa.org> 2 23 -
trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp
r157705 r157810 1167 1167 if (parent && (parent->isMenuItem() || parent->ariaRoleAttribute() == MenuButtonRole)) 1168 1168 return true; 1169 RenderText* renderText = toRenderText(m_renderer);1170 if (!renderText ->firstTextBox())1169 auto& renderText = toRenderText(*m_renderer); 1170 if (!renderText.hasRenderedText()) 1171 1171 return true; 1172 1172 … … 1178 1178 1179 1179 // text elements that are just empty whitespace should not be returned 1180 return renderText ->text()->containsOnlyWhitespace();1180 return renderText.text()->containsOnlyWhitespace(); 1181 1181 } 1182 1182 … … 1232 1232 1233 1233 if (m_renderer->isRenderBlockFlow() && m_renderer->childrenInline() && !canSetFocusAttribute()) 1234 return !toRenderBlockFlow(m_renderer)-> firstLineBox() && !mouseButtonListener();1234 return !toRenderBlockFlow(m_renderer)->hasLines() && !mouseButtonListener(); 1235 1235 1236 1236 // ignore images seemingly used as spacers -
trunk/Source/WebCore/rendering/InlineTextBox.cpp
r157514 r157810 466 466 467 467 // The emphasis marks over are suppressed only if there is a ruby text box and it not empty. 468 return !rubyText || !rubyText-> firstLineBox();468 return !rubyText || !rubyText->hasLines(); 469 469 } 470 470 -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r157793 r157810 1196 1196 // line boxes, then we can't be self-collapsing, since we have content. 1197 1197 if (childrenInline()) 1198 return !has InlineBoxChildren();1198 return !hasLines(); 1199 1199 1200 1200 // Whether or not we collapse is dependent on whether all our normal flow children … … 4618 4618 } 4619 4619 4620 int RenderBlock::firstLineB oxBaseline() const4620 int RenderBlock::firstLineBaseline() const 4621 4621 { 4622 4622 if (isWritingModeRoot() && !isRubyRun()) … … 4625 4625 for (RenderBox* curr = firstChildBox(); curr; curr = curr->nextSiblingBox()) { 4626 4626 if (!curr->isFloatingOrOutOfFlowPositioned()) { 4627 int result = curr->firstLineB oxBaseline();4627 int result = curr->firstLineBaseline(); 4628 4628 if (result != -1) 4629 4629 return curr->logicalTop() + result; // Translate to our coordinate space. … … 4640 4640 4641 4641 bool haveNormalFlowChild = false; 4642 for ( RenderBox* curr = lastChildBox(); curr; curr = curr->previousSiblingBox()) {4643 if ( !curr->isFloatingOrOutOfFlowPositioned()) {4644 haveNormalFlowChild = true;4645 int result = curr->inlineBlockBaseline(lineDirection);4646 if (result != -1)4647 return curr->logicalTop() + result; // Translate to our coordinate space.4648 }4642 for (auto box = lastChildBox(); box; box = box->previousSiblingBox()) { 4643 if (box->isFloatingOrOutOfFlowPositioned()) 4644 continue; 4645 haveNormalFlowChild = true; 4646 int result = box->inlineBlockBaseline(lineDirection); 4647 if (result != -1) 4648 return box->logicalTop() + result; // Translate to our coordinate space. 4649 4649 } 4650 4650 4651 4651 if (!haveNormalFlowChild && hasLineIfEmpty()) { 4652 const FontMetrics& fontMetrics = firstLineStyle()->fontMetrics();4652 auto& fontMetrics = firstLineStyle()->fontMetrics(); 4653 4653 return fontMetrics.ascent() 4654 4654 + (lineHeight(true, lineDirection, PositionOfInteriorLineBoxes) - fontMetrics.height()) / 2 -
trunk/Source/WebCore/rendering/RenderBlock.h
r157793 r157810 459 459 void adjustIntrinsicLogicalWidthsForColumns(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const; 460 460 461 virtual int firstLineB oxBaseline() const OVERRIDE;461 virtual int firstLineBaseline() const OVERRIDE; 462 462 virtual int inlineBlockBaseline(LineDirectionMode) const OVERRIDE; 463 463 … … 542 542 virtual bool isSelfCollapsingBlock() const OVERRIDE FINAL; 543 543 // FIXME-BLOCKFLOW: Remove virtualizaion when all callers have moved to RenderBlockFlow 544 virtual bool has InlineBoxChildren() const { return false; }544 virtual bool hasLines() const { return false; } 545 545 546 546 void insertIntoTrackedRendererMaps(RenderBox* descendant, TrackedDescendantsMap*&, TrackedContainerMap*&); -
trunk/Source/WebCore/rendering/RenderBlockFlow.cpp
r157793 r157810 2489 2489 } 2490 2490 2491 int RenderBlockFlow::firstLineB oxBaseline() const2491 int RenderBlockFlow::firstLineBaseline() const 2492 2492 { 2493 2493 if (isWritingModeRoot() && !isRubyRun()) … … 2495 2495 2496 2496 if (!childrenInline()) 2497 return RenderBlock::firstLineB oxBaseline();2497 return RenderBlock::firstLineBaseline(); 2498 2498 2499 2499 if (firstLineBox()) … … 2511 2511 return RenderBlock::inlineBlockBaseline(lineDirection); 2512 2512 2513 if (!firstLineBox() && hasLineIfEmpty()) { 2513 if (!hasLines()) { 2514 if (!hasLineIfEmpty()) 2515 return -1; 2514 2516 const FontMetrics& fontMetrics = firstLineStyle()->fontMetrics(); 2515 2517 return fontMetrics.ascent() … … 2518 2520 } 2519 2521 2520 if (lastLineBox()) { 2521 bool isFirstLine = lastLineBox() == firstLineBox(); 2522 RenderStyle* style = isFirstLine ? firstLineStyle() : this->style(); 2523 return lastLineBox()->logicalTop() + style->fontMetrics().ascent(lastRootBox()->baselineType()); 2524 } 2525 return -1; 2522 bool isFirstLine = lastLineBox() == firstLineBox(); 2523 RenderStyle* style = isFirstLine ? firstLineStyle() : this->style(); 2524 return lastLineBox()->logicalTop() + style->fontMetrics().ascent(lastRootBox()->baselineType()); 2526 2525 } 2527 2526 … … 2533 2532 bool containsStart = selectionState() == SelectionStart || selectionState() == SelectionBoth; 2534 2533 2535 if (! firstLineBox()) {2534 if (!hasLines()) { 2536 2535 if (containsStart) { 2537 2536 // Go ahead and update our lastLogicalTop to be the bottom of the block. <hr>s or empty blocks with height can trip this -
trunk/Source/WebCore/rendering/RenderBlockFlow.h
r157793 r157810 308 308 RootInlineBox* lastRootBox() const { return static_cast<RootInlineBox*>(lastLineBox()); } 309 309 310 virtual bool has InlineBoxChildren() const OVERRIDE FINAL { return firstLineBox(); }310 virtual bool hasLines() const OVERRIDE FINAL { return firstLineBox(); } 311 311 312 312 // Helper methods for computing line counts and heights for line counts. … … 365 365 void createFloatingObjects(); 366 366 367 virtual int firstLineB oxBaseline() const OVERRIDE;367 virtual int firstLineBaseline() const OVERRIDE; 368 368 virtual int inlineBlockBaseline(LineDirectionMode) const OVERRIDE; 369 369 -
trunk/Source/WebCore/rendering/RenderBox.h
r157408 r157810 509 509 RenderLayer* enclosingFloatPaintingLayer() const; 510 510 511 virtual int firstLineB oxBaseline() const { return -1; }511 virtual int firstLineBaseline() const { return -1; } 512 512 virtual int inlineBlockBaseline(LineDirectionMode) const { return -1; } // Returns -1 if we should skip this box when computing the baseline of an inline-block. 513 513 -
trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp
r157793 r157810 442 442 // Update our height and overflow height. 443 443 if (style()->boxAlign() == BBASELINE) { 444 LayoutUnit ascent = child->firstLineB oxBaseline();444 LayoutUnit ascent = child->firstLineBaseline(); 445 445 if (ascent == -1) 446 446 ascent = child->height() + child->marginBottom(); … … 520 520 break; 521 521 case BBASELINE: { 522 LayoutUnit ascent = child->firstLineB oxBaseline();522 LayoutUnit ascent = child->firstLineBaseline(); 523 523 if (ascent == -1) 524 524 ascent = child->height() + child->marginBottom(); -
trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp
r157793 r157810 242 242 int RenderFlexibleBox::baselinePosition(FontBaseline, bool, LineDirectionMode direction, LinePositionMode) const 243 243 { 244 int baseline = firstLineB oxBaseline();244 int baseline = firstLineBaseline(); 245 245 if (baseline == -1) 246 246 baseline = synthesizedBaselineFromContentBox(this, direction); … … 250 250 } 251 251 252 int RenderFlexibleBox::firstLineB oxBaseline() const252 int RenderFlexibleBox::firstLineBaseline() const 253 253 { 254 254 if (isWritingModeRoot() || m_numberOfInFlowChildrenOnFirstLine <= 0) … … 279 279 return mainAxisExtentForChild(baselineChild) + baselineChild->logicalTop(); 280 280 281 int baseline = baselineChild->firstLineB oxBaseline();281 int baseline = baselineChild->firstLineBaseline(); 282 282 if (baseline == -1) { 283 283 // FIXME: We should pass |direction| into firstLineBoxBaseline and stop bailing out if we're a writing mode root. … … 292 292 int RenderFlexibleBox::inlineBlockBaseline(LineDirectionMode direction) const 293 293 { 294 int baseline = firstLineB oxBaseline();294 int baseline = firstLineBaseline(); 295 295 if (baseline != -1) 296 296 return baseline; … … 895 895 LayoutUnit RenderFlexibleBox::marginBoxAscentForChild(RenderBox* child) 896 896 { 897 LayoutUnit ascent = child->firstLineB oxBaseline();897 LayoutUnit ascent = child->firstLineBaseline(); 898 898 if (ascent == -1) 899 899 ascent = crossAxisExtentForChild(child); -
trunk/Source/WebCore/rendering/RenderFlexibleBox.h
r157408 r157810 50 50 51 51 virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const OVERRIDE; 52 virtual int firstLineB oxBaseline() const OVERRIDE;52 virtual int firstLineBaseline() const OVERRIDE; 53 53 virtual int inlineBlockBaseline(LineDirectionMode) const OVERRIDE; 54 54 -
trunk/Source/WebCore/rendering/RenderFullScreen.cpp
r157683 r157810 36 36 #endif 37 37 38 using namespace WebCore; 38 namespace WebCore { 39 39 40 40 class RenderFullScreenPlaceholder FINAL : public RenderBlockFlow { … … 186 186 } 187 187 188 } 189 188 190 #endif -
trunk/Source/WebCore/rendering/RenderMenuList.h
r157515 r157810 123 123 return RenderBlock::baselinePosition(baseline, firstLine, direction, position); 124 124 } 125 virtual int firstLineB oxBaseline() const OVERRIDE { return RenderBlock::firstLineBoxBaseline(); }125 virtual int firstLineBaseline() const OVERRIDE { return RenderBlock::firstLineBaseline(); } 126 126 virtual int inlineBlockBaseline(LineDirectionMode direction) const OVERRIDE { return RenderBlock::inlineBlockBaseline(direction); } 127 127 -
trunk/Source/WebCore/rendering/RenderTable.cpp
r157665 r157810 1336 1336 int RenderTable::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const 1337 1337 { 1338 LayoutUnit baseline = firstLineB oxBaseline();1338 LayoutUnit baseline = firstLineBaseline(); 1339 1339 if (baseline != -1) 1340 1340 return baseline; … … 1349 1349 } 1350 1350 1351 int RenderTable::firstLineB oxBaseline() const1351 int RenderTable::firstLineBaseline() const 1352 1352 { 1353 1353 // The baseline of a 'table' is the same as the 'inline-table' baseline per CSS 3 Flexbox (CSS 2.1 … … 1364 1364 return -1; 1365 1365 1366 int baseline = topNonEmptySection->firstLineB oxBaseline();1366 int baseline = topNonEmptySection->firstLineBaseline(); 1367 1367 if (baseline > 0) 1368 1368 return topNonEmptySection->logicalTop() + baseline; -
trunk/Source/WebCore/rendering/RenderTable.h
r157408 r157810 285 285 286 286 virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const OVERRIDE FINAL; 287 virtual int firstLineB oxBaseline() const OVERRIDE;287 virtual int firstLineBaseline() const OVERRIDE; 288 288 virtual int inlineBlockBaseline(LineDirectionMode) const OVERRIDE FINAL; 289 289 -
trunk/Source/WebCore/rendering/RenderTableCell.cpp
r157683 r157810 398 398 // the first in-flow line box in the cell, or the first in-flow table-row in the cell, whichever comes first. If there 399 399 // is no such line box or table-row, the baseline is the bottom of content edge of the cell box. 400 LayoutUnit firstLineBaseline = firstLineBoxBaseline();401 if ( firstLineBaseline != -1)402 return firstLineBaseline;400 LayoutUnit baseline = firstLineBaseline(); 401 if (baseline != -1) 402 return baseline; 403 403 return borderAndPaddingBefore() + contentLogicalHeight(); 404 404 } -
trunk/Source/WebCore/rendering/RenderTableSection.cpp
r157665 r157810 916 916 } 917 917 918 int RenderTableSection::firstLineB oxBaseline() const918 int RenderTableSection::firstLineBaseline() const 919 919 { 920 920 if (!m_grid.size()) -
trunk/Source/WebCore/rendering/RenderTableSection.h
r157579 r157810 74 74 virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0) OVERRIDE; 75 75 76 virtual int firstLineB oxBaseline() const OVERRIDE;76 virtual int firstLineBaseline() const OVERRIDE; 77 77 78 78 void addCell(RenderTableCell*, RenderTableRow* row); -
trunk/Source/WebCore/rendering/RenderTextControl.h
r157694 r157810 115 115 return RenderBlock::baselinePosition(baseline, firstLine, direction, position); 116 116 } 117 virtual int firstLineB oxBaseline() const OVERRIDE { return RenderBlock::firstLineBoxBaseline(); }117 virtual int firstLineBaseline() const OVERRIDE { return RenderBlock::firstLineBaseline(); } 118 118 virtual int inlineBlockBaseline(LineDirectionMode direction) const OVERRIDE { return RenderBlock::inlineBlockBaseline(direction); } 119 119 -
trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp
r157665 r157810 75 75 return 0; 76 76 77 LayoutUnit baseline = firstLineB oxBaseline(); // FIXME: This may be unnecessary after flex baselines are implemented (https://bugs.webkit.org/show_bug.cgi?id=96188).77 LayoutUnit baseline = firstLineBaseline(); // FIXME: This may be unnecessary after flex baselines are implemented (https://bugs.webkit.org/show_bug.cgi?id=96188). 78 78 if (baseline != -1) 79 79 return baseline; … … 302 302 } 303 303 304 int RenderMathMLTable::firstLineB oxBaseline() const305 { 306 // In legal MathML, we'll have a MathML parent. That RenderFlexibleBox parent will use our firstLineB oxBaseline() for baseline alignment, per304 int RenderMathMLTable::firstLineBaseline() const 305 { 306 // In legal MathML, we'll have a MathML parent. That RenderFlexibleBox parent will use our firstLineBaseline() for baseline alignment, per 307 307 // http://dev.w3.org/csswg/css3-flexbox/#flex-baselines. We want to vertically center an <mtable>, such as a matrix. Essentially the whole <mtable> element fits on a 308 308 // single line, whose baseline gives this centering. This is different than RenderTable::firstLineBoxBaseline, which returns the baseline of the first row of a <table>. -
trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.h
r157509 r157810 108 108 } 109 109 110 virtual int firstLineB oxBaseline() const OVERRIDE;110 virtual int firstLineBaseline() const OVERRIDE; 111 111 112 112 private: -
trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp
r157791 r157810 160 160 } 161 161 162 int RenderMathMLFraction::firstLineB oxBaseline() const162 int RenderMathMLFraction::firstLineBaseline() const 163 163 { 164 164 if (RenderBox* denominatorWrapper = lastChildBox()) 165 165 return denominatorWrapper->logicalTop() + static_cast<int>(lroundf((m_lineThickness + style()->fontMetrics().xHeight()) / 2)); 166 return RenderMathMLBlock::firstLineB oxBaseline();166 return RenderMathMLBlock::firstLineBaseline(); 167 167 } 168 168 -
trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.h
r157791 r157810 48 48 virtual void addChild(RenderObject* child, RenderObject* beforeChild) OVERRIDE; 49 49 virtual void updateFromElement() OVERRIDE; 50 virtual int firstLineB oxBaseline() const OVERRIDE;50 virtual int firstLineBaseline() const OVERRIDE; 51 51 virtual void paint(PaintInfo&, const LayoutPoint&) OVERRIDE; 52 52 virtual RenderMathMLOperator* unembellishedOperator() OVERRIDE; -
trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp
r157665 r157810 266 266 } 267 267 268 int RenderMathMLOperator::firstLineB oxBaseline() const268 int RenderMathMLOperator::firstLineBaseline() const 269 269 { 270 270 if (m_isStretched) 271 271 return expandedStretchHeight() * 2 / 3 - (expandedStretchHeight() - m_stretchHeight) / 2; 272 return RenderMathMLBlock::firstLineB oxBaseline();272 return RenderMathMLBlock::firstLineBaseline(); 273 273 } 274 274 -
trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h
r157599 r157810 71 71 virtual void computePreferredLogicalWidths() OVERRIDE; 72 72 virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues&) const OVERRIDE; 73 virtual int firstLineB oxBaseline() const OVERRIDE;73 virtual int firstLineBaseline() const OVERRIDE; 74 74 virtual RenderMathMLOperator* unembellishedOperator() OVERRIDE { return this; } 75 75 -
trunk/Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp
r157665 r157810 280 280 281 281 LayoutUnit baseHeight = base->logicalHeight(); 282 LayoutUnit baseBaseline = base->firstLineB oxBaseline();282 LayoutUnit baseBaseline = base->firstLineBaseline(); 283 283 if (baseBaseline == -1) 284 284 baseBaseline = baseHeight; … … 314 314 if (RenderBox* superscript = m_kind == Sub ? 0 : subSupPair->lastChildBox()) { 315 315 LayoutUnit superscriptHeight = superscript->logicalHeight(); 316 LayoutUnit superscriptBaseline = superscript->firstLineB oxBaseline();316 LayoutUnit superscriptBaseline = superscript->firstLineBaseline(); 317 317 if (superscriptBaseline == -1) 318 318 superscriptBaseline = superscriptHeight; … … 324 324 if (RenderBox* subscript = m_kind == Super ? 0 : subSupPair->firstChildBox()) { 325 325 LayoutUnit subscriptHeight = subscript->logicalHeight(); 326 LayoutUnit subscriptBaseline = subscript->firstLineB oxBaseline();326 LayoutUnit subscriptBaseline = subscript->firstLineBaseline(); 327 327 if (subscriptBaseline == -1) 328 328 subscriptBaseline = subscriptHeight; … … 356 356 } 357 357 358 int RenderMathMLScripts::firstLineB oxBaseline() const358 int RenderMathMLScripts::firstLineBaseline() const 359 359 { 360 360 if (m_baseWrapper) { 361 LayoutUnit baseline = m_baseWrapper->firstLineB oxBaseline();361 LayoutUnit baseline = m_baseWrapper->firstLineBaseline(); 362 362 if (baseline != -1) 363 363 return baseline; 364 364 } 365 return RenderMathMLBlock::firstLineB oxBaseline();365 return RenderMathMLBlock::firstLineBaseline(); 366 366 } 367 367 -
trunk/Source/WebCore/rendering/mathml/RenderMathMLScripts.h
r157515 r157810 103 103 104 104 virtual RenderMathMLOperator* unembellishedOperator(); 105 virtual int firstLineB oxBaseline() const OVERRIDE;105 virtual int firstLineBaseline() const OVERRIDE; 106 106 107 107 protected: -
trunk/Source/WebCore/rendering/mathml/RenderMathMLSpace.cpp
r157613 r157810 92 92 } 93 93 94 int RenderMathMLSpace::firstLineB oxBaseline() const94 int RenderMathMLSpace::firstLineBaseline() const 95 95 { 96 96 return m_height; -
trunk/Source/WebCore/rendering/mathml/RenderMathMLSpace.h
r157613 r157810 46 46 virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const OVERRIDE; 47 47 virtual void updateFromElement() OVERRIDE; 48 virtual int firstLineB oxBaseline() const OVERRIDE;48 virtual int firstLineBaseline() const OVERRIDE; 49 49 virtual void updateLogicalWidth() OVERRIDE; 50 50 virtual void updateLogicalHeight() OVERRIDE; -
trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp
r157408 r157810 58 58 } 59 59 60 int RenderMathMLUnderOver::firstLineB oxBaseline() const60 int RenderMathMLUnderOver::firstLineBaseline() const 61 61 { 62 62 RenderBox* base = firstChildBox(); 63 63 if (!base) 64 64 return -1; 65 LayoutUnit baseline = base->firstLineB oxBaseline();65 LayoutUnit baseline = base->firstLineBaseline(); 66 66 if (baseline != -1) 67 67 baseline += base->logicalTop(); -
trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.h
r157408 r157810 39 39 virtual RenderMathMLOperator* unembellishedOperator(); 40 40 41 virtual int firstLineB oxBaseline() const OVERRIDE;41 virtual int firstLineBaseline() const OVERRIDE; 42 42 43 43 private:
Note:
See TracChangeset
for help on using the changeset viewer.