Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 11 matching lines...) Expand all Loading... | |
| 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/OverflowEvent.h" | 31 #include "core/dom/OverflowEvent.h" |
| 32 #include "core/dom/Text.h" | |
| 32 #include "core/dom/shadow/ShadowRoot.h" | 33 #include "core/dom/shadow/ShadowRoot.h" |
| 33 #include "core/editing/Editor.h" | 34 #include "core/editing/Editor.h" |
| 34 #include "core/editing/FrameSelection.h" | 35 #include "core/editing/FrameSelection.h" |
| 35 #include "core/page/Frame.h" | 36 #include "core/page/Frame.h" |
| 36 #include "core/page/FrameView.h" | 37 #include "core/page/FrameView.h" |
| 37 #include "core/page/Page.h" | 38 #include "core/page/Page.h" |
| 38 #include "core/page/Settings.h" | 39 #include "core/page/Settings.h" |
| 39 #include "core/platform/graphics/FloatQuad.h" | 40 #include "core/platform/graphics/FloatQuad.h" |
| 40 #include "core/platform/graphics/GraphicsContextStateSaver.h" | 41 #include "core/platform/graphics/GraphicsContextStateSaver.h" |
| 41 #include "core/platform/graphics/transforms/TransformState.h" | 42 #include "core/platform/graphics/transforms/TransformState.h" |
| (...skipping 6675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6717 } | 6718 } |
| 6718 | 6719 |
| 6719 void RenderBlock::updateFirstLetter() | 6720 void RenderBlock::updateFirstLetter() |
| 6720 { | 6721 { |
| 6721 if (!document().styleSheetCollections()->usesFirstLetterRules()) | 6722 if (!document().styleSheetCollections()->usesFirstLetterRules()) |
| 6722 return; | 6723 return; |
| 6723 // Don't recur | 6724 // Don't recur |
| 6724 if (style()->styleType() == FIRST_LETTER) | 6725 if (style()->styleType() == FIRST_LETTER) |
| 6725 return; | 6726 return; |
| 6726 | 6727 |
| 6727 // FIXME: We need to destroy the first-letter object if it is no longer the first child. Need to find | |
| 6728 // an efficient way to check for that situation though before implementing a nything. | |
| 6729 RenderObject* firstLetterBlock = findFirstLetterBlock(this); | 6728 RenderObject* firstLetterBlock = findFirstLetterBlock(this); |
| 6730 if (!firstLetterBlock) | 6729 if (!firstLetterBlock) |
| 6731 return; | 6730 return; |
| 6732 | 6731 |
| 6733 // Drill into inlines looking for our first text child. | 6732 // Drill into inlines looking for our first text child. |
| 6734 RenderObject* currChild = firstLetterBlock->firstChild(); | 6733 RenderObject* currChild = firstLetterBlock->firstChild(); |
| 6735 while (currChild) { | 6734 while (currChild) { |
| 6736 if (currChild->isText()) | 6735 if (currChild->isText()) |
| 6737 break; | 6736 break; |
| 6738 if (currChild->isListMarker()) | 6737 if (currChild->isListMarker()) |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 6749 // We found a lower-level node with first-letter, which supersedes t he higher-level style | 6748 // We found a lower-level node with first-letter, which supersedes t he higher-level style |
| 6750 firstLetterBlock = currChild; | 6749 firstLetterBlock = currChild; |
| 6751 currChild = currChild->firstChild(); | 6750 currChild = currChild->firstChild(); |
| 6752 } else | 6751 } else |
| 6753 currChild = currChild->firstChild(); | 6752 currChild = currChild->firstChild(); |
| 6754 } | 6753 } |
| 6755 | 6754 |
| 6756 if (!currChild) | 6755 if (!currChild) |
| 6757 return; | 6756 return; |
| 6758 | 6757 |
| 6759 // If the child already has style, then it has already been created, so we j ust want | |
| 6760 // to update it. | |
| 6761 if (currChild->parent()->style()->styleType() == FIRST_LETTER) { | 6758 if (currChild->parent()->style()->styleType() == FIRST_LETTER) { |
| 6759 // Destroy the first-letter object if it is no longer the first child. | |
| 6760 RenderObject* remainingText = currChild->parent()->nextSibling(); | |
|
esprehn
2013/09/09 21:22:57
How do you know the currentCuild->parent() has a n
joone
2013/09/09 22:36:25
The currentChild is the firstLetter(RenderTextFrag
| |
| 6761 if (currChild->node() != remainingText->node()) { | |
| 6762 LayoutStateDisabler layoutStateDisabler(view()); | |
| 6763 | |
| 6764 RenderObject* oldRemainingText = toRenderBoxModelObject(currChild->p arent())->firstLetterRemainingText(); | |
| 6765 if (oldRemainingText) | |
| 6766 toRenderText(oldRemainingText)->setText(toText(oldRemainingText- >node())->data().impl()); | |
| 6767 | |
| 6768 createFirstLetterRenderer(firstLetterBlock, remainingText); | |
|
esprehn
2013/09/09 21:22:57
What destroyed the original RenderTextFragment tha
joone
2013/09/09 22:36:25
When setting a new text to RenderTextFragment(Rema
| |
| 6769 return; | |
| 6770 } | |
| 6771 | |
| 6772 // If the child already has style, then it has already been created, so we just want | |
| 6773 // to update it. | |
| 6762 updateFirstLetterStyle(firstLetterBlock, currChild); | 6774 updateFirstLetterStyle(firstLetterBlock, currChild); |
| 6763 return; | 6775 return; |
| 6764 } | 6776 } |
| 6765 | 6777 |
| 6766 if (!currChild->isText() || currChild->isBR()) | 6778 if (!currChild->isText() || currChild->isBR()) |
| 6767 return; | 6779 return; |
| 6768 | 6780 |
| 6769 // Our layout state is not valid for the repaints we are going to trigger by | 6781 // Our layout state is not valid for the repaints we are going to trigger by |
| 6770 // adding and removing children of firstLetterContainer. | 6782 // adding and removing children of firstLetterContainer. |
| 6771 LayoutStateDisabler layoutStateDisabler(view()); | 6783 LayoutStateDisabler layoutStateDisabler(view()); |
| (...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8034 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const | 8046 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const |
| 8035 { | 8047 { |
| 8036 showRenderObject(); | 8048 showRenderObject(); |
| 8037 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) | 8049 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) |
| 8038 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); | 8050 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); |
| 8039 } | 8051 } |
| 8040 | 8052 |
| 8041 #endif | 8053 #endif |
| 8042 | 8054 |
| 8043 } // namespace WebCore | 8055 } // namespace WebCore |
| OLD | NEW |