Changeset 70330 in webkit
- Timestamp:
- Oct 22, 2010 1:29:21 PM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r70327 r70330 1 2010-10-22 David Hyatt <hyatt@apple.com> 2 3 Reviewed by Sam Weinig. 4 5 https://bugs.webkit.org/show_bug.cgi?id=48149 6 7 Update block direction line overflow computation to be writing-mode-aware. 8 9 * rendering/InlineBox.h: 10 (WebCore::InlineBox::logicalBottom): 11 * rendering/InlineFlowBox.cpp: 12 (WebCore::InlineFlowBox::computeBlockDirectionOverflow): 13 * rendering/InlineFlowBox.h: 14 (WebCore::InlineFlowBox::setInlineDirectionOverflowPositions): 15 (WebCore::InlineFlowBox::setBlockDirectionOverflowPositions): 16 * rendering/RenderBlockLineLayout.cpp: 17 (WebCore::RenderBlock::layoutInlineChildren): 18 * rendering/RenderBox.cpp: 19 (WebCore::RenderBox::blockDirectionOverflow): 20 * rendering/RenderBox.h: 21 * rendering/RootInlineBox.cpp: 22 (WebCore::RootInlineBox::addHighlightOverflow): 23 * rendering/style/RenderStyle.h: 24 (WebCore::InheritedFlags::getTextShadowBlockDirectionExtent): 25 (WebCore::InheritedFlags::getBoxShadowBlockDirectionExtent): 26 (WebCore::InheritedFlags::getShadowBlockDirectionExtent): 27 1 28 2010-10-22 Adam Barth <abarth@webkit.org> 2 29 -
trunk/WebCore/rendering/InlineBox.h
r70072 r70330 230 230 // The logicalTop[ position is the top edge of the line box in a horizontal line and the left edge in a vertical line. 231 231 int logicalTop() const { return !m_isVertical ? m_y : m_x; } 232 int logicalBottom() const { return logicalTop() + logicalHeight(); } 232 233 void setLogicalTop(int top) 233 234 { -
trunk/WebCore/rendering/InlineFlowBox.cpp
r70263 r70330 563 563 void InlineFlowBox::computeBlockDirectionOverflow(int lineTop, int lineBottom, bool strictMode, GlyphOverflowAndFallbackFontsMap& textBoxDataMap) 564 564 { 565 bool isFlippedLine = renderer()->style(m_firstLine)->isFlippedLinesWritingMode(); 566 565 567 int boxHeight = logicalHeight(); 566 568 567 569 // Any spillage outside of the line top and bottom is not considered overflow. We just ignore this, since it only happens 568 570 // from the "your ascent/descent don't affect the line" quirk. 569 int topOverflow = max( y(), lineTop);570 int bottomOverflow = min( y() + boxHeight, lineBottom);571 int topOverflow = max(logicalTop(), lineTop); 572 int bottomOverflow = min(logicalTop() + boxHeight, lineBottom); 571 573 572 574 int topLayoutOverflow = topOverflow; … … 580 582 int boxShadowTop; 581 583 int boxShadowBottom; 582 renderer()->style(m_firstLine)->getBoxShadow VerticalExtent(boxShadowTop, boxShadowBottom);584 renderer()->style(m_firstLine)->getBoxShadowBlockDirectionExtent(boxShadowTop, boxShadowBottom); 583 585 584 topVisualOverflow = min( y() + boxShadowTop, topVisualOverflow);585 bottomVisualOverflow = max( y() + boxHeight + boxShadowBottom, bottomVisualOverflow);586 topVisualOverflow = min(logicalTop() + boxShadowTop, topVisualOverflow); 587 bottomVisualOverflow = max(logicalTop() + boxHeight + boxShadowBottom, bottomVisualOverflow); 586 588 } 587 589 … … 601 603 GlyphOverflow* glyphOverflow = it == textBoxDataMap.end() ? 0 : &it->second.second; 602 604 603 int topGlyphOverflow = -strokeOverflow - (glyphOverflow ? glyphOverflow->top : 0); 604 int bottomGlyphOverflow = strokeOverflow + (glyphOverflow ? glyphOverflow->bottom : 0); 605 606 int childOverflowTop = topGlyphOverflow; 607 int childOverflowBottom = bottomGlyphOverflow; 608 for (const ShadowData* shadow = rt->style()->textShadow(); shadow; shadow = shadow->next()) { 609 childOverflowTop = min(childOverflowTop, shadow->y() - shadow->blur() + topGlyphOverflow); 610 childOverflowBottom = max(childOverflowBottom, shadow->y() + shadow->blur() + bottomGlyphOverflow); 611 } 612 613 topVisualOverflow = min(curr->y() + childOverflowTop, topVisualOverflow); 614 bottomVisualOverflow = max(curr->y() + text->logicalHeight() + childOverflowBottom, bottomVisualOverflow); 605 int topGlyphEdge = glyphOverflow ? (isFlippedLine ? glyphOverflow->bottom : glyphOverflow->top) : 0; 606 int bottomGlyphEdge = glyphOverflow ? (isFlippedLine ? glyphOverflow->top : glyphOverflow->bottom) : 0; 607 608 int topGlyphOverflow = -strokeOverflow - topGlyphEdge; 609 int bottomGlyphOverflow = strokeOverflow + bottomGlyphEdge; 610 611 int textShadowTop; 612 int textShadowBottom; 613 curr->renderer()->style(m_firstLine)->getTextShadowBlockDirectionExtent(textShadowTop, textShadowBottom); 614 615 int childOverflowTop = min(textShadowTop, topGlyphOverflow); 616 int childOverflowBottom = max(textShadowBottom, bottomGlyphOverflow); 617 618 topVisualOverflow = min(curr->logicalTop() + childOverflowTop, topVisualOverflow); 619 bottomVisualOverflow = max(curr->logicalTop() + text->logicalHeight() + childOverflowBottom, bottomVisualOverflow); 615 620 } else if (curr->renderer()->isRenderInline()) { 616 621 InlineFlowBox* flow = static_cast<InlineFlowBox*>(curr); … … 622 627 } else if (!curr->boxModelObject()->hasSelfPaintingLayer()){ 623 628 // Only include overflow from replaced inlines if they do not paint themselves. 629 int boxLogicalTop = curr->logicalTop(); 630 int childTopLayoutOverflow; 631 int childBottomLayoutOverflow; 632 int childTopVisualOverflow; 633 int childBottomVisualOverflow; 634 624 635 RenderBox* box = toRenderBox(curr->renderer()); 625 int boxY = curr->y();626 int childTopOverflow = box->hasOverflowClip() ? 0 : box->topLayoutOverflow();627 int childBottomOverflow = box->hasOverflowClip() ? curr->logicalHeight() : box->bottomLayoutOverflow();628 topLayoutOverflow = min(box Y + childTopOverflow, topLayoutOverflow);629 bottomLayoutOverflow = max(box Y + childBottomOverflow, bottomLayoutOverflow);630 topVisualOverflow = min(box Y + box->topVisualOverflow(), topVisualOverflow);631 bottomVisualOverflow = max(box Y + box->bottomVisualOverflow(), bottomVisualOverflow);632 } 633 } 634 635 setBlockDirectionOverflowPositions(topLayoutOverflow, bottomLayoutOverflow, topVisualOverflow, bottomVisualOverflow , boxHeight);636 box->blockDirectionOverflow(isVertical(), isFlippedLine, childTopLayoutOverflow, childBottomLayoutOverflow, 637 childTopVisualOverflow, childBottomVisualOverflow); 638 639 topLayoutOverflow = min(boxLogicalTop + childTopLayoutOverflow, topLayoutOverflow); 640 bottomLayoutOverflow = max(boxLogicalTop + childBottomLayoutOverflow, bottomLayoutOverflow); 641 topVisualOverflow = min(boxLogicalTop + childTopVisualOverflow, topVisualOverflow); 642 bottomVisualOverflow = max(boxLogicalTop + childBottomVisualOverflow, bottomVisualOverflow); 643 } 644 } 645 646 setBlockDirectionOverflowPositions(topLayoutOverflow, bottomLayoutOverflow, topVisualOverflow, bottomVisualOverflow); 636 647 } 637 648 -
trunk/WebCore/rendering/InlineFlowBox.h
r70263 r70330 200 200 int logicalLeftVisualOverflow, int logicalRightVisualOverflow); 201 201 void setBlockDirectionOverflowPositions(int logicalTopLayoutOverflow, int logicalBottomLayoutOverflow, 202 int logicalTopVisualOverflow, int logicalBottomVisualOverflow , int boxLogicalHeight);202 int logicalTopVisualOverflow, int logicalBottomVisualOverflow); 203 203 204 204 protected: … … 230 230 return; 231 231 232 int width = isVertical() ? m_renderer->style(m_firstLine)->font().height() : logicalWidth();233 int height = isVertical() ? logicalWidth() : m_renderer->style(m_firstLine)->font().height();232 int width = isVertical() ? logicalHeight() : logicalWidth(); 233 int height = isVertical() ? logicalWidth() : logicalHeight(); 234 234 235 235 m_overflow = adoptPtr(new RenderOverflow(IntRect(m_x, m_y, width, height))); … … 249 249 } 250 250 251 inline void InlineFlowBox::setBlockDirectionOverflowPositions(int topLayoutOverflow, int bottomLayoutOverflow, int topVisualOverflow, int bottomVisualOverflow, int boxHeight) 251 inline void InlineFlowBox::setBlockDirectionOverflowPositions(int logicalTopLayoutOverflow, int logicalBottomLayoutOverflow, 252 int logicalTopVisualOverflow, int logicalBottomVisualOverflow) 252 253 { 253 254 if (!m_overflow) { 254 if (topLayoutOverflow == m_y && bottomLayoutOverflow == m_y + boxHeight && topVisualOverflow == m_y && bottomVisualOverflow == m_y + boxHeight) 255 if (logicalTopLayoutOverflow == logicalTop() && logicalBottomLayoutOverflow == logicalBottom() 256 && logicalTopVisualOverflow == logicalTop() && logicalBottomVisualOverflow == logicalBottom()) 255 257 return; 256 m_overflow = adoptPtr(new RenderOverflow(IntRect(m_x, m_y, m_logicalWidth, boxHeight))); 257 } 258 259 m_overflow->setTopLayoutOverflow(topLayoutOverflow); 260 m_overflow->setBottomLayoutOverflow(bottomLayoutOverflow); 261 m_overflow->setTopVisualOverflow(topVisualOverflow); 262 m_overflow->setBottomVisualOverflow(bottomVisualOverflow); 258 259 int width = isVertical() ? logicalHeight() : logicalWidth(); 260 int height = isVertical() ? logicalWidth() : logicalHeight(); 261 262 m_overflow = adoptPtr(new RenderOverflow(IntRect(m_x, m_y, width, height))); 263 } 264 265 if (!isVertical()) { 266 m_overflow->setTopLayoutOverflow(logicalTopLayoutOverflow); 267 m_overflow->setBottomLayoutOverflow(logicalBottomLayoutOverflow); 268 m_overflow->setTopVisualOverflow(logicalTopVisualOverflow); 269 m_overflow->setBottomVisualOverflow(logicalBottomVisualOverflow); 270 } else { 271 m_overflow->setLeftLayoutOverflow(logicalTopLayoutOverflow); 272 m_overflow->setRightLayoutOverflow(logicalBottomLayoutOverflow); 273 m_overflow->setLeftVisualOverflow(logicalTopVisualOverflow); 274 m_overflow->setRightVisualOverflow(logicalBottomVisualOverflow); 275 } 263 276 } 264 277 -
trunk/WebCore/rendering/RenderBlockLineLayout.cpp
r70158 r70330 879 879 GlyphOverflowAndFallbackFontsMap textBoxDataMap; 880 880 trailingFloatsLineBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap); 881 trailingFloatsLineBox->setBlockDirectionOverflowPositions(logicalHeight(), bottomLayoutOverflow, logicalHeight(), bottomVisualOverflow , 0);881 trailingFloatsLineBox->setBlockDirectionOverflowPositions(logicalHeight(), bottomLayoutOverflow, logicalHeight(), bottomVisualOverflow); 882 882 trailingFloatsLineBox->setBlockLogicalHeight(logicalHeight()); 883 883 } -
trunk/WebCore/rendering/RenderBox.cpp
r70170 r70330 3173 3173 } 3174 3174 3175 void RenderBox::blockDirectionOverflow(bool isLineVertical, bool isFlippedLine, int& logicalTopLayoutOverflow, int& logicalBottomLayoutOverflow, 3176 int& logicalTopVisualOverflow, int& logicalBottomVisualOverflow) 3177 { 3178 if (isLineVertical) { 3179 if (isFlippedLine) { 3180 logicalTopLayoutOverflow = leftLayoutOverflow(); 3181 logicalBottomLayoutOverflow = rightLayoutOverflow(); 3182 logicalTopVisualOverflow = leftVisualOverflow(); 3183 logicalBottomVisualOverflow = rightVisualOverflow(); 3184 } else { 3185 logicalTopLayoutOverflow = rightLayoutOverflow(); 3186 logicalBottomLayoutOverflow = leftLayoutOverflow(); 3187 logicalTopVisualOverflow = rightVisualOverflow(); 3188 logicalBottomVisualOverflow = leftVisualOverflow(); 3189 } 3190 } else { 3191 if (isFlippedLine) { 3192 logicalTopLayoutOverflow = bottomLayoutOverflow(); 3193 logicalBottomLayoutOverflow = topLayoutOverflow(); 3194 logicalTopVisualOverflow = bottomVisualOverflow(); 3195 logicalBottomVisualOverflow = topVisualOverflow(); 3196 } else { 3197 logicalTopLayoutOverflow = topLayoutOverflow(); 3198 logicalBottomLayoutOverflow = bottomLayoutOverflow(); 3199 logicalTopVisualOverflow = topVisualOverflow(); 3200 logicalBottomVisualOverflow = bottomVisualOverflow(); 3201 } 3202 } 3203 } 3204 3175 3205 } // namespace WebCore -
trunk/WebCore/rendering/RenderBox.h
r70170 r70330 156 156 void clearLayoutOverflow(); 157 157 158 void blockDirectionOverflow(bool isLineVertical, bool isFlippedLine, int& logicalTopLayoutOverflow, int& logicalBottomLayoutOverflow, 159 int& logicalTopVisualOverflow, int& logicalBottomVisualOverflow); 160 158 161 int contentWidth() const { return clientWidth() - paddingLeft() - paddingRight(); } 159 162 int contentHeight() const { return clientHeight() - paddingTop() - paddingBottom(); } -
trunk/WebCore/rendering/RootInlineBox.cpp
r69801 r70330 150 150 IntRect inflatedRect = enclosingIntRect(page->chrome()->client()->customHighlightRect(renderer()->node(), renderer()->style()->highlight(), rootRect)); 151 151 setInlineDirectionOverflowPositions(leftLayoutOverflow(), rightLayoutOverflow(), min(leftVisualOverflow(), inflatedRect.x()), max(rightVisualOverflow(), inflatedRect.right())); 152 setBlockDirectionOverflowPositions(topLayoutOverflow(), bottomLayoutOverflow(), min(topVisualOverflow(), inflatedRect.y()), max(bottomVisualOverflow(), inflatedRect.bottom()) , logicalHeight());152 setBlockDirectionOverflowPositions(topLayoutOverflow(), bottomLayoutOverflow(), min(topVisualOverflow(), inflatedRect.y()), max(bottomVisualOverflow(), inflatedRect.bottom())); 153 153 } 154 154 -
trunk/WebCore/rendering/style/RenderStyle.h
r70172 r70330 642 642 void getTextShadowVerticalExtent(int& top, int& bottom) const { getShadowVerticalExtent(textShadow(), top, bottom); } 643 643 void getTextShadowInlineDirectionExtent(int& logicalLeft, int& logicalRight) { getShadowInlineDirectionExtent(textShadow(), logicalLeft, logicalRight); } 644 void getTextShadowBlockDirectionExtent(int& logicalTop, int& logicalBottom) { getShadowBlockDirectionExtent(textShadow(), logicalTop, logicalBottom); } 644 645 645 646 float textStrokeWidth() const { return rareInheritedData->textStrokeWidth; } … … 661 662 void getBoxShadowVerticalExtent(int& top, int& bottom) const { getShadowVerticalExtent(boxShadow(), top, bottom); } 662 663 void getBoxShadowInlineDirectionExtent(int& logicalLeft, int& logicalRight) { getShadowInlineDirectionExtent(boxShadow(), logicalLeft, logicalRight); } 664 void getBoxShadowBlockDirectionExtent(int& logicalTop, int& logicalBottom) { getShadowBlockDirectionExtent(boxShadow(), logicalTop, logicalBottom); } 663 665 664 666 StyleReflection* boxReflect() const { return rareNonInheritedData->m_boxReflect.get(); } … … 1278 1280 return isHorizontalWritingMode() ? getShadowHorizontalExtent(shadow, logicalLeft, logicalRight) : getShadowVerticalExtent(shadow, logicalLeft, logicalRight); 1279 1281 } 1282 void getShadowBlockDirectionExtent(const ShadowData* shadow, int& logicalTop, int& logicalBottom) const 1283 { 1284 return isHorizontalWritingMode() ? getShadowVerticalExtent(shadow, logicalTop, logicalBottom) : getShadowHorizontalExtent(shadow, logicalTop, logicalBottom); 1285 } 1280 1286 1281 1287 // Color accessors are all private to make sure callers use visitedDependentColor instead to access them.
Note: See TracChangeset
for help on using the changeset viewer.