[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

hyatt at apple.com hyatt at apple.com
Wed Dec 22 15:57:18 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 7174ce61317ceb71b7acf0a2ff7a5a5387d925c2
Author: hyatt at apple.com <hyatt at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Nov 17 04:13:06 2010 +0000

    Add a baselineType member to RootInlineBox that caches whether the default baseline behavior for that
    line should be ideographic or alphabetic.  Add a requiresIdeographicsBaseline recursive function to
    InlineFlowBox that scans for the use of any vertical fonts.
    
    Reviewed by Sam Weinig.
    
    * rendering/InlineFlowBox.cpp:
    (WebCore::InlineFlowBox::requiresIdeographicBaseline):
    * rendering/InlineFlowBox.h:
    * rendering/RootInlineBox.cpp:
    (WebCore::RootInlineBox::RootInlineBox):
    (WebCore::RootInlineBox::alignBoxesInBlockDirection):
    * rendering/RootInlineBox.h:
    (WebCore::RootInlineBox::baselineType):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72168 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index d9804d8..78d7042 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -2,6 +2,23 @@
 
         Reviewed by Sam Weinig.
 
+        Add a baselineType member to RootInlineBox that caches whether the default baseline behavior for that
+        line should be ideographic or alphabetic.  Add a requiresIdeographicsBaseline recursive function to
+        InlineFlowBox that scans for the use of any vertical fonts.
+
+        * rendering/InlineFlowBox.cpp:
+        (WebCore::InlineFlowBox::requiresIdeographicBaseline):
+        * rendering/InlineFlowBox.h:
+        * rendering/RootInlineBox.cpp:
+        (WebCore::RootInlineBox::RootInlineBox):
+        (WebCore::RootInlineBox::alignBoxesInBlockDirection):
+        * rendering/RootInlineBox.h:
+        (WebCore::RootInlineBox::baselineType):
+
+2010-11-16  Dave Hyatt  <hyatt at apple.com>
+
+        Reviewed by Sam Weinig.
+
         Add FontBaseline.h and make ascent and descent take a baseline parameter so that both an
         alphabetic and ideographic baseline can be requested.
 
diff --git a/WebCore/rendering/InlineFlowBox.cpp b/WebCore/rendering/InlineFlowBox.cpp
index f486695..90a2b82 100644
--- a/WebCore/rendering/InlineFlowBox.cpp
+++ b/WebCore/rendering/InlineFlowBox.cpp
@@ -359,6 +359,43 @@ int InlineFlowBox::placeBoxesInInlineDirection(int logicalLeft, bool& needsWordS
     return logicalLeft;
 }
 
+bool InlineFlowBox::requiresIdeographicBaseline(const GlyphOverflowAndFallbackFontsMap& textBoxDataMap) const
+{
+    if (isHorizontal())
+        return false;
+    
+    if (renderer()->style(m_firstLine)->font().primaryFont()->orientation() == Vertical)
+        return true;
+
+    for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) {
+        if (curr->renderer()->isPositioned())
+            continue; // Positioned placeholders don't affect calculations.
+        
+        if (curr->isInlineFlowBox()) {
+            if (static_cast<InlineFlowBox*>(curr)->requiresIdeographicBaseline(textBoxDataMap))
+                return true;
+        } else {
+            if (curr->renderer()->style(m_firstLine)->font().primaryFont()->orientation() == Vertical)
+                return true;
+            
+            const Vector<const SimpleFontData*>* usedFonts = 0;
+            if (curr->isInlineTextBox()) {
+                GlyphOverflowAndFallbackFontsMap::const_iterator it = textBoxDataMap.find(static_cast<InlineTextBox*>(curr));
+                usedFonts = it == textBoxDataMap.end() ? 0 : &it->second.first;
+            }
+
+            if (usedFonts) {
+                for (size_t i = 0; i < usedFonts->size(); ++i) {
+                    if (usedFonts->at(i)->orientation() == Vertical)
+                        return true;
+                }
+            }
+        }
+    }
+    
+    return false;
+}
+
 void InlineFlowBox::adjustMaxAscentAndDescent(int& maxAscent, int& maxDescent,
                                               int maxPositionTop, int maxPositionBottom)
 {
diff --git a/WebCore/rendering/InlineFlowBox.h b/WebCore/rendering/InlineFlowBox.h
index b37ef84..69e7604 100644
--- a/WebCore/rendering/InlineFlowBox.h
+++ b/WebCore/rendering/InlineFlowBox.h
@@ -162,7 +162,8 @@ public:
     void placeBoxesInBlockDirection(int logicalTop, int maxHeight, int maxAscent, bool strictMode, int& lineTop, int& lineBottom, bool& setLineTop);
     void flipLinesInBlockDirection(int lineTop, int lineBottom);
     void computeBlockDirectionOverflow(int lineTop, int lineBottom, bool strictMode, GlyphOverflowAndFallbackFontsMap&);
-
+    bool requiresIdeographicBaseline(const GlyphOverflowAndFallbackFontsMap&) const;
+    
     void removeChild(InlineBox* child);
 
     virtual RenderObject::SelectionState selectionState();
diff --git a/WebCore/rendering/RootInlineBox.cpp b/WebCore/rendering/RootInlineBox.cpp
index 00c2c51..ef79eb4 100644
--- a/WebCore/rendering/RootInlineBox.cpp
+++ b/WebCore/rendering/RootInlineBox.cpp
@@ -47,6 +47,7 @@ RootInlineBox::RootInlineBox(RenderBlock* block)
     , m_lineBottom(0)
     , m_paginationStrut(0)
     , m_blockLogicalHeight(0)
+    , m_baselineType(AlphabeticBaseline)
 {
     setIsHorizontal(block->style()->isHorizontalWritingMode());
 }
@@ -232,6 +233,8 @@ int RootInlineBox::alignBoxesInBlockDirection(int heightOfBlock, GlyphOverflowAn
     // Figure out if we're in no-quirks mode.
     bool noQuirksMode = renderer()->document()->inNoQuirksMode();
 
+    m_baselineType = requiresIdeographicBaseline(textBoxDataMap) ? IdeographicBaseline : AlphabeticBaseline;
+
     computeLogicalBoxHeights(maxPositionTop, maxPositionBottom, maxAscent, maxDescent, setMaxAscent, setMaxDescent, noQuirksMode, textBoxDataMap);
 
     if (maxAscent + maxDescent < max(maxPositionTop, maxPositionBottom))
diff --git a/WebCore/rendering/RootInlineBox.h b/WebCore/rendering/RootInlineBox.h
index 41ef630..e68345f 100644
--- a/WebCore/rendering/RootInlineBox.h
+++ b/WebCore/rendering/RootInlineBox.h
@@ -125,6 +125,8 @@ public:
     virtual void extractLineBoxFromRenderObject();
     virtual void attachLineBoxToRenderObject();
     virtual void removeLineBoxFromRenderObject();
+    
+    FontBaseline baselineType() const { return m_baselineType; }
 
 private:
     bool hasEllipsisBox() const { return m_hasEllipsisBoxOrHyphen; }
@@ -148,6 +150,9 @@ private:
     // The logical height of the block at the end of this line.  This is where the next line starts.
     int m_blockLogicalHeight;
 
+    // Whether or not this line uses alphabetic or ideographic baselines by default.
+    FontBaseline m_baselineType;
+    
     WTF::Unicode::Direction m_lineBreakBidiStatusEor : 5;
     WTF::Unicode::Direction m_lineBreakBidiStatusLastStrong : 5;
     WTF::Unicode::Direction m_lineBreakBidiStatusLast : 5;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list