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

Side by Side Diff: Source/core/rendering/RenderListMarker.cpp

Issue 182413005: Return refererence from InlineBox::root() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: re-upload because previous patch didn't upload correctly. Created 6 years, 9 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
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 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv ed. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv ed.
5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) 5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net)
6 * Copyright (C) 2010 Daniel Bates (dbates@intudata.com) 6 * Copyright (C) 2010 Daniel Bates (dbates@intudata.com)
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 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after
1109 bool RenderListMarker::isImage() const 1109 bool RenderListMarker::isImage() const
1110 { 1110 {
1111 return m_image && !m_image->errorOccurred(); 1111 return m_image && !m_image->errorOccurred();
1112 } 1112 }
1113 1113
1114 LayoutRect RenderListMarker::localSelectionRect() 1114 LayoutRect RenderListMarker::localSelectionRect()
1115 { 1115 {
1116 InlineBox* box = inlineBoxWrapper(); 1116 InlineBox* box = inlineBoxWrapper();
1117 if (!box) 1117 if (!box)
1118 return LayoutRect(LayoutPoint(), size()); 1118 return LayoutRect(LayoutPoint(), size());
1119 RootInlineBox* root = inlineBoxWrapper()->root(); 1119 RootInlineBox& root = inlineBoxWrapper()->root();
1120 LayoutUnit newLogicalTop = root->block().style()->isFlippedBlocksWritingMode () ? inlineBoxWrapper()->logicalBottom() - root->selectionBottom() : root->selec tionTop() - inlineBoxWrapper()->logicalTop(); 1120 LayoutUnit newLogicalTop = root.block().style()->isFlippedBlocksWritingMode( ) ? inlineBoxWrapper()->logicalBottom() - root.selectionBottom() : root.selectio nTop() - inlineBoxWrapper()->logicalTop();
1121 if (root->block().style()->isHorizontalWritingMode()) 1121 if (root.block().style()->isHorizontalWritingMode())
1122 return LayoutRect(0, newLogicalTop, width(), root->selectionHeight()); 1122 return LayoutRect(0, newLogicalTop, width(), root.selectionHeight());
1123 return LayoutRect(newLogicalTop, 0, root->selectionHeight(), height()); 1123 return LayoutRect(newLogicalTop, 0, root.selectionHeight(), height());
1124 } 1124 }
1125 1125
1126 void RenderListMarker::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffse t) 1126 void RenderListMarker::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffse t)
1127 { 1127 {
1128 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, this); 1128 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, this);
1129 1129
1130 if (paintInfo.phase != PaintPhaseForeground) 1130 if (paintInfo.phase != PaintPhaseForeground)
1131 return; 1131 return;
1132 1132
1133 if (style()->visibility() != VISIBLE) 1133 if (style()->visibility() != VISIBLE)
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
1818 1818
1819 return relativeRect; 1819 return relativeRect;
1820 } 1820 }
1821 1821
1822 void RenderListMarker::setSelectionState(SelectionState state) 1822 void RenderListMarker::setSelectionState(SelectionState state)
1823 { 1823 {
1824 // The selection state for our containing block hierarchy is updated by the base class call. 1824 // The selection state for our containing block hierarchy is updated by the base class call.
1825 RenderBox::setSelectionState(state); 1825 RenderBox::setSelectionState(state);
1826 1826
1827 if (inlineBoxWrapper() && canUpdateSelectionOnRootLineBoxes()) 1827 if (inlineBoxWrapper() && canUpdateSelectionOnRootLineBoxes())
1828 if (RootInlineBox* root = inlineBoxWrapper()->root()) 1828 inlineBoxWrapper()->root().setHasSelectedChildren(state != SelectionNone );
1829 root->setHasSelectedChildren(state != SelectionNone);
1830 } 1829 }
1831 1830
1832 LayoutRect RenderListMarker::selectionRectForRepaint(const RenderLayerModelObjec t* repaintContainer, bool clipToVisibleContent) 1831 LayoutRect RenderListMarker::selectionRectForRepaint(const RenderLayerModelObjec t* repaintContainer, bool clipToVisibleContent)
1833 { 1832 {
1834 ASSERT(!needsLayout()); 1833 ASSERT(!needsLayout());
1835 1834
1836 if (selectionState() == SelectionNone || !inlineBoxWrapper()) 1835 if (selectionState() == SelectionNone || !inlineBoxWrapper())
1837 return LayoutRect(); 1836 return LayoutRect();
1838 1837
1839 RootInlineBox* root = inlineBoxWrapper()->root(); 1838 RootInlineBox& root = inlineBoxWrapper()->root();
1840 LayoutRect rect(0, root->selectionTop() - y(), width(), root->selectionHeigh t()); 1839 LayoutRect rect(0, root.selectionTop() - y(), width(), root.selectionHeight( ));
1841 1840
1842 if (clipToVisibleContent) 1841 if (clipToVisibleContent)
1843 computeRectForRepaint(repaintContainer, rect); 1842 computeRectForRepaint(repaintContainer, rect);
1844 else 1843 else
1845 rect = localToContainerQuad(FloatRect(rect), repaintContainer).enclosing BoundingBox(); 1844 rect = localToContainerQuad(FloatRect(rect), repaintContainer).enclosing BoundingBox();
1846 1845
1847 return rect; 1846 return rect;
1848 } 1847 }
1849 1848
1850 } // namespace WebCore 1849 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698