| 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 10 matching lines...) Expand all Loading... |
| 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/fetch/ResourceLoadPriorityOptimizer.h" | 35 #include "core/fetch/ResourceLoadPriorityOptimizer.h" |
| 37 #include "core/frame/Frame.h" | 36 #include "core/frame/Frame.h" |
| 38 #include "core/frame/FrameView.h" | 37 #include "core/frame/FrameView.h" |
| 39 #include "core/page/Page.h" | 38 #include "core/page/Page.h" |
| 40 #include "core/frame/Settings.h" | 39 #include "core/frame/Settings.h" |
| 41 #include "core/rendering/FastTextAutosizer.h" | 40 #include "core/rendering/FastTextAutosizer.h" |
| (...skipping 4819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4861 } | 4860 } |
| 4862 | 4861 |
| 4863 void RenderBlock::updateFirstLetter() | 4862 void RenderBlock::updateFirstLetter() |
| 4864 { | 4863 { |
| 4865 if (!document().styleEngine()->usesFirstLetterRules()) | 4864 if (!document().styleEngine()->usesFirstLetterRules()) |
| 4866 return; | 4865 return; |
| 4867 // Don't recur | 4866 // Don't recur |
| 4868 if (style()->styleType() == FIRST_LETTER) | 4867 if (style()->styleType() == FIRST_LETTER) |
| 4869 return; | 4868 return; |
| 4870 | 4869 |
| 4870 // FIXME: We need to destroy the first-letter object if it is no longer the
first child. Need to find |
| 4871 // an efficient way to check for that situation though before implementing a
nything. |
| 4871 RenderObject* firstLetterBlock = findFirstLetterBlock(this); | 4872 RenderObject* firstLetterBlock = findFirstLetterBlock(this); |
| 4872 if (!firstLetterBlock) | 4873 if (!firstLetterBlock) |
| 4873 return; | 4874 return; |
| 4874 | 4875 |
| 4875 // Drill into inlines looking for our first text child. | 4876 // Drill into inlines looking for our first text child. |
| 4876 RenderObject* currChild = firstLetterBlock->firstChild(); | 4877 RenderObject* currChild = firstLetterBlock->firstChild(); |
| 4877 unsigned length = 0; | 4878 unsigned length = 0; |
| 4878 while (currChild) { | 4879 while (currChild) { |
| 4879 if (currChild->isText()) { | 4880 if (currChild->isText()) { |
| 4880 // FIXME: If there is leading punctuation in a different RenderText
than | 4881 // FIXME: If there is leading punctuation in a different RenderText
than |
| (...skipping 16 matching lines...) Expand all Loading... |
| 4897 // We found a lower-level node with first-letter, which supersedes t
he higher-level style | 4898 // We found a lower-level node with first-letter, which supersedes t
he higher-level style |
| 4898 firstLetterBlock = currChild; | 4899 firstLetterBlock = currChild; |
| 4899 currChild = currChild->firstChild(); | 4900 currChild = currChild->firstChild(); |
| 4900 } else | 4901 } else |
| 4901 currChild = currChild->firstChild(); | 4902 currChild = currChild->firstChild(); |
| 4902 } | 4903 } |
| 4903 | 4904 |
| 4904 if (!currChild) | 4905 if (!currChild) |
| 4905 return; | 4906 return; |
| 4906 | 4907 |
| 4908 // If the child already has style, then it has already been created, so we j
ust want |
| 4909 // to update it. |
| 4907 if (currChild->parent()->style()->styleType() == FIRST_LETTER) { | 4910 if (currChild->parent()->style()->styleType() == FIRST_LETTER) { |
| 4908 // Check if the text fragment(currChild) for the first-letter is not rel
ated to the remainingText. | |
| 4909 RenderObject* remainingText = currChild->parent()->nextSibling(); | |
| 4910 if (remainingText && remainingText->node() && currChild->node() != remai
ningText->node()) { | |
| 4911 if (!remainingText->isText() || remainingText->isBR()) | |
| 4912 return; | |
| 4913 | |
| 4914 if (RenderBoxModelObject* oldFirstLetter = currChild->parent()->isBo
xModelObject() ? toRenderBoxModelObject(currChild->parent()) : 0) { | |
| 4915 if (RenderTextFragment* oldRemainingText = oldFirstLetter->first
LetterRemainingText()) { | |
| 4916 LayoutStateDisabler layoutStateDisabler(view()); | |
| 4917 // Destroy the text fragment for the old first-letter and up
date oldRemainingText with its DOM text. | |
| 4918 oldRemainingText->setText(toText(oldRemainingText->node())->
data().impl()); | |
| 4919 | |
| 4920 if (unsigned newLength = firstLetterLength(toRenderText(rema
iningText)->originalText())) | |
| 4921 createFirstLetterRenderer(firstLetterBlock, remainingTex
t, newLength); | |
| 4922 } | |
| 4923 } | |
| 4924 | |
| 4925 return; | |
| 4926 } | |
| 4927 | |
| 4928 // If the child already has style, then it has already been created, so
we just want | |
| 4929 // to update it. | |
| 4930 updateFirstLetterStyle(firstLetterBlock, currChild); | 4911 updateFirstLetterStyle(firstLetterBlock, currChild); |
| 4931 return; | 4912 return; |
| 4932 } | 4913 } |
| 4933 | 4914 |
| 4934 if (!currChild->isText() || currChild->isBR()) | 4915 if (!currChild->isText() || currChild->isBR()) |
| 4935 return; | 4916 return; |
| 4936 | 4917 |
| 4937 // Our layout state is not valid for the repaints we are going to trigger by | 4918 // Our layout state is not valid for the repaints we are going to trigger by |
| 4938 // adding and removing children of firstLetterContainer. | 4919 // adding and removing children of firstLetterContainer. |
| 4939 LayoutStateDisabler layoutStateDisabler(view()); | 4920 LayoutStateDisabler layoutStateDisabler(view()); |
| (...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5818 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const | 5799 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const |
| 5819 { | 5800 { |
| 5820 showRenderObject(); | 5801 showRenderObject(); |
| 5821 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 5802 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
| 5822 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 5803 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
| 5823 } | 5804 } |
| 5824 | 5805 |
| 5825 #endif | 5806 #endif |
| 5826 | 5807 |
| 5827 } // namespace WebCore | 5808 } // namespace WebCore |
| OLD | NEW |