Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Side by Side Diff: Source/core/layout/LayoutBlock.cpp

Issue 1269123002: Preparation for combining paths of focus rings and outlines (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove debug from fast/css/focus-ring-recursive-continuations.html Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 2538 matching lines...) Expand 10 before | Expand all | Expand 10 after
2549 return LayoutBox::localCaretRect(inlineBox, caretOffset, extraWidthToEnd OfLine); 2549 return LayoutBox::localCaretRect(inlineBox, caretOffset, extraWidthToEnd OfLine);
2550 2550
2551 LayoutRect caretRect = localCaretRectForEmptyElement(size().width(), textInd entOffset()); 2551 LayoutRect caretRect = localCaretRectForEmptyElement(size().width(), textInd entOffset());
2552 2552
2553 if (extraWidthToEndOfLine) 2553 if (extraWidthToEndOfLine)
2554 *extraWidthToEndOfLine = size().width() - caretRect.maxX(); 2554 *extraWidthToEndOfLine = size().width() - caretRect.maxX();
2555 2555
2556 return caretRect; 2556 return caretRect;
2557 } 2557 }
2558 2558
2559 void LayoutBlock::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint & additionalOffset) const 2559 void LayoutBlock::addOutlineRects(Vector<LayoutRect>& rects, const LayoutPoint& additionalOffset) const
2560 { 2560 {
2561 // For blocks inside inlines, we go ahead and include margins so that we run right up to the 2561 // For blocks inside inlines, we go ahead and include margins so that we run right up to the
2562 // inline boxes above and below us (thus getting merged with them to form a single irregular 2562 // inline boxes above and below us (thus getting merged with them to form a single irregular
2563 // shape). 2563 // shape).
2564 const LayoutInline* inlineElementContinuation = this->inlineElementContinuat ion(); 2564 const LayoutInline* inlineElementContinuation = this->inlineElementContinuat ion();
2565 if (inlineElementContinuation) { 2565 if (inlineElementContinuation) {
2566 // FIXME: This check really isn't accurate. 2566 // FIXME: This check really isn't accurate.
2567 bool nextInlineHasLineBox = inlineElementContinuation->firstLineBox(); 2567 bool nextInlineHasLineBox = inlineElementContinuation->firstLineBox();
2568 // FIXME: This is wrong. The principal layoutObject may not be the conti nuation preceding this block. 2568 // FIXME: This is wrong. The principal layoutObject may not be the conti nuation preceding this block.
2569 // FIXME: This is wrong for vertical writing-modes. 2569 // FIXME: This is wrong for vertical writing-modes.
(...skipping 13 matching lines...) Expand all
2583 2583
2584 if (!hasOverflowClip() && !hasControlClip()) { 2584 if (!hasOverflowClip() && !hasControlClip()) {
2585 for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBo x()) { 2585 for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBo x()) {
2586 LayoutUnit top = std::max<LayoutUnit>(curr->lineTop(), curr->top()); 2586 LayoutUnit top = std::max<LayoutUnit>(curr->lineTop(), curr->top());
2587 LayoutUnit bottom = std::min<LayoutUnit>(curr->lineBottom(), curr->t op() + curr->height()); 2587 LayoutUnit bottom = std::min<LayoutUnit>(curr->lineBottom(), curr->t op() + curr->height());
2588 LayoutRect rect(additionalOffset.x() + curr->x(), additionalOffset.y () + top, curr->width(), bottom - top); 2588 LayoutRect rect(additionalOffset.x() + curr->x(), additionalOffset.y () + top, curr->width(), bottom - top);
2589 if (!rect.isEmpty()) 2589 if (!rect.isEmpty())
2590 rects.append(rect); 2590 rects.append(rect);
2591 } 2591 }
2592 2592
2593 addFocusRingRectsForNormalChildren(rects, additionalOffset); 2593 addOutlineRectsForNormalChildren(rects, additionalOffset);
2594 if (TrackedLayoutBoxListHashSet* positionedObjects = this->positionedObj ects()) { 2594 if (TrackedLayoutBoxListHashSet* positionedObjects = this->positionedObj ects()) {
2595 for (auto* box : *positionedObjects) 2595 for (auto* box : *positionedObjects)
2596 addFocusRingRectsForDescendant(*box, rects, additionalOffset); 2596 addOutlineRectsForDescendant(*box, rects, additionalOffset);
2597 } 2597 }
2598 } 2598 }
2599 2599
2600 if (inlineElementContinuation) { 2600 if (inlineElementContinuation) {
2601 Vector<LayoutRect> inlineFocusRingRects; 2601 Vector<LayoutRect> inlineOutlineRects;
2602 // We need to give the LayoutInline a clean vector to let it add focus r ing rects of line boxes. 2602 // We need to give the LayoutInline a clean vector to let it add focus r ing rects of line boxes.
2603 inlineElementContinuation->addFocusRingRects(inlineFocusRingRects, addit ionalOffset + (inlineElementContinuation->containingBlock()->location() - locati on())); 2603 inlineElementContinuation->addOutlineRects(inlineOutlineRects, additiona lOffset + (inlineElementContinuation->containingBlock()->location() - location() ));
2604 rects.appendVector(inlineFocusRingRects); 2604 rects.appendVector(inlineOutlineRects);
2605 } 2605 }
2606 } 2606 }
2607 2607
2608 void LayoutBlock::computeSelfHitTestRects(Vector<LayoutRect>& rects, const Layou tPoint& layerOffset) const 2608 void LayoutBlock::computeSelfHitTestRects(Vector<LayoutRect>& rects, const Layou tPoint& layerOffset) const
2609 { 2609 {
2610 LayoutBox::computeSelfHitTestRects(rects, layerOffset); 2610 LayoutBox::computeSelfHitTestRects(rects, layerOffset);
2611 2611
2612 if (hasHorizontalLayoutOverflow() || hasVerticalLayoutOverflow()) { 2612 if (hasHorizontalLayoutOverflow() || hasVerticalLayoutOverflow()) {
2613 for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBo x()) { 2613 for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBo x()) {
2614 LayoutUnit top = std::max<LayoutUnit>(curr->lineTop(), curr->top()); 2614 LayoutUnit top = std::max<LayoutUnit>(curr->lineTop(), curr->top());
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
2925 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const 2925 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const
2926 { 2926 {
2927 showLayoutObject(); 2927 showLayoutObject();
2928 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 2928 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
2929 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 2929 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
2930 } 2930 }
2931 2931
2932 #endif 2932 #endif
2933 2933
2934 } // namespace blink 2934 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698