Title: [121920] trunk/Source/WebCore
- Revision
- 121920
- Author
- commit-qu...@webkit.org
- Date
- 2012-07-05 12:57:22 -0700 (Thu, 05 Jul 2012)
Log Message
Text Autosizing: Add basic framework
https://bugs.webkit.org/show_bug.cgi?id=88655
Follow-up patch tweaking method signatures.
Patch by John Mellor <joh...@chromium.org> on 2012-07-05
Reviewed by Simon Fraser.
No functional change, so no new tests.
* page/FrameView.cpp:
(WebCore::FrameView::layout):
* rendering/TextAutosizer.cpp:
(WebCore::TextAutosizer::processSubtree):
(WebCore::TextAutosizer::processBlock):
(WebCore::TextAutosizer::processText):
(WebCore):
* rendering/TextAutosizer.h:
(TextAutosizer):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (121919 => 121920)
--- trunk/Source/WebCore/ChangeLog 2012-07-05 19:49:56 UTC (rev 121919)
+++ trunk/Source/WebCore/ChangeLog 2012-07-05 19:57:22 UTC (rev 121920)
@@ -1,3 +1,24 @@
+2012-07-05 John Mellor <joh...@chromium.org>
+
+ Text Autosizing: Add basic framework
+ https://bugs.webkit.org/show_bug.cgi?id=88655
+
+ Follow-up patch tweaking method signatures.
+
+ Reviewed by Simon Fraser.
+
+ No functional change, so no new tests.
+
+ * page/FrameView.cpp:
+ (WebCore::FrameView::layout):
+ * rendering/TextAutosizer.cpp:
+ (WebCore::TextAutosizer::processSubtree):
+ (WebCore::TextAutosizer::processBlock):
+ (WebCore::TextAutosizer::processText):
+ (WebCore):
+ * rendering/TextAutosizer.h:
+ (TextAutosizer):
+
2012-07-05 Pavel Feldman <pfeld...@chromium.org>
Web Inspector: move cursor to the current search match.
Modified: trunk/Source/WebCore/page/FrameView.cpp (121919 => 121920)
--- trunk/Source/WebCore/page/FrameView.cpp 2012-07-05 19:49:56 UTC (rev 121919)
+++ trunk/Source/WebCore/page/FrameView.cpp 2012-07-05 19:57:22 UTC (rev 121920)
@@ -1116,8 +1116,8 @@
forceLayoutParentViewIfNeeded();
root->layout();
#if ENABLE(TEXT_AUTOSIZING)
- bool boosted = document->textAutosizer()->boostSubtree(root);
- if (boosted && root->needsLayout())
+ bool autosized = document->textAutosizer()->processSubtree(root);
+ if (autosized && root->needsLayout())
root->layout();
#endif
endDeferredRepaints();
Modified: trunk/Source/WebCore/rendering/TextAutosizer.cpp (121919 => 121920)
--- trunk/Source/WebCore/rendering/TextAutosizer.cpp 2012-07-05 19:49:56 UTC (rev 121919)
+++ trunk/Source/WebCore/rendering/TextAutosizer.cpp 2012-07-05 19:57:22 UTC (rev 121920)
@@ -42,7 +42,7 @@
{
}
-bool TextAutosizer::boostSubtree(RenderObject* layoutRoot)
+bool TextAutosizer::processSubtree(RenderObject* layoutRoot)
{
// FIXME: Text Autosizing should only be enabled when m_document->page()->mainFrame()->view()->useFixedLayout()
// is true, but for now it's useful to ignore this so that it can be tested on desktop.
@@ -58,38 +58,38 @@
for (RenderObject* descendant = traverseNext(layoutRoot, layoutRoot); descendant; descendant = traverseNext(descendant, layoutRoot)) {
if (!treatAsInline(descendant))
- boostBlock(toRenderBlock(descendant), windowSize);
+ processBlock(toRenderBlock(descendant), windowSize);
}
return true;
}
-void TextAutosizer::boostBlock(RenderBlock* block, LayoutSize windowSize)
+void TextAutosizer::processBlock(RenderBlock* block, const IntSize& windowSize)
{
- float windowLogicalWidth = block->isHorizontalWritingMode() ? windowSize.width() : windowSize.height();
- float multiplier = block->logicalWidth() / windowLogicalWidth; // FIXME: This is overly simplistic.
+ int windowLogicalWidth = block->isHorizontalWritingMode() ? windowSize.width() : windowSize.height();
+ float multiplier = static_cast<float>(block->logicalWidth()) / windowLogicalWidth; // FIXME: This is overly simplistic.
if (multiplier < 1)
return;
for (RenderObject* descendant = traverseNext(block, block, treatAsInline); descendant; descendant = traverseNext(descendant, block, treatAsInline)) {
if (descendant->isText())
- boostText(toRenderText(descendant), multiplier);
+ processText(toRenderText(descendant), multiplier);
}
}
-void TextAutosizer::boostText(RenderText* text, float multiplier)
+void TextAutosizer::processText(RenderText* text, float multiplier)
{
float specifiedSize = text->style()->fontDescription().specifiedSize();
- float boostedSize = specifiedSize * multiplier; // FIXME: This is overly simplistic.
+ float newSize = specifiedSize * multiplier; // FIXME: This is overly simplistic.
RefPtr<RenderStyle> style = RenderStyle::clone(text->style());
FontDescription fontDescription(style->fontDescription());
- fontDescription.setComputedSize(boostedSize);
+ fontDescription.setComputedSize(newSize);
style->setFontDescription(fontDescription);
style->font().update(style->font().fontSelector());
text->setStyle(style.release());
// FIXME: Increase computed line height proportionately.
- // FIXME: Boost list markers proportionately.
+ // FIXME: Increase list marker size proportionately.
}
bool TextAutosizer::treatAsInline(const RenderObject* renderer)
@@ -97,6 +97,7 @@
return !renderer->isRenderBlock() || renderer->isListItem() || renderer->isInlineBlockOrInlineTable();
}
+// FIXME: Consider making this a method on RenderObject if it remains this generic.
RenderObject* TextAutosizer::traverseNext(RenderObject* current, const RenderObject* stayWithin, RenderObjectFilter filter)
{
for (RenderObject* child = current->firstChild(); child; child = child->nextSibling()) {
Modified: trunk/Source/WebCore/rendering/TextAutosizer.h (121919 => 121920)
--- trunk/Source/WebCore/rendering/TextAutosizer.h 2012-07-05 19:49:56 UTC (rev 121919)
+++ trunk/Source/WebCore/rendering/TextAutosizer.h 2012-07-05 19:57:22 UTC (rev 121920)
@@ -49,13 +49,13 @@
virtual ~TextAutosizer();
- bool boostSubtree(RenderObject* layoutRoot);
+ bool processSubtree(RenderObject* layoutRoot);
private:
explicit TextAutosizer(Document*);
- void boostBlock(RenderBlock*, LayoutSize windowSize);
- void boostText(RenderText*, float multiplier);
+ void processBlock(RenderBlock*, const IntSize& windowSize);
+ void processText(RenderText*, float multiplier);
typedef bool (*RenderObjectFilter)(const RenderObject*);
static bool treatAsInline(const RenderObject*);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes