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

Side by Side Diff: Source/WebCore/rendering/RenderBlock.cpp

Issue 10538049: Merge 118711 - Can't edit <input> elements with :first-letter (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1132/
Patch Set: Created 8 years, 6 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 * (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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 100
101 typedef WTF::HashMap<const RenderBox*, HashSet<RenderBlock*>*> PercentHeightCont ainerMap; 101 typedef WTF::HashMap<const RenderBox*, HashSet<RenderBlock*>*> PercentHeightCont ainerMap;
102 static PercentHeightContainerMap* gPercentHeightContainerMap = 0; 102 static PercentHeightContainerMap* gPercentHeightContainerMap = 0;
103 103
104 typedef WTF::HashMap<RenderBlock*, ListHashSet<RenderInline*>*> ContinuationOutl ineTableMap; 104 typedef WTF::HashMap<RenderBlock*, ListHashSet<RenderInline*>*> ContinuationOutl ineTableMap;
105 105
106 typedef WTF::HashSet<RenderBlock*> DelayedUpdateScrollInfoSet; 106 typedef WTF::HashSet<RenderBlock*> DelayedUpdateScrollInfoSet;
107 static int gDelayUpdateScrollInfo = 0; 107 static int gDelayUpdateScrollInfo = 0;
108 static DelayedUpdateScrollInfoSet* gDelayedUpdateScrollInfoSet = 0; 108 static DelayedUpdateScrollInfoSet* gDelayedUpdateScrollInfoSet = 0;
109 109
110 // We only create "generated" renderers like one for first-letter and
111 // before/after pseudo elements if:
112 // - the firstLetterBlock can have children in the DOM and
113 // - the block doesn't have any special assumption on its text children.
114 // This correctly prevents form controls from having such renderers.
115 static inline bool canHaveGeneratedChildren(RenderObject* renderer)
116 {
117 return (renderer->canHaveChildren()
118 && (!renderer->isDeprecatedFlexibleBox()
119 || static_cast<RenderDeprecatedFlexibleBox*>(renderer)->canHaveG eneratedChildren()));
120 }
121
122 bool RenderBlock::s_canPropagateFloatIntoSibling = false; 110 bool RenderBlock::s_canPropagateFloatIntoSibling = false;
123 111
124 // This class helps dispatching the 'overflow' event on layout change. overflow can be set on RenderBoxes, yet the existing code 112 // This class helps dispatching the 'overflow' event on layout change. overflow can be set on RenderBoxes, yet the existing code
125 // only works on RenderBlocks. If this change, this class should be shared with other RenderBoxes. 113 // only works on RenderBlocks. If this change, this class should be shared with other RenderBoxes.
126 class OverflowEventDispatcher { 114 class OverflowEventDispatcher {
127 WTF_MAKE_NONCOPYABLE(OverflowEventDispatcher); 115 WTF_MAKE_NONCOPYABLE(OverflowEventDispatcher);
128 public: 116 public:
129 OverflowEventDispatcher(const RenderBlock* block) 117 OverflowEventDispatcher(const RenderBlock* block)
130 : m_block(block) 118 : m_block(block)
131 , m_hadHorizontalLayoutOverflow(false) 119 , m_hadHorizontalLayoutOverflow(false)
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 currCont->setContinuation(0); 320 currCont->setContinuation(0);
333 currCont->setStyle(style()); 321 currCont->setStyle(style());
334 currCont->setContinuation(nextCont); 322 currCont->setContinuation(nextCont);
335 } 323 }
336 } 324 }
337 325
338 propagateStyleToAnonymousChildren(true); 326 propagateStyleToAnonymousChildren(true);
339 m_lineHeight = -1; 327 m_lineHeight = -1;
340 328
341 // Update pseudos for :before and :after now. 329 // Update pseudos for :before and :after now.
342 if (!isAnonymous() && document()->usesBeforeAfterRules() && canHaveGenerated Children(this)) { 330 if (!isAnonymous() && document()->usesBeforeAfterRules() && canHaveGenerated Children()) {
343 updateBeforeAfterContent(BEFORE); 331 updateBeforeAfterContent(BEFORE);
344 updateBeforeAfterContent(AFTER); 332 updateBeforeAfterContent(AFTER);
345 } 333 }
346 334
347 // After our style changed, if we lose our ability to propagate floats into next sibling 335 // After our style changed, if we lose our ability to propagate floats into next sibling
348 // blocks, then we need to find the top most parent containing that overhang ing float and 336 // blocks, then we need to find the top most parent containing that overhang ing float and
349 // then mark its descendants with floats for layout and clear all floats fro m its next 337 // then mark its descendants with floats for layout and clear all floats fro m its next
350 // sibling blocks that exist in our floating objects list. See bug 56299 and 62875. 338 // sibling blocks that exist in our floating objects list. See bug 56299 and 62875.
351 bool canPropagateFloatIntoSibling = !isFloatingOrPositioned() && !avoidsFloa ts(); 339 bool canPropagateFloatIntoSibling = !isFloatingOrPositioned() && !avoidsFloa ts();
352 if (diff == StyleDifferenceLayout && s_canPropagateFloatIntoSibling && !canP ropagateFloatIntoSibling && hasOverhangingFloats()) { 340 if (diff == StyleDifferenceLayout && s_canPropagateFloatIntoSibling && !canP ropagateFloatIntoSibling && hasOverhangingFloats()) {
(...skipping 5632 matching lines...) Expand 10 before | Expand all | Expand 10 after
5985 static inline bool shouldSkipForFirstLetter(UChar c) 5973 static inline bool shouldSkipForFirstLetter(UChar c)
5986 { 5974 {
5987 return isSpaceOrNewline(c) || c == noBreakSpace || isPunctuationForFirstLett er(c); 5975 return isSpaceOrNewline(c) || c == noBreakSpace || isPunctuationForFirstLett er(c);
5988 } 5976 }
5989 5977
5990 static inline RenderObject* findFirstLetterBlock(RenderBlock* start) 5978 static inline RenderObject* findFirstLetterBlock(RenderBlock* start)
5991 { 5979 {
5992 RenderObject* firstLetterBlock = start; 5980 RenderObject* firstLetterBlock = start;
5993 while (true) { 5981 while (true) {
5994 bool canHaveFirstLetterRenderer = firstLetterBlock->style()->hasPseudoSt yle(FIRST_LETTER) 5982 bool canHaveFirstLetterRenderer = firstLetterBlock->style()->hasPseudoSt yle(FIRST_LETTER)
5995 && canHaveGeneratedChildren(firstLetterBlock); 5983 && firstLetterBlock->canHaveGeneratedChildren();
5996 if (canHaveFirstLetterRenderer) 5984 if (canHaveFirstLetterRenderer)
5997 return firstLetterBlock; 5985 return firstLetterBlock;
5998 5986
5999 RenderObject* parentBlock = firstLetterBlock->parent(); 5987 RenderObject* parentBlock = firstLetterBlock->parent();
6000 if (firstLetterBlock->isReplaced() || !parentBlock || parentBlock->first Child() != firstLetterBlock || 5988 if (firstLetterBlock->isReplaced() || !parentBlock || parentBlock->first Child() != firstLetterBlock ||
6001 !parentBlock->isBlockFlow()) 5989 !parentBlock->isBlockFlow())
6002 return 0; 5990 return 0;
6003 firstLetterBlock = parentBlock; 5991 firstLetterBlock = parentBlock;
6004 } 5992 }
6005 5993
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
6144 if (currChild->isListMarker()) 6132 if (currChild->isListMarker())
6145 currChild = currChild->nextSibling(); 6133 currChild = currChild->nextSibling();
6146 else if (currChild->isFloatingOrPositioned()) { 6134 else if (currChild->isFloatingOrPositioned()) {
6147 if (currChild->style()->styleType() == FIRST_LETTER) { 6135 if (currChild->style()->styleType() == FIRST_LETTER) {
6148 currChild = currChild->firstChild(); 6136 currChild = currChild->firstChild();
6149 break; 6137 break;
6150 } 6138 }
6151 currChild = currChild->nextSibling(); 6139 currChild = currChild->nextSibling();
6152 } else if (currChild->isReplaced() || currChild->isRenderButton() || cur rChild->isMenuList()) 6140 } else if (currChild->isReplaced() || currChild->isRenderButton() || cur rChild->isMenuList())
6153 break; 6141 break;
6154 else if (currChild->style()->hasPseudoStyle(FIRST_LETTER) && canHaveGene ratedChildren(currChild)) { 6142 else if (currChild->style()->hasPseudoStyle(FIRST_LETTER) && currChild-> canHaveGeneratedChildren()) {
6155 // We found a lower-level node with first-letter, which supersedes t he higher-level style 6143 // We found a lower-level node with first-letter, which supersedes t he higher-level style
6156 firstLetterBlock = currChild; 6144 firstLetterBlock = currChild;
6157 currChild = currChild->firstChild(); 6145 currChild = currChild->firstChild();
6158 } else 6146 } else
6159 currChild = currChild->firstChild(); 6147 currChild = currChild->firstChild();
6160 } 6148 }
6161 6149
6162 if (!currChild) 6150 if (!currChild)
6163 return; 6151 return;
6164 6152
(...skipping 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after
7397 } 7385 }
7398 7386
7399 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl oatingObject* floatingObject) 7387 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl oatingObject* floatingObject)
7400 { 7388 {
7401 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->pi xelSnappedX(), floatingObject->pixelSnappedY(), floatingObject->pixelSnappedMaxX (), floatingObject->pixelSnappedMaxY()); 7389 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->pi xelSnappedX(), floatingObject->pixelSnappedY(), floatingObject->pixelSnappedMaxX (), floatingObject->pixelSnappedMaxY());
7402 } 7390 }
7403 7391
7404 #endif 7392 #endif
7405 7393
7406 } // namespace WebCore 7394 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/forms/input-first-letter-edit-expected.html ('k') | Source/WebCore/rendering/RenderDeprecatedFlexibleBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698