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

Side by Side Diff: trunk/Source/core/rendering/RenderBlock.cpp

Issue 25713009: Revert 158496 "Update the first letter when the first line is ch..." (Closed) Base URL: svn://svn.chromium.org/blink/
Patch Set: Created 7 years, 2 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
« no previous file with comments | « trunk/LayoutTests/fast/css/first-letter-block-change-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 10 matching lines...) Expand all
21 * Boston, MA 02110-1301, USA. 21 * Boston, MA 02110-1301, USA.
22 */ 22 */
23 23
24 #include "config.h" 24 #include "config.h"
25 #include "core/rendering/RenderBlock.h" 25 #include "core/rendering/RenderBlock.h"
26 26
27 #include "HTMLNames.h" 27 #include "HTMLNames.h"
28 #include "core/accessibility/AXObjectCache.h" 28 #include "core/accessibility/AXObjectCache.h"
29 #include "core/dom/Document.h" 29 #include "core/dom/Document.h"
30 #include "core/dom/Element.h" 30 #include "core/dom/Element.h"
31 #include "core/dom/Text.h"
32 #include "core/events/OverflowEvent.h" 31 #include "core/events/OverflowEvent.h"
33 #include "core/dom/shadow/ShadowRoot.h" 32 #include "core/dom/shadow/ShadowRoot.h"
34 #include "core/editing/Editor.h" 33 #include "core/editing/Editor.h"
35 #include "core/editing/FrameSelection.h" 34 #include "core/editing/FrameSelection.h"
36 #include "core/page/Frame.h" 35 #include "core/page/Frame.h"
37 #include "core/page/FrameView.h" 36 #include "core/page/FrameView.h"
38 #include "core/page/Page.h" 37 #include "core/page/Page.h"
39 #include "core/page/Settings.h" 38 #include "core/page/Settings.h"
40 #include "core/platform/graphics/GraphicsContextStateSaver.h" 39 #include "core/platform/graphics/GraphicsContextStateSaver.h"
41 #include "core/platform/graphics/transforms/TransformState.h" 40 #include "core/platform/graphics/transforms/TransformState.h"
(...skipping 5765 matching lines...) Expand 10 before | Expand all | Expand 10 after
5807 } 5806 }
5808 5807
5809 void RenderBlock::updateFirstLetter() 5808 void RenderBlock::updateFirstLetter()
5810 { 5809 {
5811 if (!document().styleEngine()->usesFirstLetterRules()) 5810 if (!document().styleEngine()->usesFirstLetterRules())
5812 return; 5811 return;
5813 // Don't recur 5812 // Don't recur
5814 if (style()->styleType() == FIRST_LETTER) 5813 if (style()->styleType() == FIRST_LETTER)
5815 return; 5814 return;
5816 5815
5816 // FIXME: We need to destroy the first-letter object if it is no longer the first child. Need to find
5817 // an efficient way to check for that situation though before implementing a nything.
5817 RenderObject* firstLetterBlock = findFirstLetterBlock(this); 5818 RenderObject* firstLetterBlock = findFirstLetterBlock(this);
5818 if (!firstLetterBlock) 5819 if (!firstLetterBlock)
5819 return; 5820 return;
5820 5821
5821 // Drill into inlines looking for our first text child. 5822 // Drill into inlines looking for our first text child.
5822 RenderObject* currChild = firstLetterBlock->firstChild(); 5823 RenderObject* currChild = firstLetterBlock->firstChild();
5823 while (currChild) { 5824 while (currChild) {
5824 if (currChild->isText()) 5825 if (currChild->isText())
5825 break; 5826 break;
5826 if (currChild->isListMarker()) 5827 if (currChild->isListMarker())
(...skipping 10 matching lines...) Expand all
5837 // We found a lower-level node with first-letter, which supersedes t he higher-level style 5838 // We found a lower-level node with first-letter, which supersedes t he higher-level style
5838 firstLetterBlock = currChild; 5839 firstLetterBlock = currChild;
5839 currChild = currChild->firstChild(); 5840 currChild = currChild->firstChild();
5840 } else 5841 } else
5841 currChild = currChild->firstChild(); 5842 currChild = currChild->firstChild();
5842 } 5843 }
5843 5844
5844 if (!currChild) 5845 if (!currChild)
5845 return; 5846 return;
5846 5847
5848 // If the child already has style, then it has already been created, so we j ust want
5849 // to update it.
5847 if (currChild->parent()->style()->styleType() == FIRST_LETTER) { 5850 if (currChild->parent()->style()->styleType() == FIRST_LETTER) {
5848 // Destroy the first-letter object if it is no longer the first child.
5849 RenderObject* remainingText = currChild->parent()->nextSibling();
5850 if (remainingText && currChild->node() != remainingText->node()) {
5851 if (!remainingText->isText() || remainingText->isBR())
5852 return;
5853
5854 LayoutStateDisabler layoutStateDisabler(view());
5855
5856 if (RenderObject* oldRemainingText = toRenderBoxModelObject(currChil d->parent())->firstLetterRemainingText())
joone 2013/10/03 18:25:32 What do you think about changing the code as follo
5857 toRenderText(oldRemainingText)->setText(toText(oldRemainingText- >node())->data().impl());
5858
5859 createFirstLetterRenderer(firstLetterBlock, remainingText);
5860 return;
5861 }
5862
5863 // If the child already has style, then it has already been created, so we just want
5864 // to update it.
5865 updateFirstLetterStyle(firstLetterBlock, currChild); 5851 updateFirstLetterStyle(firstLetterBlock, currChild);
5866 return; 5852 return;
5867 } 5853 }
5868 5854
5869 if (!currChild->isText() || currChild->isBR()) 5855 if (!currChild->isText() || currChild->isBR())
5870 return; 5856 return;
5871 5857
5872 // Our layout state is not valid for the repaints we are going to trigger by 5858 // Our layout state is not valid for the repaints we are going to trigger by
5873 // adding and removing children of firstLetterContainer. 5859 // adding and removing children of firstLetterContainer.
5874 LayoutStateDisabler layoutStateDisabler(view()); 5860 LayoutStateDisabler layoutStateDisabler(view());
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after
6815 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const 6801 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const
6816 { 6802 {
6817 showRenderObject(); 6803 showRenderObject();
6818 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 6804 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
6819 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 6805 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
6820 } 6806 }
6821 6807
6822 #endif 6808 #endif
6823 6809
6824 } // namespace WebCore 6810 } // namespace WebCore
OLDNEW
« no previous file with comments | « trunk/LayoutTests/fast/css/first-letter-block-change-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698