Changeset 95350 in webkit


Ignore:
Timestamp:
Sep 16, 2011 6:36:07 PM (13 years ago)
Author:
haraken@google.com
Message:

Overhangs a ruby by no more than half the width of the neighboring text.
https://bugs.webkit.org/show_bug.cgi?id=62684

Reviewed by Dan Bernstein.

Assume two rubies between which a narrow text exists, like
"<ruby>x<rt>xxxxxx</rt></ruby>l<ruby>y<rt>yyyyyy</rt></ruby>".
In order to avoid the two rubies overlapping with each other,
this patch overhangs the ruby by no more than half the ruby font
size and no more than half the width of the neighboring text.

Source/WebCore:

Tests: fast/ruby/overhang-horizontal-no-overlap1.html

fast/ruby/overhang-horizontal-no-overlap2.html
fast/ruby/overhang-vertical-no-overlap1.html
fast/ruby/overhang-vertical-no-overlap2.html

  • rendering/RenderRubyRun.cpp:

(WebCore::RenderRubyRun::getOverhang): Calculates the width of ruby overhanging.

LayoutTests:

  • fast/ruby/overhang-horizontal-no-overlap1-expected.png: Added.
  • fast/ruby/overhang-horizontal-no-overlap1-expected.txt: Added.
  • fast/ruby/overhang-horizontal-no-overlap1.html: Added. Tests if two rubies do not overlap with each other when a narrow text exists between the two rubies. Split into two test files in order to fit each test result within one page.
  • fast/ruby/overhang-horizontal-no-overlap2-expected.png: Added.
  • fast/ruby/overhang-horizontal-no-overlap2-expected.txt: Added.
  • fast/ruby/overhang-horizontal-no-overlap2.html: Added. Tests if two rubies do not overlap with each other when a narrow text exists between the two rubies. Split into two test files in order to fit each test result within one page.
  • fast/ruby/overhang-vertical-no-overlap1-expected.png: Added.
  • fast/ruby/overhang-vertical-no-overlap1-expected.txt: Added.
  • fast/ruby/overhang-vertical-no-overlap1.html: Added. Tests if two rubies do not overlap with each other when a narrow text exists between the two rubies. Split into two test files in order to fit each test result within one page.
  • fast/ruby/overhang-vertical-no-overlap2-expected.png: Added.
  • fast/ruby/overhang-vertical-no-overlap2-expected.txt: Added.
  • fast/ruby/overhang-vertical-no-overlap2.html: Added. Tests if two rubies do not overlap with each other when a narrow text exists between the two rubies. Split into two test files in order to fit each test result within one page.
  • platform/chromium-linux/fast/ruby/overhang-vertical-expected.png: Removed.
  • platform/chromium-win/fast/ruby/overhang-horizontal-expected.png: Removed.
  • platform/chromium/test_expectations.txt: Skips overhang-horizontal.html. We will update the result image as a rebase line.
Location:
trunk
Files:
12 added
2 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r95346 r95350  
     12011-09-16  Kentaro Hara  <haraken@google.com>
     2
     3        Overhangs a ruby by no more than half the width of the neighboring text.
     4        https://bugs.webkit.org/show_bug.cgi?id=62684
     5
     6        Reviewed by Dan Bernstein.
     7
     8        Assume two rubies between which a narrow text exists, like
     9        "<ruby>x<rt>xxxxxx</rt></ruby>l<ruby>y<rt>yyyyyy</rt></ruby>".
     10        In order to avoid the two rubies overlapping with each other,
     11        this patch overhangs the ruby by no more than half the ruby font
     12        size and no more than half the width of the neighboring text.
     13
     14        * fast/ruby/overhang-horizontal-no-overlap1-expected.png: Added.
     15        * fast/ruby/overhang-horizontal-no-overlap1-expected.txt: Added.
     16        * fast/ruby/overhang-horizontal-no-overlap1.html: Added. Tests if two rubies do not overlap with each other when a narrow text exists between the two rubies. Split into two test files in order to fit each test result within one page.
     17        * fast/ruby/overhang-horizontal-no-overlap2-expected.png: Added.
     18        * fast/ruby/overhang-horizontal-no-overlap2-expected.txt: Added.
     19        * fast/ruby/overhang-horizontal-no-overlap2.html: Added. Tests if two rubies do not overlap with each other when a narrow text exists between the two rubies. Split into two test files in order to fit each test result within one page.
     20        * fast/ruby/overhang-vertical-no-overlap1-expected.png: Added.
     21        * fast/ruby/overhang-vertical-no-overlap1-expected.txt: Added.
     22        * fast/ruby/overhang-vertical-no-overlap1.html: Added. Tests if two rubies do not overlap with each other when a narrow text exists between the two rubies. Split into two test files in order to fit each test result within one page.
     23        * fast/ruby/overhang-vertical-no-overlap2-expected.png: Added.
     24        * fast/ruby/overhang-vertical-no-overlap2-expected.txt: Added.
     25        * fast/ruby/overhang-vertical-no-overlap2.html: Added. Tests if two rubies do not overlap with each other when a narrow text exists between the two rubies. Split into two test files in order to fit each test result within one page.
     26        * platform/chromium-linux/fast/ruby/overhang-vertical-expected.png: Removed.
     27        * platform/chromium-win/fast/ruby/overhang-horizontal-expected.png: Removed.
     28        * platform/chromium/test_expectations.txt: Skips overhang-horizontal.html.  We will update the result image as a rebase line.
     29
    1302011-09-16  Ben Wells  <benwells@chromium.org>
    231
  • trunk/LayoutTests/platform/chromium/test_expectations.txt

    r95343 r95350  
    36873687BUGJAMESR LINUX : svg/transforms/text-with-pattern-with-svg-transform.svg = IMAGE PASS
    36883688
     3689// Temporary failure. This failure is going to be removed as a rebase line
     3690// after WebKit bug r62684 is landed.
     3691BUGWK62684 : fast/ruby/overhang-horizontal.html = FAIL
     3692
    36893693// We don't seem to load this glyph on windows
    36903694BUGJAMESR WIN : fast/text/fallback-traits-fixup.html = IMAGE+TEXT
  • trunk/Source/WebCore/ChangeLog

    r95349 r95350  
     12011-09-16  Kentaro Hara  <haraken@google.com>
     2
     3        Overhangs a ruby by no more than half the width of the neighboring text.
     4        https://bugs.webkit.org/show_bug.cgi?id=62684
     5
     6        Reviewed by Dan Bernstein.
     7
     8        Assume two rubies between which a narrow text exists, like
     9        "<ruby>x<rt>xxxxxx</rt></ruby>l<ruby>y<rt>yyyyyy</rt></ruby>".
     10        In order to avoid the two rubies overlapping with each other,
     11        this patch overhangs the ruby by no more than half the ruby font
     12        size and no more than half the width of the neighboring text.
     13
     14        Tests: fast/ruby/overhang-horizontal-no-overlap1.html
     15               fast/ruby/overhang-horizontal-no-overlap2.html
     16               fast/ruby/overhang-vertical-no-overlap1.html
     17               fast/ruby/overhang-vertical-no-overlap2.html
     18
     19        * rendering/RenderRubyRun.cpp:
     20        (WebCore::RenderRubyRun::getOverhang): Calculates the width of ruby overhanging.
     21
    1222011-09-16  Sheriff Bot  <webkit.review.bot@gmail.com>
    223
  • trunk/Source/WebCore/rendering/RenderRubyRun.cpp

    r90302 r95350  
    3535#include "RenderRubyBase.h"
    3636#include "RenderRubyText.h"
     37#include "RenderText.h"
    3738#include "RenderView.h"
    3839
     
    286287
    287288    int logicalWidth = this->logicalWidth();
    288 
    289     // No more than half a ruby is allowed to overhang.
    290     int logicalLeftOverhang = rubyText->style(firstLine)->fontSize() / 2;
    291     int logicalRightOverhang = logicalLeftOverhang;
    292 
     289    int logicalLeftOverhang = numeric_limits<int>::max();
     290    int logicalRightOverhang = numeric_limits<int>::max();
    293291    for (RootInlineBox* rootInlineBox = rubyBase->firstRootBox(); rootInlineBox; rootInlineBox = rootInlineBox->nextRootBox()) {
    294292        logicalLeftOverhang = min<int>(logicalLeftOverhang, rootInlineBox->logicalLeft());
     
    304302    if (!endRenderer || !endRenderer->isText() || endRenderer->style(firstLine)->fontSize() > rubyBase->style(firstLine)->fontSize())
    305303        endOverhang = 0;
     304
     305    // We overhang a ruby only if the neighboring render object is a text.
     306    // We can overhang the ruby by no more than half the width of the neighboring text
     307    // and no more than half the font size.
     308    int halfWidthOfFontSize = rubyText->style(firstLine)->fontSize() / 2;
     309    if (startOverhang)
     310        startOverhang = min<int>(startOverhang, min<int>(toRenderText(startRenderer)->minLogicalWidth(), halfWidthOfFontSize));
     311    if (endOverhang)
     312        endOverhang = min<int>(endOverhang, min<int>(toRenderText(endRenderer)->minLogicalWidth(), halfWidthOfFontSize));
    306313}
    307314
Note: See TracChangeset for help on using the changeset viewer.